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
[email protected]
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Répondre à