Re: Double quotes in select statement throw an error

2005-01-22 Thread Jonathan Leffler
On Tue, 18 Jan 2005 16:10:52 -0500, Moosmann, James [EMAIL PROTECTED] wrote: The following line produces and error in DBI excuting with either a do or a prepare, execute my $statement = SELECT \Rows inserted\ + @rows ); # ODBC error my $statement2 = SELECT 'Rows inserted' + @rows ); # works

RE: Double quotes in select statement throw an error

2005-01-19 Thread Jeff Urlwin
) to the ODBC driver, which is complaining. Regards, Jeff Thanks anyway. Question answered. James -Original Message- From: JupiterHost.Net [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 18, 2005 6:49 PM To: dbi-users@perl.org Subject: Re: Double quotes in select

RE: Double quotes in select statement throw an error

2005-01-19 Thread Moosmann, James
Thank you everyone who responded and to Tim and Jeff: The reason the server generates an error is because there are 2 flags which can be set when you create the DSN: Use ANSI quoted identifiers Use ANSI null, padding and warning And they were both selected. De-selecting Use ANSI null,

RE: Double quotes in select statement throw an error

2005-01-19 Thread Jeff Urlwin
Thank you everyone who responded and to Tim and Jeff: The reason the server generates an error is because there are 2 flags which can be set when you create the DSN: Use ANSI quoted identifiers Use ANSI null, padding and warning And they were both selected. De-selecting Use

RE: Double quotes in select statement throw an error

2005-01-19 Thread amonotod
From: Moosmann, James [EMAIL PROTECTED] Date: 2005/01/19 Wed AM 08:24:12 CST Does anyone know how to check/set this attribute using DBI so I don't have to instruct a user on changing his DSN? ( I don't see this option mentioned in DBD::ODBC ) Might I suggest using DSN-less connections, so

Double quotes in select statement throw an error

2005-01-18 Thread Moosmann, James
The following line produces and error in DBI excuting with either a do or a prepare, execute my $statement = SELECT \Rows inserted\ + @rows ); # ODBC error my $statement2 = SELECT 'Rows inserted' + @rows ); # works $dbh-do( $statement ); or $sth-prepare( $statement ); $sth-execute(); DBI:

Re: Double quotes in select statement throw an error

2005-01-18 Thread David Goodman
Use DBI's quote: my $statement = dbh-quote(SELECT \Rows inserted\ + @rows); regards, David --- Moosmann, James [EMAIL PROTECTED] wrote: The following line produces and error in DBI excuting with either a do or a prepare, execute my $statement = SELECT \Rows inserted\ + @rows ); # ODBC

RE: Double quotes in select statement throw an error

2005-01-18 Thread Ronald J Kimball
David Goodman [mailto:[EMAIL PROTECTED] wrote: Use DBI's quote: my $statement = dbh-quote(SELECT \Rows inserted\ + @rows); This is not at all how quote() is meant to be used. quote() is for quoting a single value for interpolation, not an entire SQL statement. For example: my $date =

RE: Double quotes in select statement throw an error

2005-01-18 Thread Rutherdale, Will
sound like it would be valid syntax in any flavour of SQL. Maybe you need to review SQL basics first. -Will -Original Message- From: Moosmann, James [mailto:[EMAIL PROTECTED] Sent: Tuesday 18 January 2005 18:35 To: 'David Goodman' Cc: dbi-users@perl.org Subject: RE: Double quotes in select

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: Nope, same results, Here is a simple example: Is the syntax invalid? use DBI; my $dbh = DBI-connect('dbi:ODBC:somedb','',''); my $qs = $dbh-quote( SELECT \Rows returned: \ ); Why are you quoting the entire query as a string? $dbh-do($qs); Use a valid query: $dbh-do(SELECT

RE: Double quotes in select statement throw an error

2005-01-18 Thread Moosmann, James
: Tuesday, January 18, 2005 6:49 PM To: dbi-users@perl.org Subject: Re: Double quotes in select statement throw an error Moosmann, James wrote: Nope, same results, Here is a simple example: Is the syntax invalid? use DBI; my $dbh = DBI-connect('dbi:ODBC:somedb','',''); my $qs = $dbh-quote

Re: Double quotes in select statement throw an error

2005-01-18 Thread JupiterHost.Net
Moosmann, James wrote: Lee, Hello, The select statement is very valid and so is: SELECT 'Hello World!' as 'My first SQL Statement' -or- SELECT answer = 2+3 Really, try it. ok, but if you $dbh-quote() it, it becomes something like: 'SELECT \'Hello World!\' as \'My first SQL Statement\''