[Seaside] Seaside Mysql Question
keith_hodges at yahoo.co.uk
Fri Dec 21 21:37:57 UTC 2007
Chris Cunnington wrote:
> Hi David,
> I'm going to throw out a bunch of observations here, and if anyone wants to
> have a different opinion, I'm happy to hear it.
I think Chris doth speaketh to sooneth.
The MySQL driver is available on squeaksource at http://www.squeaksource.com
I have heard rumours of GLORP support for MySql, but I haven't obtained
any code as yet.
In the meantime I have been using MySql with Magritte and there is a
package in http://mc.lukas-renggli.ch/magritteadons called 'RDB'. Ok its
not glorp, but it is serving me quite well.
This includes a reader/writer visitor for coercing data in and out of
databases (over and above that provided by the driver). This is useful
for saving any of your custom data types, e.g. "price with currency
code", and also simple Arrays/Sets of strings. i.e. The driver doesnt
have enough information about the datatype to know whether it is just
retrieving a string, or some other datatype written out as a string.
Magritte descriptions on the other hand do give this information. So the
database access classes MYSQL40 and MYSQL41 use these coercion
For using MySql with seaside, there is a WAMysqlConfiguration for
setting the database/user/pass in seaside/config, and a class WAMySql
which uses the current application's settings. So far I have not found
it necessary to keep a session open per seaside session so there is no
SessionHelper for MySql as yet.
There are also some base classes MAModel, MANumberedModel, based upon
work by Damien I think, which can realize objects out of a database
based upon Magritte descriptions. If your column names do not match the
object attribute names then define fieldName: in the description.
OneToOne relationships are supported, so if you realize an object with a
one to one relationship, its relation is also realised. You have to
specify the "joinField: fieldName" and "joinTo: fieldName" for the one
to one magritte description.
This package may be lacking sufficient examples as to how to use it, I
can provide you with some if you wish, just ask
More information about the seaside