Bitrix Site Manager

CDatabase::QueryBindSelect

mixed
CDatabase::QueryBindSelect(
 string sql,
 array binds,
 bool ignore_errors=false,
 string error_position="" 
)

The method QueryBindSelect executes a "SELECT" SQL query that require variable binding.

Note
This method is for use with the Oracle version only!

Parameters

ParameterDescription
sql SQL query.
binds Array of fields BLOB, CLOB, LONG etc. in the format array("field name" => "value" [, ...]).
ignore_errors Specifies to ignore errors. If set to true, the method returns false on failure. If set to false, the method breaks the page execution.
Optional; false by default.
error_position String indicating the method call position in the code (e.g. __LINE__). If an SQL query fails and the file /bitrix/php_interface/dbconn.php has the variable $DBDebug=true;, the error_position and the failure SQL query are printed.

Return Values

The method returns an instance of CDBResult on success.

If an error occurs and the ignore_errors parameter is true, the function returns false. If the ignore_errors parameter is false, the method breaks the page execution, having the following operations performed beforehand.

  1. Calls the function AddMessage2Log.
  2. If the current user is an administrator or the file /bitrix/php_interface/dbconn.php has the variable $DBDebug=true; the full error description is printed. Otherwise, the function SendError is called.
  3. The file /bitrix/php_interface/dbquery_error.php is included. If this file does not exist, the file /bitrix/modules/main/include/dbquery_error.php is included instead.

See Also

Example



<?
$strSql = "
    SELECT 
        *
    FROM
        my_table
    WHERE
        :url like '/en/index.php%'
    ";
$arrBind = array("url" => $APPLICATION->GetCurUri());
$rs = $DB->QueryBindSelect($strSql, $arrBind, false, "F: ".__FILE__." L: ".__LINE__);
?>