logo       

Re: Emulating a sequence: msg#00018

python.db.pysqlite.user

Subject: Re: Emulating a sequence

You could do a Max(column_name) + 1 in your select, this will get the
Max value of the column. Don't know if that will work for you. Just
something simple to try.

Thanks,

Greg Givler
Information Technology
Lockwood®
10 Valley Stream Parkway
Malvern, PA 19355
Phone: (484) 605-4826
Email: ggivler-zdgUFu1MqnQ@xxxxxxxxxxxxxxxx




David Pratt

<fairwinds@xxxxxxxxxx To: Tim Golden
<mail-5j+KzFhapbd+shrj4D7q1g@xxxxxxxxxxxxxxxx>

a> cc:
pysqlite@xxxxxxxxxxxxxx
Sent by: Subject: Re: [pysqlite]
Emulating a sequence
pysqlite-bounces@list

s.initd.org





05/02/2006 09:55 AM










Tim Golden wrote:
> David Pratt wrote:
>> I was thinking about faking a sequence. My first thought was to
>> create a sequence table with a single row where a field is a sequence

>> value and you just increment the value and retreive it as anything
else.
>> It's simple but particulary good.

Eesh! I meant to say not particularly good. I guess it was late when I
wrote this.

> No comment as such on the sequence class (never
> tried it myself). I just wanted to make sure
> you did know about sqlite's automatic autoincrement
> value. I know it's not the same as a sequence, but
> in case you were simply trying to achieve the same
> effect...

Hi Tim. I am aware of autoincrementing and have been using it (see tid
below). I still need something to emulate a sequence. The field I need a

sequence for is not the primary key. It is a field that keeps track of
the commit_order for a type of transaction.

ie.
create table ztransaction (
tid integer not null primary key,
packed boolean not null default false,
commit_order integer not null unique,
more fields ...
);

Hopefully there are a few ideas out there. I'll have to finalize on one
today in any case :-)

Regards
David
_______________________________________________
pysqlite mailing list
pysqlite-IAPFreCvJWPBWskQ1e/+sw@xxxxxxxxxxxxxxxx
http://lists.initd.org/mailman/listinfo/pysqlite

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please call the help desk at ext 4850
______________________________________________________________________




______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise