Enhancement for postgresql support
This commit is contained in:
parent
e030646631
commit
7e46e5bf54
@ -249,6 +249,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1)
|
|||||||
$okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS',
|
$okerror=array( 'DB_ERROR_TABLE_ALREADY_EXISTS',
|
||||||
'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
||||||
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
||||||
|
'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS', // PgSql use same code for table and key already exist
|
||||||
'DB_ERROR_RECORD_ALREADY_EXISTS',
|
'DB_ERROR_RECORD_ALREADY_EXISTS',
|
||||||
'DB_ERROR_NOSUCHTABLE',
|
'DB_ERROR_NOSUCHTABLE',
|
||||||
'DB_ERROR_NOSUCHFIELD',
|
'DB_ERROR_NOSUCHFIELD',
|
||||||
|
|||||||
@ -163,6 +163,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
if ($line != "")
|
if ($line != "")
|
||||||
{
|
{
|
||||||
|
# We remove end of request "AFTER fieldxxx"
|
||||||
|
$line=preg_replace('/AFTER [a-z_]+/i','',$line);
|
||||||
|
|
||||||
# we are inside create table statement so lets process datatypes
|
# we are inside create table statement so lets process datatypes
|
||||||
if (preg_match('/(ISAM|innodb)/i',$line)) { # end of create table sequence
|
if (preg_match('/(ISAM|innodb)/i',$line)) { # end of create table sequence
|
||||||
$line=preg_replace('/\)[\s\t]*type=(MyISAM|innodb);/i',');',$line);
|
$line=preg_replace('/\)[\s\t]*type=(MyISAM|innodb);/i',');',$line);
|
||||||
@ -754,6 +757,7 @@ class DoliDb
|
|||||||
'42P07' => 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS',
|
'42P07' => 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS',
|
||||||
'42703' => 'DB_ERROR_NOSUCHFIELD',
|
'42703' => 'DB_ERROR_NOSUCHFIELD',
|
||||||
1060 => 'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
1060 => 'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
||||||
|
42701=> 'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
||||||
'42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
'42710' => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
||||||
'23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
'23505' => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
||||||
'42704' => 'DB_ERROR_SYNTAX',
|
'42704' => 'DB_ERROR_SYNTAX',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user