forked from Wavyzz/dolibarr
Qual: Uniformize SQL code to be more compatible
This commit is contained in:
@@ -241,10 +241,14 @@ foreach my $file (keys %filelist) {
|
|||||||
# nuke size of timestamp
|
# nuke size of timestamp
|
||||||
s/timestamp\([^)]*\)/timestamp/i;
|
s/timestamp\([^)]*\)/timestamp/i;
|
||||||
|
|
||||||
# double -> real
|
# double -> numeric
|
||||||
s/^double/real/i;
|
s/^double/numeric/i;
|
||||||
s/(\s*)double/${1}real/i;
|
s/(\s*)double/${1}numeric/i;
|
||||||
|
|
||||||
|
# float -> numeric
|
||||||
|
s/^float/numeric/i;
|
||||||
|
s/(\s*)float/${1}numeric/i;
|
||||||
|
|
||||||
# unique key(field1,field2)
|
# unique key(field1,field2)
|
||||||
if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
||||||
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
|
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
conf.php*.sav
|
conf.php*.sav
|
||||||
*.php
|
*.php
|
||||||
conf.php.mysql
|
conf.php.mysql
|
||||||
|
conf.php.postgres
|
||||||
|
|||||||
@@ -449,3 +449,15 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc
|
|||||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('52', 409, '', 9, 'MELILLA', 'Melilla', 1);
|
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('52', 409, '', 9, 'MELILLA', 'Melilla', 1);
|
||||||
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('53', 420, '', 20, 'OTROS', 'Otros', 1);
|
INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('53', 420, '', 20, 'OTROS', 'Otros', 1);
|
||||||
|
|
||||||
|
|
||||||
|
alter table llx_product_price modify price_level smallint NULL DEFAULT 1;
|
||||||
|
alter table llx_commandedet modify special_code integer UNSIGNED DEFAULT 0;
|
||||||
|
alter table llx_facturedet modify special_code integer UNSIGNED DEFAULT 0;
|
||||||
|
alter table llx_propaldet modify special_code integer UNSIGNED DEFAULT 0;
|
||||||
|
alter table llx_societe modify special_code integer NULL;
|
||||||
|
|
||||||
|
ALTER TABLE llx_adherent_options ADD INDEX uk_adherent_options (adhid);
|
||||||
|
ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid);
|
||||||
|
ALTER TABLE llx_c_ecotaxe ADD INDEX uk_c_ecotaxe (code);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
22
htdocs/install/mysql/tables/llx_adherent_options.key.sql
Normal file
22
htdocs/install/mysql/tables/llx_adherent_options.key.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
-- Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
ALTER TABLE llx_adherent_options ADD INDEX uk_adherent_options (adhid);
|
||||||
@@ -23,7 +23,5 @@ create table llx_adherent_options
|
|||||||
(
|
(
|
||||||
optid integer AUTO_INCREMENT PRIMARY KEY,
|
optid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
tms timestamp,
|
tms timestamp,
|
||||||
adhid integer NOT NULL, -- id de l'adherent auquel correspond ces attributs optionnel
|
adhid integer NOT NULL -- id de l'adherent auquel correspond ces attributs optionnel
|
||||||
|
|
||||||
UNIQUE INDEX(adhid)
|
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
21
htdocs/install/mysql/tables/llx_bank_class.key.sql
Normal file
21
htdocs/install/mysql/tables/llx_bank_class.key.sql
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
-- ===================================================================
|
||||||
|
-- Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ===================================================================
|
||||||
|
|
||||||
|
ALTER TABLE llx_bank_class ADD UNIQUE INDEX idx_bank_class_lineid (lineid);
|
||||||
@@ -21,7 +21,5 @@
|
|||||||
create table llx_bank_class
|
create table llx_bank_class
|
||||||
(
|
(
|
||||||
lineid integer NOT NULL,
|
lineid integer NOT NULL,
|
||||||
fk_categ integer NOT NULL,
|
fk_categ integer NOT NULL
|
||||||
|
|
||||||
INDEX(lineid)
|
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ create table llx_bordereau_cheque
|
|||||||
fk_bank_account integer,
|
fk_bank_account integer,
|
||||||
fk_user_author integer,
|
fk_user_author integer,
|
||||||
note text,
|
note text,
|
||||||
statut smallint(1) NOT NULL DEFAULT 0
|
statut smallint NOT NULL DEFAULT 0
|
||||||
|
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
21
htdocs/install/mysql/tables/llx_c_ecotaxe.key.sql
Normal file
21
htdocs/install/mysql/tables/llx_c_ecotaxe.key.sql
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
-- ========================================================================
|
||||||
|
-- Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
--
|
||||||
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ========================================================================
|
||||||
|
|
||||||
|
ALTER TABLE llx_c_ecotaxe ADD INDEX uk_c_ecotaxe (code);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
-- ========================================================================
|
-- ========================================================================
|
||||||
-- Copyright (C) 2007 R<>gis Houssin <regis@dolibarr.fr>
|
-- Copyright (C) 2007 R<>gis Houssin <regis@dolibarr.fr>
|
||||||
--
|
--
|
||||||
-- This program is free software; you can redistribute it and/or modify
|
-- This program is free software; you can redistribute it and/or modify
|
||||||
-- it under the terms of the GNU General Public License as published by
|
-- it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
create table llx_c_ecotaxe
|
create table llx_c_ecotaxe
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
code varchar(64) UNIQUE NOT NULL, -- Code servant <EFBFBD> la traduction et <EFBFBD> la r<EFBFBD>f<EFBFBD>rence interne
|
code varchar(64) NOT NULL, -- Code servant a la traduction et a la reference interne
|
||||||
libelle varchar(255), -- Description
|
libelle varchar(255), -- Description
|
||||||
price double(24,8), -- Montant HT
|
price double(24,8), -- Montant HT
|
||||||
organization varchar(255), -- Organisme g<EFBFBD>rant le bar<EFBFBD>me tarifaire
|
organization varchar(255), -- Organisme gerant le bareme tarifaire
|
||||||
fk_pays integer NOT NULL, -- Pays correspondant
|
fk_pays integer NOT NULL, -- Pays correspondant
|
||||||
active tinyint DEFAULT 1 NOT NULL
|
active tinyint DEFAULT 1 NOT NULL
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
@@ -41,7 +41,7 @@ create table llx_commandedet
|
|||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
||||||
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
||||||
special_code tinyint(4) UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0,
|
rang integer DEFAULT 0,
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ create table llx_facturedet
|
|||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||||
fk_export_compta integer DEFAULT 0 NOT NULL,
|
fk_export_compta integer DEFAULT 0 NOT NULL,
|
||||||
special_code tinyint(4) UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0, -- ordre d'affichage
|
rang integer DEFAULT 0, -- ordre d'affichage
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ CREATE TABLE llx_menu
|
|||||||
target varchar(100) NULL, -- Target of Url link
|
target varchar(100) NULL, -- Target of Url link
|
||||||
titre varchar(255) NOT NULL, -- Key for menu translation
|
titre varchar(255) NOT NULL, -- Key for menu translation
|
||||||
langs varchar(100), -- Lang file to load for translation
|
langs varchar(100), -- Lang file to load for translation
|
||||||
level tinyint(1), -- Used by auguria menu only. Do not use.
|
level smallint, -- Used by auguria menu only. Do not use.
|
||||||
leftmenu varchar(1) NULL default '1', -- Say if left menu defined in pre.inc.php and used by top menu must be overwritten by dynamic databse menu (1=yes by default)
|
leftmenu varchar(1) NULL default '1', -- Say if left menu defined in pre.inc.php and used by top menu must be overwritten by dynamic databse menu (1=yes by default)
|
||||||
perms varchar(255), -- Condition to show enabled or disabled
|
perms varchar(255), -- Condition to show enabled or disabled
|
||||||
enabled varchar(255) NULL default '1', -- Condition to show or hide
|
enabled varchar(255) NULL default '1', -- Condition to show or hide
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ create table llx_paiementfourn
|
|||||||
amount real DEFAULT 0, -- montant
|
amount real DEFAULT 0, -- montant
|
||||||
fk_user_author integer, -- auteur
|
fk_user_author integer, -- auteur
|
||||||
fk_paiement integer NOT NULL, -- moyen de paiement
|
fk_paiement integer NOT NULL, -- moyen de paiement
|
||||||
num_paiement varchar(50), -- num<75>ro de paiement (cheque)
|
num_paiement varchar(50), -- num<75>ro de paiement (cheque)
|
||||||
note text,
|
note text,
|
||||||
fk_bank integer NOT NULL,
|
fk_bank integer NOT NULL,
|
||||||
statut smallint(6) NOT NULL DEFAULT 0
|
statut smallint NOT NULL DEFAULT 0
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ create table llx_product_price
|
|||||||
tms timestamp,
|
tms timestamp,
|
||||||
fk_product integer NOT NULL,
|
fk_product integer NOT NULL,
|
||||||
date_price datetime NOT NULL,
|
date_price datetime NOT NULL,
|
||||||
price_level tinyint(4) NULL DEFAULT 1,
|
price_level smallint NULL DEFAULT 1,
|
||||||
price double(24,8) DEFAULT NULL,
|
price double(24,8) DEFAULT NULL,
|
||||||
price_ttc double(24,8) DEFAULT NULL,
|
price_ttc double(24,8) DEFAULT NULL,
|
||||||
price_min double(24,8) default NULL,
|
price_min double(24,8) default NULL,
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ create table llx_propaldet
|
|||||||
remise real DEFAULT 0, -- montant de la remise (obsolete)
|
remise real DEFAULT 0, -- montant de la remise (obsolete)
|
||||||
price real, -- prix final (obsolete)
|
price real, -- prix final (obsolete)
|
||||||
subprice double(24,8) DEFAULT 0, -- prix unitaire article
|
subprice double(24,8) DEFAULT 0, -- prix unitaire article
|
||||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantit<69> et incluant remise ligne et globale
|
||||||
product_type integer DEFAULT 0,
|
product_type integer DEFAULT 0,
|
||||||
date_start datetime DEFAULT NULL, -- date debut si service
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
date_end datetime DEFAULT NULL, -- date fin si service
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
@@ -43,7 +43,7 @@ create table llx_propaldet
|
|||||||
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
||||||
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
||||||
|
|
||||||
special_code tinyint(4) UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0 -- ordre affichage sur la propal
|
rang integer DEFAULT 0 -- ordre affichage sur la propal
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ create table llx_societe
|
|||||||
ape varchar(16), -- IDProf3: code ape pour france
|
ape varchar(16), -- IDProf3: code ape pour france
|
||||||
idprof4 varchar(16), -- IDProf4: nu pour france
|
idprof4 varchar(16), -- IDProf4: nu pour france
|
||||||
tva_intra varchar(20), -- tva
|
tva_intra varchar(20), -- tva
|
||||||
capital real, -- capital de la soci<63>t<EFBFBD>
|
capital real, -- capital de la soci<63>t<EFBFBD>
|
||||||
description text, --
|
description text, --
|
||||||
fk_stcomm smallint DEFAULT 0, -- commercial statut
|
fk_stcomm smallint DEFAULT 0, -- commercial statut
|
||||||
note text, --
|
note text, --
|
||||||
@@ -63,16 +63,16 @@ create table llx_societe
|
|||||||
supplier_account varchar(32), -- compte client chez un fournisseur
|
supplier_account varchar(32), -- compte client chez un fournisseur
|
||||||
fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel)
|
fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectlevel)
|
||||||
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
|
customer_bad tinyint DEFAULT 0, -- mauvais payeur 0/1
|
||||||
customer_rate real DEFAULT 0, -- taux fiabili<6C> client (0 <20> 1)
|
customer_rate real DEFAULT 0, -- taux fiabili<6C> client (0 <20> 1)
|
||||||
supplier_rate real DEFAULT 0, -- taux fiabili<6C> fournisseur (0 <20> 1)
|
supplier_rate real DEFAULT 0, -- taux fiabili<6C> fournisseur (0 <20> 1)
|
||||||
fk_user_creat integer NULL, -- utilisateur qui a cr<63><72> l'info
|
fk_user_creat integer NULL, -- utilisateur qui a cr<63><72> l'info
|
||||||
fk_user_modif integer, -- utilisateur qui a modifi<66> l'info
|
fk_user_modif integer, -- utilisateur qui a modifi<66> l'info
|
||||||
remise_client real DEFAULT 0, -- remise syst<73>matique pour le client
|
remise_client real DEFAULT 0, -- remise syst<73>matique pour le client
|
||||||
mode_reglement tinyint, -- mode de r<>glement
|
mode_reglement tinyint, -- mode de r<>glement
|
||||||
cond_reglement tinyint, -- condition de r<>glement
|
cond_reglement tinyint, -- condition de r<>glement
|
||||||
tva_assuj tinyint DEFAULT 1, -- assujeti ou non <20> la TVA
|
tva_assuj tinyint DEFAULT 1, -- assujeti ou non <20> la TVA
|
||||||
gencod varchar(255), -- barcode
|
gencod varchar(255), -- barcode
|
||||||
price_level tinyint(4) NULL, -- level of price for multiprices
|
price_level integer NULL, -- level of price for multiprices
|
||||||
import_key varchar(14) -- import key
|
import_key varchar(14) -- import key
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ create table llx_user_entrepot
|
|||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_entrepot integer UNSIGNED, -- pointe sur llx_entrepot
|
fk_entrepot integer UNSIGNED, -- pointe sur llx_entrepot
|
||||||
fk_user integer UNSIGNED, -- pointe sur llx_user
|
fk_user integer UNSIGNED, -- pointe sur llx_user
|
||||||
consult tinyint(1) UNSIGNED,
|
consult smallint UNSIGNED,
|
||||||
send tinyint(1) UNSIGNED
|
send smallint UNSIGNED
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
@@ -297,9 +297,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Effectue une requete et renvoi le resultset de reponse de la base
|
* \brief Effectue une requete et renvoi le resultset de reponse de la base
|
||||||
\param query Contenu de la query
|
* \param query Contenu de la query
|
||||||
\return resource Resultset de la reponse
|
* \return resource Resultset de la reponse
|
||||||
*/
|
*/
|
||||||
function query($query)
|
function query($query)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -214,11 +214,14 @@ class DoliDb
|
|||||||
$line=preg_replace('/datetime/i','timestamp',$line);
|
$line=preg_replace('/datetime/i','timestamp',$line);
|
||||||
|
|
||||||
# nuke size of timestamp
|
# nuke size of timestamp
|
||||||
// s/timestamp\([^)]*\)/timestamp/i;
|
$line=preg_replace('/timestamp\([^)]*\)/i','timestamp',$line);
|
||||||
|
|
||||||
# double -> real
|
# double -> numeric
|
||||||
// s/^double/real/i;
|
$line=preg_replace('/^double/i','numeric',$line);
|
||||||
// s/(\s*)double/${1}real/i;
|
$line=preg_replace('/(\s*)double/i','\\1numeric',$line);
|
||||||
|
# float -> numeric
|
||||||
|
$line=preg_replace('/^float/i','numeric',$line);
|
||||||
|
$line=preg_replace('/(\s*)float/i','\\1numeric',$line);
|
||||||
|
|
||||||
# unique key(field1,field2)
|
# unique key(field1,field2)
|
||||||
/* if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
/* if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
||||||
@@ -228,12 +231,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# unique index(field1,field2)
|
# unique index(field1,field2)
|
||||||
/* if (/unique index\s*\((\w+\s*,\s*\w+)\)/i) {
|
if (preg_match('/unique index\s*\((\w+\s*,\s*\w+)\)/i',$line))
|
||||||
s/unique index\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
|
{
|
||||||
$create_sql.=$_;
|
$line=preg_replace('/unique index\s*\((\w+\s*,\s*\w+)\)/i','UNIQUE\(\\1\)',$line);
|
||||||
next;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
# unique key [name] (field)
|
# unique key [name] (field)
|
||||||
/* if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
/* if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
||||||
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
||||||
@@ -492,7 +493,7 @@ class DoliDb
|
|||||||
// Convert MySQL syntax to PostgresSQL syntax
|
// Convert MySQL syntax to PostgresSQL syntax
|
||||||
$query=$this->convertSQLFromMysql($query);
|
$query=$this->convertSQLFromMysql($query);
|
||||||
|
|
||||||
$ret = pg_query($this->db, $query);
|
$ret = @pg_query($this->db, $query);
|
||||||
if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query))
|
if (! preg_match("/^COMMIT/i",$query) && ! preg_match("/^ROLLBACK/i",$query))
|
||||||
{
|
{
|
||||||
// Si requete utilisateur, on la sauvegarde ainsi que son resultset
|
// Si requete utilisateur, on la sauvegarde ainsi que son resultset
|
||||||
@@ -501,7 +502,8 @@ class DoliDb
|
|||||||
$this->lastqueryerror = $query;
|
$this->lastqueryerror = $query;
|
||||||
$this->lasterror = $this->error();
|
$this->lasterror = $this->error();
|
||||||
$this->lasterrno = $this->errno();
|
$this->lasterrno = $this->errno();
|
||||||
print '>>'.$this->lasterrno.' - '.$this->lasterror.' - '.$this->laqtqueryerror."<br>\n";
|
//print "\n>> ".$query."<br>\n";
|
||||||
|
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->laqtqueryerror."<br>\n";
|
||||||
}
|
}
|
||||||
$this->lastquery=$query;
|
$this->lastquery=$query;
|
||||||
$this->results = $ret;
|
$this->results = $ret;
|
||||||
@@ -758,7 +760,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',
|
||||||
1062 => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
1062 => 'DB_ERROR_RECORD_ALREADY_EXISTS',
|
||||||
1064 => 'DB_ERROR_SYNTAX',
|
'42704' => 'DB_ERROR_SYNTAX',
|
||||||
|
'42601' => 'DB_ERROR_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',
|
||||||
@@ -775,13 +778,12 @@ class DoliDb
|
|||||||
if (preg_match('/: *([0-9P]+):/',$errorlabel,$reg))
|
if (preg_match('/: *([0-9P]+):/',$errorlabel,$reg))
|
||||||
{
|
{
|
||||||
$errorcode=$reg[1];
|
$errorcode=$reg[1];
|
||||||
|
if (isset($errorcode_map[$errorcode]))
|
||||||
|
{
|
||||||
|
return $errorcode_map[$errorcode];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$errno=$errorcode?$errorcode:$errorlabel;
|
||||||
if (isset($errorcode_map[$errorcode]))
|
|
||||||
{
|
|
||||||
return $errorcode_map[$errorcode];
|
|
||||||
}
|
|
||||||
$errno=$errorlabel;
|
|
||||||
return ($errno?'DB_ERROR_'.$errno:'0');
|
return ($errno?'DB_ERROR_'.$errno:'0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
|||||||
$urlregex = '';
|
$urlregex = '';
|
||||||
|
|
||||||
// SCHEME
|
// SCHEME
|
||||||
if ($http) $urlregex .= "/^(http:\/\/|https:\/\/)";
|
if ($http) $urlregex .= "^(http:\/\/|https:\/\/)";
|
||||||
|
|
||||||
// USER AND PASS
|
// USER AND PASS
|
||||||
if ($pass) $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)";
|
if ($pass) $urlregex .= "([a-z0-9+!*(),;?&=\$_.-]+(\:[a-z0-9+!*(),;?&=\$_.-]+)?@)";
|
||||||
@@ -258,10 +258,10 @@ function isValidUrl($url,$http=0,$pass=0,$port=0,$path=0,$query=0,$anchor=0)
|
|||||||
// GET Query
|
// GET Query
|
||||||
if ($query) $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)";
|
if ($query) $urlregex .= "(\?[a-z+&\$_.-][a-z0-9;:@/&%=+\$_.-]*)";
|
||||||
// ANCHOR
|
// ANCHOR
|
||||||
if($anchor) $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)$/i";
|
if ($anchor) $urlregex .= "(#[a-z_.-][a-z0-9+\$_.-]*)$/i";
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (preg_match($urlregex, $url))
|
if (preg_match('!'.$urlregex.'!', $url))
|
||||||
{
|
{
|
||||||
$ValidUrl = 1;
|
$ValidUrl = 1;
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ function clean_url($url,$http=1)
|
|||||||
$newproto = '';
|
$newproto = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On passe le nom de domaine en minuscule
|
// On passe le nom de domaine en minuscule
|
||||||
$CleanUrl = preg_replace('/^'.preg_quote($proto.$domain,'/').'/i', $newproto.strtolower($domain), $url);
|
$CleanUrl = preg_replace('/^'.preg_quote($proto.$domain,'/').'/i', $newproto.strtolower($domain), $url);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user