is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 14 years ago

Closed 14 years ago

#586 closed bug (fixed)

Bug creating sqlite record (autoincrement)

Reported by: maurice Owned by: laurentj
Priority: high Milestone: Jelix 1.0.4
Component: jelix:dao Version: 1.0.3
Severity: major Keywords:
Cc: Maurice.Diamantini@… Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version: 5.2.5


Testing the full tutorial with sqlite3 (pdo) instead of mySql doesn't work.

(php 5.2.5 with sqlite or 3.3.17 on osx (MAMP) or 3.3.6 (on linux)

At most one record can be inserted because Jelix try to add all records with the same uniq id ("id_news" field) with value 0 instead of the value (or string?) NULL which should be used for the autoincrement feature.

One can make a hacking correction by directly modifing the Jelix generated file


 // For autoincrementation feature value 0 should be replaced by
 // sqlite value NULL
 public function insert ($record){
     if($record->id_news > 0 ){
         // ok... on utilise intval($record->id_news) : pas touché
     } else {
         // il faudrait remplacer ici :
         //  par :

For testing the tutorial with sqlite, I use the following dbprofiles.ini.php config.

       default =
       host= "localhost"
       user= "root"
       persistent= off
       force_encoding = off
       ; TODO : one should be able to build the absolute path instead of wiring it!

and the following sql for sqlite3 base initialisation :

       -- sqlite3 var/data/ \
       --            < init_actu_news_table-sqlite3.sql
       DROP table if exists `news`;
       CREATE TABLE news (
           id_news  INTEGER PRIMARY KEY,
           sujet varchar(255) not null ,
           texte text not null ,
           news_date date not null 
       INSERT INTO news VALUES (
           'première news', 
           'Ceci est une première news. In commodo ... end.', 
       INSERT INTO news VALUES (
           'Lorem Ipsum', 
           'Lorem ipsum dolor sit amet, consectetuer adipiscing elit.', 

(database and it's directory should be world writable for testing)

-- Maurice

Change History (5)

comment:1 Changed 14 years ago by maurice

  • Cc Maurice.Diamantini@… added
  • Priority changed from normal to high

comment:2 Changed 14 years ago by laurentj

  • Component changed from jelix to jelix:dao
  • Milestone set to Jelix 1.0.4

comment:3 Changed 14 years ago by laurentj

  • Owner set to laurentj
  • Status changed from new to assigned

In fact, this bug was already fixed by Bballizlife on the trunk (svn 872) and backported by me on the 1.0.x branch (svn 894).

Could you download a nightly build of jelix 1.0.4, and could you verify that your bug doesn't exists anymore ? Thanks.

comment:4 Changed 14 years ago by maurice

The original bug doesn't exists anymore, thank you very much. You can close this ticket

comment:5 Changed 14 years ago by laurentj

  • Resolution set to fixed
  • Status changed from assigned to closed

Thank you.

Note: See TracTickets for help on using tickets.