samples/PhotoAlbum/lib/rb.php
private static function query($method,$sql,$values) {
		if (!self::$redbean->isFrozen()) {
			try {
				$rs = RedBean_Facade::$adapter->$method( $sql, $values );
			}catch(RedBean_Exception_SQL $e) {
				if(self::$writer->sqlStateIn($e->getSQLState(),
				array(
				RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN,
				RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
				)) {
					return array();
				}
				else {
					throw $e;
				}
			}
			return $rs;
		}
		else {
			return RedBean_Facade::$adapter->$method( $sql, $values );
		}
	}
private static function query($method,$sql,$values) {
		if (!self::$redbean->isFrozen()) {
			try {
				$rs = RedBean_Facade::$adapter->$method( $sql, $values );
			}catch(RedBean_Exception_SQL $e) {
				if(self::$writer->sqlStateIn($e->getSQLState(),
				array(
				RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN,
				RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
				)) {
					return array();
				}
				else {
					throw $e;
				}
			}
			return $rs;
		}
		else {
			return RedBean_Facade::$adapter->$method( $sql, $values );
		}
	}
private static function query ( $ method , $ sql , $ values ) { if ( ! self :: $ redbean -> isFrozen ( ) ) { try { $ rs = RedBean_Facade :: $ adapter -> $ method ( $ sql , $ values ) ; } catch ( RedBean_Exception_SQL $ e ) { if ( self :: $ writer -> sqlStateIn ( $ e -> getSQLState ( ) , array ( RedBean_QueryWriter :: C_SQLSTATE_NO_SUCH_COLUMN , RedBean_QueryWriter :: C_SQLSTATE_NO_SUCH_TABLE ) ) ) { return array ( ) ; } else { throw $ e ; } } return $ rs ; } else { return RedBean_Facade :: $ adapter -> $ method ( $ sql , $ values ) ; } }
Internal Query function, executes the desired query. Used by
all facade query functions. This keeps things DRY.

@throws RedBean_Exception_SQL

@param string $method desired query method (i.e. 'cell','col','exec' etc..)
@param string $sql    the sql you want to execute
@param array  $values array of values to be bound to query statement

@return array $results results of query
Internal Query function executes the desired query . Used by all facade query functions . This keeps things DRY .