Skip Menu |

This queue is for tickets about the DBD-Sybase CPAN distribution.

Report information
The Basics
Id: 83098
Status: resolved
Priority: 0/
Queue: DBD-Sybase

People
Owner: mpeppler [...] peppler.org
Requestors: DDICK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.14
Fixed in: (no value)



Subject: PATCH: Allowing long and/or starting with digit database names in connection strings
When using GUIDs as a database name in the dsn, such as dbi:Sybase:server=Server1;database=16AAF692-6B8E-11E2-8218-FBAC17BD48DC DBD::Sybase truncates the database name by one character and does not surround the database name in the use statement with double quotes, leading to a syntax error. This patch corrects these errors.
Subject: dbd_sybase_use.patch
diff -Naur old/dbdimp.c new/dbdimp.c --- old/dbdimp.c 2011-10-03 01:56:17.000000000 +1100 +++ new/dbdimp.c 2013-02-02 12:33:17.678856093 +1100 @@ -1124,7 +1124,7 @@ if (strchr(dsn, '=')) { extractFromDsn("server=", dsn, imp_dbh->server, 64); extractFromDsn("charset=", dsn, imp_dbh->charset, 64); - extractFromDsn("database=", dsn, imp_dbh->database, 36); + extractFromDsn("database=", dsn, imp_dbh->database, 64); extractFromDsn("packetSize=", dsn, imp_dbh->packetSize, 64); extractFromDsn("language=", dsn, imp_dbh->language, 64); extractFromDsn("interfaces=", dsn, imp_dbh->ifile, 255); @@ -1598,7 +1598,7 @@ else db = imp_dbh->database; - sprintf(statement, "use %s", db); + sprintf(statement, "use \"%s\"", db); if (DBIc_DBISTATE(imp_dbh)->debug >= 3) PerlIO_printf(DBIc_LOGPIO(imp_dbh),
Thanks. However, using double quotes for the 'use <db>' only works if "quoted_identifier" is enabled. By default this is not the case on Sybase. Using square brackets ([]) works, though. Michael
On Sat Feb 02 02:15:29 2013, MEWP wrote: Show quoted text
> Thanks. > > However, using double quotes for the 'use <db>' only works if > "quoted_identifier" is enabled. By default this is not the case on Sybase. > > Using square brackets ([]) works, though. > > Michael
fair point. fixed up patch attached.
Subject: dbd_sybase_use.patch
diff -Naur old/dbdimp.c new/dbdimp.c --- old/dbdimp.c 2011-10-03 01:56:17.000000000 +1100 +++ new/dbdimp.c 2013-02-02 12:33:17.678856093 +1100 @@ -1124,7 +1124,7 @@ if (strchr(dsn, '=')) { extractFromDsn("server=", dsn, imp_dbh->server, 64); extractFromDsn("charset=", dsn, imp_dbh->charset, 64); - extractFromDsn("database=", dsn, imp_dbh->database, 36); + extractFromDsn("database=", dsn, imp_dbh->database, 64); extractFromDsn("packetSize=", dsn, imp_dbh->packetSize, 64); extractFromDsn("language=", dsn, imp_dbh->language, 64); extractFromDsn("interfaces=", dsn, imp_dbh->ifile, 255); @@ -1598,7 +1598,7 @@ else db = imp_dbh->database; - sprintf(statement, "use %s", db); + sprintf(statement, "use [%s]", db); if (DBIc_DBISTATE(imp_dbh)->debug >= 3) PerlIO_printf(DBIc_LOGPIO(imp_dbh),
On Sat Mar 30 04:57:57 2013, DDICK wrote: Show quoted text
> On Sat Feb 02 02:15:29 2013, MEWP wrote:
> > Thanks. > > > > However, using double quotes for the 'use <db>' only works if > > "quoted_identifier" is enabled. By default this is not the case on Sybase. > > > > Using square brackets ([]) works, though. > > > > Michael
> > fair point. fixed up patch attached.
Thanks. Applied.
Applied in 1.15, released.