Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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 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.

Replies are listed 'Best First'.
Re^2: DBI:Sybase - Period in database name
by apu (Sexton) 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 ''.

    (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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020257]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-04-27 02:01 GMT
Find Nodes?
    Voting Booth?