[Zope] MySQL Select Statements

Curtis Maloney curtis@umd.com.au
Fri, 30 Jun 2000 14:08:06 +1000


On Fri, 30 Jun 2000, Michael Blewett wrote:
> Hi Everyone,
> Just need someone to put me straight here. When I use Select statements in
> an SQL Method I cannot simply :
>
> Select Column1, Column2 etc
> from TableA.
>
Depending on  the column names, yes you can.  I just tested it not, and it 
works fine.  If the column names are not valid zope/python names, you will 
run into problems.

> Instead I must use the AS statement ie
>
> Select Column1 AS Column1, Column2 AS Column2
> from TableA.
>
> Is this just an oddity with the MySQLDA/Db adapters or am I overlooking
> something blatantly obvious here? All the examples on zope.org don't have
> the extra "AS Column1" additions on them and I was wondering if this is a
> Zope/mySQL-unique thing.

Can you try to construct the simplest example of a query that doesn't work?

>
> I'm using Zope (2.1.6) with MySQL (3.22.32) with Zope MySQL Database
> Adapter (ZMySQLDA) 2.0.0a1 and
> MySQLdb module release: 0.2.2 .

Hmm.. I am using the same, except for ZMySQLda 1.1.3, and MySQLdb 0.1.2.  So, 
perhaps it's new in ZMySQLda 2.0.

>
> Could someone please let me know as I don't want to have to type the extra
> bits on all my SQL statements from here on in if I don't need to (I am the
> world's worst and laziest typist). If it is the case that it's a necessary

What, you've never heard of cut'n'paste? (o8

> evil, then I want to put a HowTo or Tip up on zope.org because it took me a
> while to figure out what I was doing wrong, and if I can save someone else
> that same wasted time then I would like to. However I wanted to get my
> facts straight (via all you experts) first.

A wise move, and a wonderful gesture.

>
> Thanks for any help...
>
>   - Michael

Have a better one,
	Curtis Maloney

<dtml-var standard_work_disclaimer>