[Gambas-devel] MySQL class ready

David Villalobos Cambronero david_villalobos_c at ...7...
Tue Apr 15 23:22:52 CEST 2008


Ok, there is no problem, this is the Real Sense of open source...

Let me do it and I tell you...

----- Original Message ----
From: Benoit Minisini <gambas at ...1...>
To: mailing list for gambas developers <gambas-devel at lists.sourceforge.net>
Sent: Tuesday, April 15, 2008 2:50:49 PM
Subject: Re: [Gambas-devel] MySQL class ready

On mardi 15 avril 2008, Benoit Minisini wrote:
> On mardi 15 avril 2008, David Villalobos Cambronero wrote:
> > Let me check, I remember that I qouted table names, and the arguments
> > too.
> >
> > David
>
> Table and field names should be quoted, with the DB.Quote() function, as
> soon as they include reserved characters.
>
> But SQL requests have to be quoted too, with the DB.Subst(), Exec(),
> Find()... methods.
>
> I plan to try to make gb.db.mysql a true component, so that your class
> becomes its Gambas part. But first, you must solve the quoting problem. And
> for sure, I will have other remark in the future. :-)
>
> Regards,

Here is some remarks. I know, I'm fast...

You have to specify the connection used by your MySQL class.

But you can do a better design by reimplementing the DB and the Connection 
class so that they have a property named MySQL that returns a dummy object 
that will have all the methods of the MySQL class.

Look:

-------------------------------------------------------
' _MySQL.class
' The "_" is needed, so that the user don't see it!
Export

Property Connection As Connection

... All methods of the old MySQL class
-------------------------------------------------------
' Connection.class
Export

Property Read MySQL As _MySQL

Private Sub MySQL_Read() AS _MySQL

  _MySQL.Connection = Me
  Return _MySQL

End
-------------------------------------------------------
' DB.class
Export

Property Read MySQL As _MySQL

Private Sub MySQL_Read() AS _MySQL

  _MySQL.Connection = DB.Current
  Return _MySQL

End
-------------------------------------------------------

Am I clear?

This way, the user will just have to do things like:

DB.MySQL.CreateDatabase()
MyConnection.MySQL.DropTables()

Otherwise, I think the interface of your table creation methods, and so on, 
could be better too, but I have no idea at the moment. You can search 
yourself! :-) Maybe copying the interface of DB and Connection, so that the 
user does not have too much to learn again?

Regards,

-- 
Benoit Minisini

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Gambas-devel mailing list
Gambas-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel





      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ




More information about the Devel mailing list