2
0
forked from Wavyzz/dolibarr

Fix: qq corrections

This commit is contained in:
Regis Houssin
2007-09-19 20:48:43 +00:00
parent a6ca8524f7
commit 1071a97e45
2 changed files with 29 additions and 6 deletions

View File

@@ -88,7 +88,8 @@ class DoliDb
1060 => 'DB_ERROR_COLUMN_ALREADY_EXISTS',
1061 => 'DB_ERROR_KEY_NAME_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',
1075 => 'DB_ERROR_CANT_DROP_PRIMARY_KEY',
1091 => 'DB_ERROR_NOSUCHFIELD',
@@ -329,14 +330,36 @@ class DoliDb
$query = str_ireplace("\'", "''", $query);
$limitfound = stripos($query, " limit ");
if ($limitfound !== false) {
$itemfound = stripos($query, " limit ");
if ($itemfound !== false) {
// Extraire le nombre limite
$number = stristr($query, " limit ");
$number = substr($number, 7);
// Ins<6E>rer l'instruction TOP et le nombre limite
$query = str_ireplace("select ", "select top ".$number." ", $query);
// Supprimer l'instruction MySql
$query = str_ireplace(" limit ".$number, "", $query);
}
$itemfound = stripos($query, " week(");
if ($itemfound !== false) {
// Recr<63>er une requ<71>te sans instruction Mysql
$positionMySql = stripos($query, " week(");
$newquery = substr($query, 0, $positionMySql);
// R<>cup<75>rer la date pass<73>e en param<61>tre
$extractvalue = stristr($query, " week(");
$extractvalue = substr($extractvalue, 6);
$positionMySql = stripos($extractvalue, ")");
// Conserver la fin de la requ<71>te
$endofquery = substr($extractvalue, $positionMySql);
$extractvalue = substr($extractvalue, 0, $positionMySql);
// Remplacer l'instruction MySql en Sql Server
// Ins<6E>rer la date en param<61>tre et le reste de la requ<71>te
$query = $newquery." DATEPART(week, ".$extractvalue.$endofquery;
}
//print "<!--".$query."-->";
if (! $this->database_name)

View File

@@ -84,7 +84,7 @@ class DoliDb
1007 => 'DB_ERROR_ALREADY_EXISTS',
1008 => 'DB_ERROR_CANNOT_DROP',
1025 => 'DB_ERROR_NO_FOREIGN_KEY_TO_DROP',
1044 => 'DB_ERROR_ACCESSDENIED',
1044 => 'DB_ERROR_ACCESSDENIED',
1046 => 'DB_ERROR_NODBSELECTED',
1048 => 'DB_ERROR_CONSTRAINT',
1050 => 'DB_ERROR_TABLE_ALREADY_EXISTS',
@@ -101,8 +101,8 @@ class DoliDb
1136 => 'DB_ERROR_VALUE_COUNT_ON_ROW',
1146 => 'DB_ERROR_NOSUCHTABLE',
1216 => 'DB_ERROR_NO_PARENT',
1217 => 'DB_ERROR_CHILD_EXISTS',
1451 => 'DB_ERROR_CHILD_EXISTS'
1217 => 'DB_ERROR_CHILD_EXISTS',
1451 => 'DB_ERROR_CHILD_EXISTS'
);