[SqueakDBX] auto increment on Squeak/Pharo - Glorp - Postgres

Yanni Chiu yanni at rogers.com
Sat Feb 20 21:47:11 UTC 2010


Here's the relevant code from GlorpTutuorial.pdf, pages 13/14.

GlorpTutorialDescriptor >>tableForPEOPLE: aTable
(aTable createFieldNamed: 'ID' type: platform sequence) bePrimaryKey.
(aTable createFieldNamed: 'first_name' type: (platform varChar: 
50)).(aTable createFieldNamed: 'last_name' type: (platform varChar: 50)).
----
Begin Transaction
CREATE TABLE PEOPLE (ID serial NOT NULL ,FIRST_NAME varchar(50) NULL
,LAST_NAME varchar(50) NULL , CONSTRAINT PEOPLE_PK PRIMARY KEY  (ID),
CONSTRAINT PEOPLE_UNIQ UNIQUE  (ID))
Commit Transaction
----
session beginUnitOfWork.
person := Person first: 'Roger' last: 'Whitney'.
session register: person.
session commitUnitOfWork

It's pretty straightforward, define ID as primary key, leave it's value 
nil, and expect Glorp to fill in the ID value. That's what the tutorial 
says should happen.

I'm using the native PostgreSQL driver, not SqueakDBX. I doubt it 
matters in this case, I don't see any code generated to retrieve the 
sequence value. I may even have made changes to get it to generate 
SERIAL type.

Thanks for confirming that it's still using the old port from years ago. 
While Glorp has not changed much in the last few years, at the time the 
original Squeak port was done, there was still active development going on.

Not all the Glorp tests passed, but I'm pretty sure the two or three 
failures were unrelated. I think they had to do with BLOB/CLOB.

-- 
Yanni



Mariano Martinez Peck wrote:
> Hi Yanni,
> 
> I am in holidays, so I won't be able to look too much at it until Monday.
> 
> It is not clear for me if you are using GlorpDBX (using SqueakDBX 
> driver) or just Glorp with the native PostgreSQL driver ? If it is the 
> second, please ask in GLORP mailing list where you will probably receive 
> more help.
> 
> First, yes, the Squeak/Pharo version is quite old in compare to the one 
> of VW. This version may be even 2 or more years old. We need to make a 
> new port, but noone of us have the time to do it so far. I guess we will 
> do it some day.
> 
> Regarding your question, did you run the Glorp tests? they should all be 
> green. I ask because I think there are tests for what you say.
> 
> Even more, do you have a simple test I can run so that to reproduce the 
> problem ?
> 
> If you use Glorp + native postgresql driver, does it work correctly ? I 
> ask to see where the problem can came from.
> 
> Thanks!
> 
> Mariano
> 
> 
> On Thu, Feb 18, 2010 at 6:55 PM, Esteban Lorenzano <estebanlm at gmail.com 
> <mailto:estebanlm at gmail.com>> wrote:
> 
>     Hi, sorry for the delay...
>     are you using SqueakDBX/GlorpDBX or just Glorp with Postgresql... if
>     that is the case, I will say "I don't know", we are working on the
>     squeakdbx version postgresql drivers and glorp.
>     The postgresql version of glorpdbx should, of course, behave as
>     expected :)
> 
>     Cheers,
>     Esteban
> 
>     El 17/02/2010, a las 12:27p.m., Yanni Chiu escribió:
> 
>      > On page 14 of
>     http://www.eli.sdsu.edu/SmalltalkDocs/GlorpTutorial.pdf, it says:
>      >
>      > "When a session has a registered Person object with a nil value
>     for the id instance variable, GLORP retrieves the next value in the
>     id sequence and sets the id."
>      >
>      > I'm running with the Squeak/Pharo version of Glorp, with
>     Postgres, and this auto sequence did not work. Is this because the
>     Squeak version is much older? How does the Squeak version compare
>     with the latest VW version of Glorp?
>      >
>      > Thanks.
>      >
>      > --
>      > Yanni
>      >
>      > _______________________________________________
>      > SqueakDBX mailing list
>      > SqueakDBX at lists.squeakfoundation.org
>     <mailto:SqueakDBX at lists.squeakfoundation.org>
>      > http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx
> 
>     _______________________________________________
>     SqueakDBX mailing list
>     SqueakDBX at lists.squeakfoundation.org
>     <mailto:SqueakDBX at lists.squeakfoundation.org>
>     http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> SqueakDBX mailing list
> SqueakDBX at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/squeakdbx


More information about the SqueakDBX mailing list