Seaside Mysql Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Seaside Mysql Question

David Mitchell-10
Found this post:

http://lists.squeakfoundation.org/pipermail/seaside/2003-April/001368.html

I'm building a little query app against an internal MySQL database at
work. It is basically a wrapper around the MySQL result set.

Is Seaside-MySql available anywhere (Squeak Map or MC). My initial
creation is still a bit hackish and I'd like to compare it with
something else.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

Chris Cunnington-5
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.

The quick answer to your question is no. There is no package that combines
the two. There is no example I know of where the two are used. They may be
out there, lurking, but I haven't seen one. Although, if you've made it
work, I'd very much like to see it. And I don't think I'm alone in that.

There is not a lot of love in the Squeak world for MySQL. That's not my
opinion. It's an observation. The database of preference seems to be
PostgreSQL. In my experience the MySQL driver for Squeak does not work. I
imagine that will get somebody to contest that statement, but that's my
experience with it.

What is more objectively true is that the community support for the
PostgreSQL driver written by Yanni Chiu is much greater. And if you don't
want to feed the SQL statements into the image directly there is the Glorp
layer that works between the two.

I don't think people use MySQL much around here. I don't think there's any
real reason for that. It just seems to be the bias of this community.
GemStone is coming out with a free, commercial OO database that can be
connected to Seaside in the near future.

None of these answers are very satisfying to you, I imagine, as you are
working with an existing database, and not starting from scratch. I have
heard that the Glorp-maker, Alan Knight, is thinking of adding MySQL to the
package, which at the moment just works on PostgreSQL.

I restate that if you have made Seaside and MySQL work together at all, I
would like to see how you did it. But I don't think there's much around here
for you to compare it with. Perhaps your post will draw out a lurker with a
solution.

Chris


On 12/21/07 2:58 PM, "David Mitchell" <[hidden email]> wrote:

> Found this post:
>
> http://lists.squeakfoundation.org/pipermail/seaside/2003-April/001368.html
>
> I'm building a little query app against an internal MySQL database at
> work. It is basically a wrapper around the MySQL result set.
>
> Is Seaside-MySql available anywhere (Squeak Map or MC). My initial
> creation is still a bit hackish and I'd like to compare it with
> something else.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

keith1y
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.
>
>  
Dear David,

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
reader/writers.

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

Keith


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

keith1y
In reply to this post by Chris Cunnington-5

> I restate that if you have made Seaside and MySQL work together at all, I
> would like to see how you did it. But I don't think there's much around here
> for you to compare it with. Perhaps your post will draw out a lurker with a
> solution.
>
> Chris
>
>  
Oh and I am not the only one who has been successfully using MySql with
Seaside,

This project on squeaksource is what I based my stuff on, and it is
dated 2 years ago.

http://www.squeaksource.com/GestionImmo.html**

regards

Keith
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

Chris Cunnington-5
So, Keith,

"I think Chris doth speaketh to sooneth."

I think you meant to write "too". Unless you meant I'm speaking to a
Mr./Mrs. Sooneth. I don't know anybody by that name.

You have a MySQL solution that doesn't use the driver that's readily
available on SqueakSource/SqueakPackageLoader written by Alan Reider. I
think that supports my statement that it's not referred to very much.

You use one that works with Magritte. And you agree with me that there is
nothing for MySQL in Glorp at the moment.

Your link works if you add a "d", as in "addons", as in magritteaddons. OK.
And there are lots of versions, the latest being 16,
Magritte-RDB-kph.16.mcz,  of the RDB package. Ahh, and you must be "kph";
its author.

There are specific WAMysql classes in that add-on package. Cool. Looks like
a solution. It seems a drag to me that the you need to add 22 class
categories of Magritte, and then 4 more of your package for this solution.
I'd rather avoid Magritte. It's a PHd thesis, and so not optimized for
simplicity. People who use it, love it, I suppose. Probably makes them feel
smart.

I think Keith, that if you wrote up something on how to use your driver and
put it on seaside.st, then it would prove quite popular. You could use it to
assimilate people into the Borg that is Magritte.

I just looked on SqueakSource, and the latest update of Reider driver
is...in the last three hours. Mysql-alnr.15.mcz was posted today, it seems.
I think I'll have to try that driver again. The last time I did on Leopard,
I was given a "primitive failed" error. I do have access to other operating
systems, though.

Hmm, you're a co-admin on that project. I guess you just added an update.
Correct?  How about you write a tutorial using the MySQL driver without
Magritte. Now THAT would be a hit.


Chris
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

keith1y
Chris Cunnington wrote:
> So, Keith,
>
> "I think Chris doth speaketh to sooneth."
>
> I think you meant to write "too". Unless you meant I'm speaking to a
> Mr./Mrs. Sooneth. I don't know anybody by that name.
>  
I've had a long day.
> You have a MySQL solution that doesn't use the driver that's readily
> available on SqueakSource/SqueakPackageLoader written by Alan Reider. I
>  
eh? I said my solution does use this driver.

I dont believe that the driver was originally written by Alan Reider, I
used it back in March 2003 and it was already old enough to have been
published and have no current maintainer.  Alan took up the mantel and
added some additional support for more recent versions of MySql, there
are even bug reports on Mantis referring to this driver, indicating that
it works, apart from particular new datatypes.  As far as I know Alan
added support for the new password scheme, which adds a dependency on
Cryptography. If you look at Package Universes I think that this
dependency is listed.

