mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-29 17:27:13 +02:00
Merge branch 'returning-replaces-seq' into rc-3.4
This commit is contained in:
@ -533,13 +533,13 @@ function wpsqli_query(&$connection, $query, $result_mode = 0)
|
||||
$GLOBALS['pg4wp_conn'] = $connection;
|
||||
$GLOBALS['pg4wp_result'] = $result;
|
||||
|
||||
if (false !== str_post("INSERT INTO")) {
|
||||
if (false !== strpos($sql, "INSERT INTO")) {
|
||||
$matches = array();
|
||||
preg_match("/^INSERT INTO ([a-z0-9_]+)/i", $query, $matches);
|
||||
preg_match("/^INSERT INTO\s+`?([a-z0-9_]+)`?/i", $query, $matches);
|
||||
$tableName = $matches[1];
|
||||
|
||||
if (false !== str_pos($sql, "RETURNING")) {
|
||||
$primaryKey = $this->get_primary_key_for_table($connection, $tableName);
|
||||
if (false !== strpos($sql, "RETURNING")) {
|
||||
$primaryKey = get_primary_key_for_table($connection, $tableName);
|
||||
$row = pg_fetch_assoc($result);
|
||||
|
||||
$GLOBALS['pg4wp_ins_id'] = $row[$primaryKey];
|
||||
|
Reference in New Issue
Block a user