[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dolibarr-bugtrack] [bug #33584] SQL comment in S QL module dev / Intégr
From: |
Florian HENRY |
Subject: |
[Dolibarr-bugtrack] [bug #33584] SQL comment in S QL module dev / Intégration des commentaires SQL da ns le dev des modules |
Date: |
Fri, 17 Jun 2011 13:47:38 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 |
URL:
<http://savannah.nongnu.org/bugs/?33584>
Summary: SQL comment in SQL module dev / Intégration des
commentaires SQL dans le dev des modules
Project: Dolibarr
Submitted by: fhenry
Submitted on: ven. 17 juin 2011 13:47:37 GMT
Severity: 3 - Normal
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Release: 3.0
Operating System: GNU/Linux
_______________________________________________________
Details:
Bonjour,
J'ai pu remarquer que dans le developement d'un nouveau module, et que l'on a
besion de crée des tables, il n'est pas possible de faire fichier de cette
forme :
create table llx_table
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(128) NOT NULL, -- comment 1
datec datetime, -- comment 2
tms timestamp, -- comment 3
fk_user_author integer, -- comment 4
}
les commentaires sont intégré dans le buffer d'execution et il sont
refuser.
Je propose d'intégré cette modification dans htdocs/lib/admin.lib.php
Dans le function run_sql juste aprés le test qui valide que la ligne ne
commence pas par un commentaire :
// Add line buf to buffer if not a comment
if (! preg_match('/^--/',$buf))
{
//remove comment from a line that not start with -- before
add it to the buffer
if (preg_match('/--/',$buf))
{
$buf = substr($buf,0,strpos($buf, '-'));
}
$buffer .= trim($buf);
}
Dites moi ce que vous en pensez ?
Cordialement
Henry Florian
----------------------------
Hello
I notice during the new module devloepement and if we need to create table,
it's not possible to write the SQL file like that
create table llx_table
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
label varchar(128) NOT NULL, -- comment 1
datec datetime, -- comment 2
tms timestamp, -- comment 3
fk_user_author integer, -- comment 4
}
Comment at the end of the line are integrated into the execution buffer and
they are interpreted as invalid instructions
I suggest a modification in htdocs/lib/admin.lib.php
In function run_sql juste just after the test "Add line buf to buffer if not a
comment" :
// Add line buf to buffer if not a comment
if (! preg_match('/^--/',$buf))
{
//remove comment from a line that not start with -- before
add it to the buffer
if (preg_match('/--/',$buf))
{
$buf = substr($buf,0,strpos($buf, '-'));
}
$buffer .= trim($buf);
}
What do you think about ?
Kind regards
Henry Florian
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?33584>
_______________________________________________
Message posté via/par Savannah
http://savannah.nongnu.org/
- [Dolibarr-bugtrack] [bug #33584] SQL comment in S QL module dev / Intégration des commentaires SQL da ns le dev des modules,
Florian HENRY <=