Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: DBI:Sybase - Period in database name

by runrig (Abbot)
on Feb 23, 2013 at 00:27 UTC ( #1020257=note: print w/ replies, xml ) Need Help??


in reply to DBI:Sybase - Period in database name

Try quote_identifier:

"quote_identifier" $sql = $dbh->quote_identifier( $name ); $sql = $dbh->quote_identifier( $catalog, $schema, $table, \%att +r ); Quote an identifier (table name etc.) for use in an SQL statement, by escaping any special characters (such as double quotation marks) it contains and adding the required type of outer quotation marks.
Update: Hmm, all that function seems to do for 'foo.table' is wrap double quotes around it...so if that doesn't work for you, then I don't know what else to do.

Another update: Aha (read other posts in this thread). Sybase quotes identifiers with brackets (e.g. "[column name with spaces]"), which suggests to me that quote_identifier should do the same, although there is also a DBD::Sybase attribute 'syb_quoted_identifier', which AFAICT is supposed to enable single quotes for quoting identifiers.


Comment on Re: DBI:Sybase - Period in database name
Select or Download Code
Re^2: DBI:Sybase - Period in database name
by apu (Novice) on Feb 23, 2013 at 02:13 UTC
      $DBNAME = $dbh->quote_identifier( $DBNAME );
      $dbh->do("use $DBNAME");
    
    results in
       DBD::Sybase::db do failed: Server message number=170
       severity=15 state=1 line=1 server=SQLSERVER
       text=Line 1: Incorrect syntax near 'ps_inventory.ad'.

    (I did throw some additional debugging in there temporarily and it is quoting the $DBNAME but DBD::Sybase is still throwing the error.)

      what does sybase manual say about quoting database names? about error (number 170) ?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020257]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-07-23 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (133 votes), past polls