public static function executePrepared($obj, $values=array())
    {
        if (!self::$_loaded) {
            self::_loadColumns();
        }

        // convert a builder to string
        if (!is_string($obj) && get_class($obj) == "TORM\Builder") {
            $sql = $obj->toString();
        }

        if (is_string($obj)) {
            $sql = $obj;
        }

        // if there aren't value marks, execute like a regular query
        if (!preg_match('/\?/', $sql)) {
            return self::query($sql);
        }

        try {
            Log::log("SQL: executing prepared: \n$sql\nvalues:\n".join(",", $values));
        } catch (Exception $e) {
            Log::log("SQL: executing prepared: \n$sql\nvalues impossible to convert to string");
        }

        $stmt = Cache::getInstance()->put($sql, get_called_class());
        $stmt->execute($values);
        return $stmt;
    }
public static function executePrepared($obj, $values=array())
    {
        if (!self::$_loaded) {
            self::_loadColumns();
        }

        // convert a builder to string
        if (!is_string($obj) && get_class($obj) == "TORM\Builder") {
            $sql = $obj->toString();
        }

        if (is_string($obj)) {
            $sql = $obj;
        }

        // if there aren't value marks, execute like a regular query
        if (!preg_match('/\?/', $sql)) {
            return self::query($sql);
        }

        try {
            Log::log("SQL: executing prepared: \n$sql\nvalues:\n".join(",", $values));
        } catch (Exception $e) {
            Log::log("SQL: executing prepared: \n$sql\nvalues impossible to convert to string");
        }

        $stmt = Cache::getInstance()->put($sql, get_called_class());
        $stmt->execute($values);
        return $stmt;
    }
public static function executePrepared ( $ obj , $ values = array ( ) ) { if ( ! self :: $ _loaded ) { self :: _loadColumns ( ) ; } // convert a builder to string if ( ! is_string ( $ obj ) && get_class ( $ obj ) == "TORM\Builder" ) { $ sql = $ obj -> toString ( ) ; } if ( is_string ( $ obj ) ) { $ sql = $ obj ; } // if there aren't value marks, execute like a regular query if ( ! preg_match ( '/\?/' , $ sql ) ) { return self :: query ( $ sql ) ; } try { Log :: log ( "SQL: executing prepared: \n$sql\nvalues:\n" . join ( "," , $ values ) ) ; } catch ( Exception $ e ) { Log :: log ( "SQL: executing prepared: \n$sql\nvalues impossible to convert to string" ) ; } $ stmt = Cache :: getInstance ( ) -> put ( $ sql , get_called_class ( ) ) ; $ stmt -> execute ( $ values ) ; return $ stmt ; }
Execute a prepared statement, trying to get it from cache.

@param mixed $obj    object
@param mixed $values to use

@return object statement
Execute a prepared statement trying to get it from cache .