[Seaside] Automatic Object Storage To MySQL

William Harford seaside at harford.org
Wed Jan 25 23:05:25 CET 2006


On 25-Jan-06, at 4:16 PM, Avi Bryant wrote:
>
> This is great work to have going on.  It reminds me of ReStore for  
> Dolphin - have you looked at that at all?
> http://www.solutionsoft.co.uk/restore/
>

I appear to have the same goals as restore.

> It would also be interesting (to me, anyway) to see if there was  
> some natural integration possible between this and ROE.  Though I  
> guess this is focused on MySQL (for now? How specific is it?),  
> whereas ROE is focused on PostgreSQL.

In some ways MySQL can be though of as the lest common denominator  
(this has changed in the past couple years but it's hard to teach an  
old dog new tricks). I don't see any reason (in fact I think it would  
be a good thing) to be able to use any SQL database for storage.

I looked at ROE some time ago and thought it's method for querying  
was very nice. Something ROE like for querying results might make a  
good companion. My only hesitation would be how that might effect  
different implementation done in different languages. I planed on  
having IOSPersistent libraries for multiple languages and would like  
to keep the API similar for all implementations.

That being said...
I do not want to sacrifice usability and simplicity. If other  
languages don't have the power of smalltalk this library should not  
suffer.


>
> Can you show us some code snippets of example use?

Sure ....
A simple example... Create a new class like so

IOSPersistent subclass: #IOSPageInfo
     instanceVariableNames: 'user date fileId page'
     classVariableNames: ''
     poolDictionaries: ''
     category: 'IOS-FLHSPMerge'


IOSPersistent implements automatic getter/setter methods this may or  
may not be a good idea but so far I like it. Because of this you can  
use this class with no further actions (but you normally would) .

pObject := IOSPageInfo new.
pObject user: (AUser newWithName: 'aname'). "AUser is a child of  
IOSPersistent"
pObject date: (Date today).
pObject fileId: 1.
pObject page: 5.

To save the object pass it an instance on a JdmConnection and  call  
#save

pObject pxxDbConnection:db; save.

IOSPersistent will create the table if needed and decide to either  
UPDATE or INSERT.
It will also save any i-vars that contain an IOSPersistent object  
that have never been saved. It needs to to get the objects ID.

IOSPersistent object are resolved using a lookup table.




>
> Avi
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the Seaside mailing list