Bio::GMOD::DB::Adapter nextoid

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bio::GMOD::DB::Adapter nextoid

Sven Heinicke
  Perhaps I'm using it wrong, but I was trying to use
Bio::GMOD::DB::Adapter to get the nextval of things.  When I call it
more then once in a program in only seems to increment the sequence
once. Perhaps there is a method to alter the sequence when I'm done?

$adapter->nextoid('organism', '++');
$adapter->nextoid('organism', '++');

gives off correct values but the postgresql organism_organism_id_seq is
only incremented once.

   Sven


------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Gmod-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bio::GMOD::DB::Adapter nextoid

Scott Cain
Hi Sven,

The adaptor's nextoid method doesn't modify the sequence at all during
run time; that is just incrementing the value that is stored in memory
while it is running.  It's only after data has been successfully
written to the database that the adaptor goes back and updates the
sequences with the values it's used (with the update_sequences
method).  The incrementing you are seeing is a side affect of the
adaptor determining if the current value in the sequence is valid
compared to the data in the table (in case some other program behaves
in a less friendly way and inserts data into the table without
updating the sequence).

Scott


On Tue, Aug 10, 2010 at 1:50 PM, Sven Heinicke
<[hidden email]> wrote:

>  Perhaps I'm using it wrong, but I was trying to use
> Bio::GMOD::DB::Adapter to get the nextval of things.  When I call it
> more then once in a program in only seems to increment the sequence
> once. Perhaps there is a method to alter the sequence when I'm done?
>
> $adapter->nextoid('organism', '++');
> $adapter->nextoid('organism', '++');
>
> gives off correct values but the postgresql organism_organism_id_seq is
> only incremented once.
>
>   Sven
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Gmod-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gmod-devel
>



--
------------------------------------------------------------------------
Scott Cain, Ph. D.                                   scott at scottcain dot net
GMOD Coordinator (http://gmod.org/)                     216-392-3087
Ontario Institute for Cancer Research

------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Gmod-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-devel
Reply | Threaded
Open this post in threaded view
|

Re: Bio::GMOD::DB::Adapter nextoid

Sven Heinicke
  I was grepping for alter sequence, not setval. Silly me I guess.
Thanks for the quick reply.

   Sven


On 2010-08-10 14.16, Scott Cain wrote:

> Hi Sven,
>
> The adaptor's nextoid method doesn't modify the sequence at all during
> run time; that is just incrementing the value that is stored in memory
> while it is running.  It's only after data has been successfully
> written to the database that the adaptor goes back and updates the
> sequences with the values it's used (with the update_sequences
> method).  The incrementing you are seeing is a side affect of the
> adaptor determining if the current value in the sequence is valid
> compared to the data in the table (in case some other program behaves
> in a less friendly way and inserts data into the table without
> updating the sequence).
>
> Scott
>
>
> On Tue, Aug 10, 2010 at 1:50 PM, Sven Heinicke
> <[hidden email]>  wrote:
>>   Perhaps I'm using it wrong, but I was trying to use
>> Bio::GMOD::DB::Adapter to get the nextval of things.  When I call it
>> more then once in a program in only seems to increment the sequence
>> once. Perhaps there is a method to alter the sequence when I'm done?
>>
>> $adapter->nextoid('organism', '++');
>> $adapter->nextoid('organism', '++');
>>
>> gives off correct values but the postgresql organism_organism_id_seq is
>> only incremented once.
>>
>>    Sven
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by
>>
>> Make an app they can't live without
>> Enter the BlackBerry Developer Challenge
>> http://p.sf.net/sfu/RIM-dev2dev
>> _______________________________________________
>> Gmod-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/gmod-devel
>>
>
>


------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Gmod-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gmod-devel