Bitrix Site Manager

CDatabase::NextID

int
CDatabase::NextID(
 string sequence_name
)

The function returns the next value from the sequence.

Warning
For use with the Oracle version only!

Parameters

ParameterDescription
sequence_name Name of a sequence. 

See Also

Example



<?
function AddResultAnswer($arFields)
{
    $err_mess = (CForm::err_mess())."<br>Function: AddResultAnswer<br>Line: ";
    global $DB;
    $arBinds = array();
    $arInsert = $DB->PrepareInsert("b_form_result_answer", $arFields, "form");
    $AID = $DB->NextID("sq_b_form_result_answer");
    $strSql="INSERT INTO b_form_result_answer (ID,".$arInsert[0].") VALUES ($AID,".$arInsert[1].")";
    if (is_set($arFields, "USER_TEXT")) 
        $arBinds["USER_TEXT"] = $arFields["USER_TEXT"];
    if (is_set($arFields, "ANSWER_TEXT_SEARCH")) 
        $arBinds["ANSWER_TEXT_SEARCH"] = $arFields["ANSWER_TEXT_SEARCH"];
    if (is_set($arFields, "ANSWER_VALUE_SEARCH"))
        $arBinds["ANSWER_VALUE_SEARCH"] = $arFields["ANSWER_VALUE_SEARCH"];
    if (is_set($arFields, "USER_TEXT_SEARCH"))
        $arBinds["USER_TEXT_SEARCH"] = $arFields["USER_TEXT_SEARCH"];
    $DB->QueryBind($strSql, $arBinds);
    return $AID;
}
?>