You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by zhaoxin <zh...@hotmail.com> on 2003/10/04 16:06:09 UTC

dose torque support postgres????

Hello fellows,

I cannot work it out when i try to use torque to update Postgres database
records.  I got a sql error said: "Parse error near '.' ". The java codes is
the following:

                FaxItem item = FaxItemPeer.retrieveByPK(itemIds[i]);
                item.setFolderId(folderId);
                FaxItemPeer.doUpdate(item, conn);

I dont know what the reason is. So i read the log of the postgres. I guess
Torque had submit a SQL command like the following:

                UPDATE  table_name SET table_name.column_name = 'xxxxx'
WHERE  column_name='yyyyyy'

I execute this command directly by the postgres db console, and i got the
same error! but i succeed if i try that:

                UPDATE  table_name SET column_name = 'xxxxx' WHERE
column_name='yyyyyy'

Postgres dosn't support the SQL command like the syntax?? If not, why torque
generates and submits such wrong syntax of command to postgres??

Will be high appreciated if any one can help me. Thanks in advance!

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE : Casting Records from executeQuery function

Posted by Amine Bousta <ab...@lxsolutions.com>.
Thank you so much Matan! :)

I used "populateObjects" that applies a "row2object" to the entire List
and it worked!
When I do a "doSelect" I don't need to do that but with a "executeQuery"
it seems to be necessary. doSelect must surely do a populateObjects
inside.

Thank you again

Amine

-----Message d'origine-----
De : Matan [mailto:matan@matan.com] 
Envoyé : dimanche 5 octobre 2003 22:09
À : 'Apache Torque Users List'
Objet : RE: Casting Records from executeQuery function

Hi Amine,

executeQuery returns a List of Records (com.workingdogs.village.Record),
not
the usual OM classes created by Torque.  You can either access the
information straight from the Record object with methods like
getValue(row#), or you can convert the Record into a proper OM object if
it's compatible with one of them.

To do that conversion, there is the row2object function of the Peer
classes.

Hope that helps,
Matan

-----Original Message-----
From: Amine Bousta [mailto:abousta@lxsolutions.com] 
Sent: Sunday, October 05, 2003 21:33
To: 'Apache Torque Users List'
Subject: Casting Records from executeQuery function


Hello,

Does anybody experienced any problem with the "executeQuery" function of
BasePeer?

When I cast records of a List coming from the "doSelect" method it
works.
But when I try to cast records of the same List coming from the
"executeQuery" method it doesn't work. So I can't use executeQuery in my
program.

Am I alone in this situation?

Regards



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Casting Records from executeQuery function

Posted by Matan <ma...@matan.com>.
Hi Amine,

executeQuery returns a List of Records (com.workingdogs.village.Record), not
the usual OM classes created by Torque.  You can either access the
information straight from the Record object with methods like
getValue(row#), or you can convert the Record into a proper OM object if
it's compatible with one of them.

To do that conversion, there is the row2object function of the Peer classes.

Hope that helps,
Matan

-----Original Message-----
From: Amine Bousta [mailto:abousta@lxsolutions.com] 
Sent: Sunday, October 05, 2003 21:33
To: 'Apache Torque Users List'
Subject: Casting Records from executeQuery function


Hello,

Does anybody experienced any problem with the "executeQuery" function of
BasePeer?

When I cast records of a List coming from the "doSelect" method it works.
But when I try to cast records of the same List coming from the
"executeQuery" method it doesn't work. So I can't use executeQuery in my
program.

Am I alone in this situation?

Regards



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Casting Records from executeQuery function

Posted by Amine Bousta <ab...@lxsolutions.com>.
Hello,

Does anybody experienced any problem with the "executeQuery" function of
BasePeer?

When I cast records of a List coming from the "doSelect" method it
works.
But when I try to cast records of the same List coming from the
"executeQuery" method it doesn't work.
So I can't use executeQuery in my program.

Am I alone in this situation?

Regards



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: dose torque support postgres????

Posted by Michael Della Bitta <md...@columbia.edu>.
Hello,

I'm currently developing a site using PostgreSQL 7.3 and torque, and i 
do not have this problem. Are you sure your Torque.properties file has 
the correct settings?

How about if you create a new object, save it, then change an 
attribute, and save it again? I wonder if this has something to do with 
foreign keys...

Michael


On Saturday, October 4, 2003, at 10:06 AM, zhaoxin wrote:

> Hello fellows,
>
> I cannot work it out when i try to use torque to update Postgres 
> database
> records.  I got a sql error said: "Parse error near '.' ". The java 
> codes is
> the following:
>
>                 FaxItem item = FaxItemPeer.retrieveByPK(itemIds[i]);
>                 item.setFolderId(folderId);
>                 FaxItemPeer.doUpdate(item, conn);
>
> I dont know what the reason is. So i read the log of the postgres. I 
> guess
> Torque had submit a SQL command like the following:
>
>                 UPDATE  table_name SET table_name.column_name = 'xxxxx'
> WHERE  column_name='yyyyyy'
>
> I execute this command directly by the postgres db console, and i got 
> the
> same error! but i succeed if i try that:
>
>                 UPDATE  table_name SET column_name = 'xxxxx' WHERE
> column_name='yyyyyy'
>
> Postgres dosn't support the SQL command like the syntax?? If not, why 
> torque
> generates and submits such wrong syntax of command to postgres??
>
> Will be high appreciated if any one can help me. Thanks in advance!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org