sqlite autoincrement of primary key

tinauser tinauser at libero.it
Mon Nov 29 23:19:30 CET 2010


On Nov 29, 10:49 pm, "D'Arcy J.M. Cain" <da... at druid.net> wrote:
> On Mon, 29 Nov 2010 19:11:18 +0000 (UTC)
>
> Tim Harig <user... at ilthio.net> wrote:
> > >   INSERT INTO foo (name) VALUES ('xxx')
>
> > > That's the standard SQL way.
>
> > Yes, it works; but, the OP asked specifically to be able to enter all of
> > the field values, including the autoincrement field.
>
> You're right, I missed that.  However reading the OP's message I am
> still confused.  How does removing the field name and adding a
> positional NULL or None improve readability.  I now wonder if it was
> more of an assignment requirement rather than a real one.
>
> --
> D'Arcy J.M. Cain <da... at druid.net>         |  Democracy is three wolveshttp://www.druid.net/darcy/               |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


Was not an assignment.
I created a general table class and several specific tables.
The application I'm going to write is going to be used by scientist
that might not have a strong computational background, but they might
be willing of adding some new tables. Their code knowledge might be so
low that they might not go further a copy-paste.
The way I defined the table, they just have to create lists indicating
the name of the columns, their content and eventually some initial
values for instance.
self.colNames= [     'id'        ,   'name' ,   'surname',
'age'    ]
self.colType   = [INTEGER,     TEXT ,    TEXT      , INTEGER]
self.init.append([   None    ,      'john'  ,  'Lennon'   ,
'51'       ])
i.e. the code has to resable the structure of the table and be easily
copy and paste (this last thing makes this system better than,
instead, using python dictionary...also because the future user might
not be familiar at all with dictionary).I might think of doing an
automatic substitution of the primarykey with None, that is not a
problem

Anyhow, as said, thanks for all the answers, you solved my question

Regards



More information about the Python-list mailing list