protected function OAuthStorePostgreSQL::query_insert_id in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::query_insert_id()
- 7.2 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::query_insert_id()
- 7.3 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::query_insert_id()
- 7.4 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::query_insert_id()
- 7.5 lib/oauth-php/library/store/OAuthStorePostgreSQL.php \OAuthStorePostgreSQL::query_insert_id()
Return the id of the last inserted row
Return value
int
1 call to OAuthStorePostgreSQL::query_insert_id()
- OAuthStorePostgreSQL::updateServer in lib/
oauth-php/ library/ store/ OAuthStorePostgreSQL.php - Register or update a server for our site (we will be the consumer)
File
- lib/
oauth-php/ library/ store/ OAuthStorePostgreSQL.php, line 1888
Class
Code
protected function query_insert_id($tableName, $primaryKey = null) {
$sequenceName = $tableName;
if ($primaryKey) {
$sequenceName .= "_{$primaryKey}";
}
$sequenceName .= '_seq';
$sql = "\n SELECT\n CURRVAL('%s')\n ";
$args = array(
$sql,
$sequenceName,
);
$sql = $this
->sql_printf($args);
if (!($res = pg_query($this->conn, $sql))) {
return 0;
}
$val = pg_fetch_row($res, 0);
if ($val && isset($val[0])) {
$val = $val[0];
}
pg_free_result($res);
return $val;
}