dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] SQL comment in SQL module dev / Int égration des comm


From: Laurent Destailleur (eldy)
Subject: Re: [Dolibarr-dev] SQL comment in SQL module dev / Int égration des commentaires SQL dans le dev des mosules
Date: Wed, 29 Jun 2011 12:40:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10

Patch inserted.

Le 09/06/2011 17:35, Florian HENRY a écrit :
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

_______________________________________________ Dolibarr-dev mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/dolibarr-dev


-- 
Eldy (Laurent Destailleur).
---------------------------------------------------------------
EMail: address@hidden
Web: http://www.destailleur.fr

Dolibarr (Project leader): http://www.dolibarr.org
To make a donation for Dolibarr project via Paypal: address@hidden
AWStats (Author) : http://awstats.sourceforge.net
To make a donation for AWStats project via Paypal: address@hidden
AWBot (Author) : http://awbot.sourceforge.net
CVSChangeLogBuilder (Author) : http://cvschangelogb.sourceforge.net

reply via email to

[Prev in Thread] Current Thread [Next in Thread]