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
) 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
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,
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
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
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:
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
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 =
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
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
: 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
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\''
12 matches
Mail list logo