Documentation

QueryBindSelect

This method is for use with the Oracle version only!



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

The method executes a "SEL ECT" SQL query that require variable binding. Non-static method.

The method returns an CDBResult object class on success.
If an error occurs and the ignore_errors parameter equals "true", the method returns "false".
If an error occurs and the ignore_errors parameter equals "false", the method interrupts page execution, the method interrupts page execution and performs the following operations beforehand:

  1. Calls the AddMessage2Log method.
  2. If the current user is a site administrator, the /bitrix/php_interface/dbconn.php file has the initialized $DBDebug=true; variable, the screen will display the full text of the error, otherwise the SendError method will be called.
  3. The /bitrix/php_interface/dbquery_error.php file will be connected. If it doesn't exist, the file /bitrix/modules/main/include/dbquery_error.php file will be connected instead.

Parameters

ParameterDescription
sql SQL query.
binds Array of BLOB, CLOB, LONG fields etc. in the array("field name" => "value" [, ...]) format.
ignore_errors Specifies to ignore errors. If set to "true", the method returns "false" when an error is encountered. If the ignore_errors parameter equals "false", then in case of an error the function terminates execution of complete page.
Optional; "false" by default.
error_position String that identifies position in code fr om where the CDatabase::QueryBindSelect method was called. If an SQL query fails and the file/bitrix/php_interface/dbconn.php has the $DBDebug=true; variable, both error_position and SQL query will be displayed on the screen. Optional.

See Also

Examples of use

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


© «Bitrix24», 2001-2024
Up