SwatDB/SwatDB.php
public static function query(
        $db,
        $sql,
        $wrapper = 'SwatDBDefaultRecordsetWrapper',
        $types = null
    ) {
        $mdb2_types = $types === null ? true : $types;

        $rs = self::executeQuery($db, 'query', array(
            $sql,
            $mdb2_types,
            true,
            false
        ));

        // Wrap results. Do it here instead of in MDB2 so we can wrap using
        // an existing object instance.
        if (is_string($wrapper)) {
            $rs = new $wrapper($rs);
        } elseif ($wrapper instanceof SwatDBRecordsetWrapper) {
            $wrapper->initializeFromResultSet($rs);
            $rs = $wrapper;
        }

        return $rs;
    }
public static function query(
        $db,
        $sql,
        $wrapper = 'SwatDBDefaultRecordsetWrapper',
        $types = null
    ) {
        $mdb2_types = $types === null ? true : $types;

        $rs = self::executeQuery($db, 'query', array(
            $sql,
            $mdb2_types,
            true,
            false
        ));

        // Wrap results. Do it here instead of in MDB2 so we can wrap using
        // an existing object instance.
        if (is_string($wrapper)) {
            $rs = new $wrapper($rs);
        } elseif ($wrapper instanceof SwatDBRecordsetWrapper) {
            $wrapper->initializeFromResultSet($rs);
            $rs = $wrapper;
        }

        return $rs;
    }
public static function query ( $ db , $ sql , $ wrapper = 'SwatDBDefaultRecordsetWrapper' , $ types = null ) { $ mdb2_types = $ types === null ? true : $ types ; $ rs = self :: executeQuery ( $ db , 'query' , array ( $ sql , $ mdb2_types , true , false ) ) ; // Wrap results. Do it here instead of in MDB2 so we can wrap using // an existing object instance. if ( is_string ( $ wrapper ) ) { $ rs = new $ wrapper ( $ rs ) ; } elseif ( $ wrapper instanceof SwatDBRecordsetWrapper ) { $ wrapper -> initializeFromResultSet ( $ rs ) ; $ rs = $ wrapper ; } return $ rs ; }
Performs an SQL query

@param MDB2_Driver_Common            $db      the database connection.
@param string                        $sql     the SQL to execute.
@param string|SwatDBRecordsetWrapper $wrapper optional. The object or
name of class with which
to wrap the result set. If
not specified,
{@link SwatDBDefaultRecordsetWrapper}
is used. Specify
<kbd>null</kbd> to return
an unwrapped MDB2 result.
@param array                         $types   optional. An array of MDB2 datatypes
for the columns of the
result set.

@return mixed A recordset containing the query result. If <i>$wrapper</i>
is specified as null, a MDB2_Result_Common object is
returned.

@throws SwatDBException
Performs an SQL query