本文整理汇总了PHP中fbsql_insert_id函数的典型用法代码示例。如果您正苦于以下问题:PHP fbsql_insert_id函数的具体用法?PHP fbsql_insert_id怎么用?PHP fbsql_insert_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fbsql_insert_id函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _insertid
function _insertid()
{
return fbsql_insert_id($this->_connectionID);
}
示例2: getInsertID
/**
* get last insert ID
*
* @return mixed MDB2 Error Object or id
* @access public
*/
function getInsertID()
{
$db =& $GLOBALS['_MDB2_databases'][$this->db_index];
return fbsql_insert_id($db->connection);
}
示例3: nextId
/**
* Returns the next free id in a sequence
*
* @param string $seq_name name of the sequence
* @param boolean $ondemand when true, the seqence is automatically
* created if it does not exist
*
* @return int the next id number in the sequence. DB_Error if problem.
*
* @internal
* @see DB_common::nextID()
* @access public
*/
function nextId($seq_name, $ondemand = true)
{
$seqname = $this->getSequenceName($seq_name);
$repeat = 0;
do {
$result = $this->query("INSERT INTO {$seqname} VALUES(NULL)");
if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) {
$repeat = 1;
$result = $this->createSequence($seq_name);
if (DB::isError($result)) {
return $result;
}
} else {
$repeat = 0;
}
} while ($repeat);
if (DB::isError($result)) {
return $result;
}
return @fbsql_insert_id($this->connection);
}
示例4: nextId
/**
* Get the next value in a sequence. We emulate sequences
* for fbsql. Will create the sequence if it does not exist.
*
* @access public
*
* @param $seq_name the name of the sequence
*
* @param $ondemand whether to create the sequence table on demand
* (default is true)
*
* @return a sequence integer, or a DB error
*/
function nextId($seq_name, $ondemand = true)
{
$sqn = preg_replace('/[^a-z0-9_]/i', '_', $seq_name);
$repeat = 0;
do {
$seqname = sprintf($this->getOption("seqname_format"), $sqn);
$result = $this->query("INSERT INTO {$seqname} VALUES(NULL)");
if ($ondemand && DB::isError($result) && $result->getCode() == DB_ERROR_NOSUCHTABLE) {
$repeat = 1;
$result = $this->createSequence($seq_name);
if (DB::isError($result)) {
return $result;
}
} else {
$repeat = 0;
}
} while ($repeat);
if (DB::isError($result)) {
return $result;
}
return fbsql_insert_id($this->connection);
}
示例5: nextId
/**
* returns the next free id of a sequence
*
* @param string $seq_name name of the sequence
* @param boolean $ondemand when true the seqence is
* automatic created, if it
* not exists
*
* @return mixed MDB_Error or id
* @access public
*/
function nextId($seq_name, $ondemand = TRUE)
{
$sequence_name = $this->getSequenceName($seq_name);
$this->expectError(MDB_ERROR_NOSUCHTABLE);
$result = $this->query("INSERT INTO {$sequence_name} VALUES (NULL)");
$this->popExpect();
if ($ondemand && MDB::isError($result) && $result->getCode() == MDB_ERROR_NOSUCHTABLE) {
// Since we are create the sequence on demand
// we know the first id = 1 so initialize the
// sequence at 2
$result = $this->createSequence($seq_name, 2);
if (MDB::isError($result)) {
return $this->raiseError(MDB_ERROR, NULL, NULL, 'Next ID: on demand sequence could not be created');
} else {
// First ID of a newly created sequence is 1
return 1;
}
}
$value = intval(@fbsql_insert_id());
$res = $this->query("DELETE FROM {$sequence_name} WHERE " . $this->options['sequence_col_name'] . " < {$value}");
if (MDB::isError($res)) {
$this->warnings[] = 'Next ID: could not delete previous sequence table values';
}
return $value;
}
示例6: insertId
public function insertId()
{
if (!empty($this->connect)) {
return fbsql_insert_id($this->connect);
} else {
return false;
}
}
示例7: lastInsertID
/**
* Returns the autoincrement ID if supported or $id or fetches the current
* ID in a sequence called: $table.(empty($field) ? '' : '_'.$field)
*
* @param string $table name of the table into which a new row was inserted
* @param string $field name of the field into which a new row was inserted
* @return mixed MDB2 Error Object or id
* @access public
*/
function lastInsertID($table = null, $field = null)
{
$connection = $this->getConnection();
if (MDB2::isError($connection)) {
return $connection;
}
$value = @fbsql_insert_id($connection);
if (!$value) {
return $this->raiseError(null, null, null, 'Could not get last insert ID', __FUNCTION__);
}
return $value;
}
示例8: lastInsertID
/**
* returns the autoincrement ID if supported or $id
*
* @param mixed $id value as returned by getBeforeId()
* @param string $table name of the table into which a new row was inserted
* @return mixed MDB2 Error Object or id
* @access public
*/
function lastInsertID($table = null, $field = null)
{
$connection = $this->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
$value = @fbsql_insert_id($connection);
if (!$value) {
return $this->raiseError();
}
return $value;
}