The recent update to squeaksource, is due to the fact that I reminded
Alan of the existence of the squeaksource repository, he had been
maintaining it elsewhere.
My, fairly recent, contribution has simply been to begin to add a
factory pattern so that this driver may potentially support multiple
versions of MySQL since there are some slight variations between versions.
> think that supports my statement that it's not referred to very much.
>  
Ok, so actually how many seaside projects using post-stress and glorp
are published on seaside (ok I havent even looked) but its not that
many... I was contesting your point that MySql isnt used by the seaside
community. Didn't Tantalus and ROE use MySQL. Heck if you look on
SqueakMap you will see that version 1.10 of MySql is/was downloadable
from wiresong.ca, isnt that Avi's server!
> You use one that works with Magritte. And you agree with me that there is
> nothing for MySQL in Glorp at the moment.
>  
I didnt say that... actually I have been told that there is a company
which has it working with Glorp, I just haven't seen it for myself.
> Your link works if you add a "d", as in "addons", as in magritteaddons. OK.
>  
thank you
> And there are lots of versions, the latest being 16,
>  
erm... its a version control system, thats why theres lots of version in
there.
> Magritte-RDB-kph.16.mcz,  of the RDB package. Ahh, and you must be "kph";
> its author.
>
> There are specific WAMysql classes in that add-on package. Cool. Looks like
> a solution. It seems a drag to me that the you need to add 22 class
> categories of Magritte, and then 4 more of your package for this solution.
> I'd rather avoid Magritte. It's a PHd thesis, and so not optimized for
> simplicity. People who use it, love it, I suppose. Probably makes them feel
> smart.
Magritte is fantastic, its not even very complicated, its just fairly
logically complete.  If you are going to be taking data and rendering it
into a seaside component, with validation etc, if you write anything
vaguely generic, you are going to be aiming and probably failing to
attain the functionality of magritte.

Using some extensions to magritte which support scriptaculous, it is
getting to the point where it is possible to write whole seaside app's
just through magritte's data descriptions. This includes MySql
persistency, dependencies between fields, dynamic component visibility etc.
> I think Keith, that if you wrote up something on how to use your driver and
>  
I dont have a driver.
> put it on seaside.st, then it would prove quite popular. You could use it to
> assimilate people into the Borg that is Magritte.
>
>  
It might be worth writing something about the new dynamic extensions
that I wrote for magritte. Magritte itself has far better documentation
than I could write.
> I just looked on SqueakSource, and the latest update of Reider driver
> is...in the last three hours. Mysql-alnr.15.mcz was posted today, it seems.
> I think I'll have to try that driver again. The last time I did on Leopard,
> I was given a "primitive failed" error. I do have access to other operating
> systems, though.
>  
That might just be the dependency on Cryptography
> Hmm, you're a co-admin on that project. I guess you just added an update.
> Correct?
Dont think so.
>  How about you write a tutorial using the MySQL driver without
> Magritte. Now THAT would be a hit.
>  
http://www.squeaksource.com/GestionImmo.html

contains a fairly easy to follow database interface class which is the example that I learnt from.

I will see about including a refined version in the distribution.

I do think that the MySql Driver is needlessly complicated in areas, probably an artifact of its Java heritage.

Keith




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: Seaside Mysql Question

Ron Teitelbaum
In reply to this post by Chris Cunnington-5
> From: Chris Cunnington

> I don't think people use MySQL much around here. I don't think there's any
> real reason for that.

http://www.postgresql.org/about/licence 

http://www.mysql.com/company/legal/licensing/commercial-license.html 

Ron Teitelbaum

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

Alan Knight-2
In reply to this post by Chris Cunnington-5
At 03:37 PM 12/21/2007, Chris Cunnington wrote:
None of these answers are very satisfying to you, I imagine, as you are
working with an existing database, and not starting from scratch. I have
heard that the Glorp-maker, Alan Knight, is thinking of adding MySQL to the
package, which at the moment just works on PostgreSQL.

Um, Glorp works on a lot of different databases, including MySQL. But the part that Glorp handles is really just generating SQL appropriate for the database. It needs to be hooked up to a driver, which really just involves changing the <Dialect>DatabaseAccessor to talk to that driver. On VisualWorks, where there's a MySQL driver added in 7.6, which uses the same sort of APIs as the other database drivers, it works fine. Even the INFORMATION_SCHEMA reading stuff to read table definitions works on MySQL. So it would just be a matter of making it use whichever MySQL driver you wanted, and if the APIs between it and the other database drivers are different, making those adjustments.

I'm not likely to do the adjustments for Squeak, but if someone else wants to, I'd be happy to make sure they get merged in.

--
Alan Knight [|], Cincom Smalltalk Development

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Seaside Mysql Question

David Mitchell-10
In reply to this post by keith1y
Thanks Keith,

I wasn't looking for much (I don't even have update rights to the
database). I'm just doing some reporting.

I downloaded the MySQL driver off SqueakMap and it worked after I
stubbed in some asByteArray and asInteger on Integer and ByteArray.

Right now, I'm using Seaside for HTML generation. I've got a top level
component to match my the structure of our companies HTML so that the
CSS flows right. Then I have a component flow that basically consists
of home page (list of reports), the links fire off some SQL and load
the results into a component that shows a table. After I got there, I
thought, someone has probably already done this, and that's when I
found your old post.

I'll check out RDB, even though I'm sure it is overkill for me. I
don't have any intent to map the database to an object model.

Thanks!

David



On Dec 21, 2007 3:37 PM, Keith Hodges <[hidden email]> wrote:

> 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.
> >
> >
> Dear David,
>
> 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
> reader/writers.
>
> 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
>
> Keith
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside