[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gambas-devel
Subject:    Re: [Gambas-devel] Database field name error.
From:       ron <ronstk () tiscali ! nl>
Date:       2006-04-27 6:48:59
Message-ID: 200604270848.59354.ronstk () tiscali ! nl
[Download RAW message or body]

On Wednesday 26 April 2006 23:01, Benoit Minisini wrote:
> > I suggest to do it in the mysql driver to.
> > Adding backticks does not harm but without them it does/can
> > create errors for unexperiented people they do not understand.
> >
> >
> > my 3 cents
> >
> > Ron
> >
> >
> 
> You are right, I should quoting field names everywhere.
> 
> Regards,
> 
Thank you master of universe :)

But a little warning.
If the user uses COUNT(fielddname) it is fieldname that should be quoted.
COUNT can be also SUM(), AVG(), MAX(), MIN(), CAT(filed1,field2) or even 
more complex formulas. I use for that SQL syntax always upercase with mysql.
It could be easy for the quoting to require from the user to do it
that way so only mixed or lowcase are the db,table or field names for quoting.

SELECT MAX(`tbl1`.`field1`), `tblname2`.`field3` FROM `table1`, `table2`

For mysql the qouting for database objects is backtick and for arguments
it is single or double quote, this for the other readers. 

Consider for the Request class to use for .From(tbl as string)
the same method as current used for fields.
It is valid, at least for mysql, to use *FROM `table1`. `table2`* wich result 
in a join between the tables and done here by mysql.

Ron


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Gambas-devel mailing list
Gambas-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic