Fix: qq corrections
This commit is contained in:
parent
a6ca8524f7
commit
1071a97e45
@ -88,7 +88,8 @@ class DoliDb
|
|||||||
1060 => 'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
1060 => 'DB_ERROR_COLUMN_ALREADY_EXISTS',
|
||||||
1061 => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
1061 => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS',
|
||||||
2627 => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
2627 => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
||||||
1064 => 'DB_ERROR_SYNTAX',
|
102 => 'DB_ERROR_SYNTAX',
|
||||||
|
8120 => 'DB_ERROR_GROUP_BY_SYNTAX',
|
||||||
1068 => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
|
1068 => 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS',
|
||||||
1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
|
1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
|
||||||
1091 => 'DB_ERROR_NOSUCHFIELD',
|
1091 => 'DB_ERROR_NOSUCHFIELD',
|
||||||
@ -329,14 +330,36 @@ class DoliDb
|
|||||||
$query = str_ireplace("\'", "''", $query);
|
$query = str_ireplace("\'", "''", $query);
|
||||||
|
|
||||||
|
|
||||||
$limitfound = stripos($query, " limit ");
|
$itemfound = stripos($query, " limit ");
|
||||||
if ($limitfound !== false) {
|
if ($itemfound !== false) {
|
||||||
|
// Extraire le nombre limite
|
||||||
$number = stristr($query, " limit ");
|
$number = stristr($query, " limit ");
|
||||||
$number = substr($number, 7);
|
$number = substr($number, 7);
|
||||||
|
// Insérer l'instruction TOP et le nombre limite
|
||||||
$query = str_ireplace("select ", "select top ".$number." ", $query);
|
$query = str_ireplace("select ", "select top ".$number." ", $query);
|
||||||
|
// Supprimer l'instruction MySql
|
||||||
$query = str_ireplace(" limit ".$number, "", $query);
|
$query = str_ireplace(" limit ".$number, "", $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$itemfound = stripos($query, " week(");
|
||||||
|
if ($itemfound !== false) {
|
||||||
|
// Recréer une requête sans instruction Mysql
|
||||||
|
$positionMySql = stripos($query, " week(");
|
||||||
|
$newquery = substr($query, 0, $positionMySql);
|
||||||
|
|
||||||
|
// Récupérer la date passée en paramètre
|
||||||
|
$extractvalue = stristr($query, " week(");
|
||||||
|
$extractvalue = substr($extractvalue, 6);
|
||||||
|
$positionMySql = stripos($extractvalue, ")");
|
||||||
|
// Conserver la fin de la requête
|
||||||
|
$endofquery = substr($extractvalue, $positionMySql);
|
||||||
|
$extractvalue = substr($extractvalue, 0, $positionMySql);
|
||||||
|
|
||||||
|
// Remplacer l'instruction MySql en Sql Server
|
||||||
|
// Insérer la date en paramètre et le reste de la requête
|
||||||
|
$query = $newquery." DATEPART(week, ".$extractvalue.$endofquery;
|
||||||
|
}
|
||||||
|
|
||||||
//print "<!--".$query."-->";
|
//print "<!--".$query."-->";
|
||||||
|
|
||||||
if (! $this->database_name)
|
if (! $this->database_name)
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class DoliDb
|
|||||||
1007 => 'DB_ERROR_ALREADY_EXISTS',
|
1007 => 'DB_ERROR_ALREADY_EXISTS',
|
||||||
1008 => 'DB_ERROR_CANNOT_DROP',
|
1008 => 'DB_ERROR_CANNOT_DROP',
|
||||||
1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
|
1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
|
||||||
1044 => 'DB_ERROR_ACCESSDENIED',
|
1044 => 'DB_ERROR_ACCESSDENIED',
|
||||||
1046 => 'DB_ERROR_NODBSELECTED',
|
1046 => 'DB_ERROR_NODBSELECTED',
|
||||||
1048 => 'DB_ERROR_CONSTRAINT',
|
1048 => 'DB_ERROR_CONSTRAINT',
|
||||||
1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
|
1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
|
||||||
@ -101,8 +101,8 @@ class DoliDb
|
|||||||
1136 => 'DB_ERROR_VALUE_COUNT_ON_ROW',
|
1136 => 'DB_ERROR_VALUE_COUNT_ON_ROW',
|
||||||
1146 => 'DB_ERROR_NOSUCHTABLE',
|
1146 => 'DB_ERROR_NOSUCHTABLE',
|
||||||
1216 => 'DB_ERROR_NO_PARENT',
|
1216 => 'DB_ERROR_NO_PARENT',
|
||||||
1217 => 'DB_ERROR_CHILD_EXISTS',
|
1217 => 'DB_ERROR_CHILD_EXISTS',
|
||||||
1451 => 'DB_ERROR_CHILD_EXISTS'
|
1451 => 'DB_ERROR_CHILD_EXISTS'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user