Moved Insert table name catching for insert ID retrieving to work properly

git-svn-id: https://plugins.svn.wordpress.org/postgresql-for-wordpress/trunk@418055 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
hawk__
2011-08-01 20:48:51 +00:00
parent e8b97235bd
commit bd44178bd5

View File

@@ -194,16 +194,6 @@
$logto = 'INSERT';
$sql = str_replace('(0,',"('0',", $sql);
$sql = str_replace('(1,',"('1',", $sql);
$pattern = '/INSERT INTO (\w+)\s+\([ a-zA-Z_"]+/';
preg_match($pattern, $sql, $matches);
$GLOBALS['pg4wp_ins_table'] = $matches[1];
$match_list = split(' ', $matches[0]);
if( $GLOBALS['pg4wp_ins_table'])
{
$GLOBALS['pg4wp_ins_field'] = trim($match_list[3],' () ');
if(! $GLOBALS['pg4wp_ins_field'])
$GLOBALS['pg4wp_ins_field'] = trim($match_list[4],' () ');
}
// ZdMultiLang support hack
if( $GLOBALS['pg4wp_ins_table'] == $table_prefix.'zd_ml_trans')
@@ -330,6 +320,21 @@
$sql = str_replace( array_keys($zdml_conv), array_values($zdml_conv), $sql);
}
// For insert ID catching
if( $logto == 'INSERT')
{
$pattern = '/INSERT INTO (\w+)\s+\([ a-zA-Z_"]+/';
preg_match($pattern, $sql, $matches);
$GLOBALS['pg4wp_ins_table'] = $matches[1];
$match_list = split(' ', $matches[0]);
if( $GLOBALS['pg4wp_ins_table'])
{
$GLOBALS['pg4wp_ins_field'] = trim($match_list[3],' () ');
if(! $GLOBALS['pg4wp_ins_field'])
$GLOBALS['pg4wp_ins_field'] = trim($match_list[4],' () ');
}
}
// Put back the end of the query if it was separated
$sql .= $end;