On Sun, 28 Dec 2003, Terrence Brannon wrote:
> running the below program show that table names are quoted automatically
> under MySQL-4.016 and DBD::mysql 2.9003.
> This wasn't happening about 2 weeks ago when I ran the entire test suite
> and it passed.
>
Intersting the quoting has been in there since 2.9002 -- I don't think
that anything changed wrt quoting in 2.9002.
> needless to say, this is causing some problems with the MySQL part of
> the test suite, when checking that all tables that were
> supposed to be created were created. We can code around it in the test
> suite, but it would be nice to have some way of turning
> off this feature.
DBD::mysql does not do the quoting itself. The quoting is a feature of the
DBI; Quoting the DBI docs:
If "$dbh->get_info(29)" returns true (29 is SQL_IDENTI-
FIER_QUOTE_CHAR) then the table names are constructed and
quoted by
"quote_identifier" to ensure they are usable even if they
contain
whitespace or reserved words etc
Versions of DBD::mysql < 2.9002 did not implement get_info(), so when DBI
went looking for the quote char, it did not get anything back, and
therefore, did not quote the table names.
I can't think of an easy way to turn the quoting off from DBD::mysql other
than making $dbh->get_info(29) return undef, but that would affect all
calls to get_info and possibly break applications that require the table
names to be quoted :(
> use DBI;
>
> my $dbh = DBI->connect('dbi:mysql:test') or die $!;
>
> warn $dbh->tables;
> warn $DBD::mysql::VERSION;
>
> ~/hacks/dbirs/eg $ perl small.pl
> `dbix_rs5``dbix_rs6``dbixrs1``dbixrs2``dbixrs3``dbixrs4``dbixrsdel``dbixseq`
> at small.pl line 5.
> 2.9003 at small.pl line 6.
> ~/hacks/dbirs/eg $
I must admit that I have not used DBIx::Recordset before, and I have just
done a cursory scanning of the docs, so please forgive anthing that I may
have overlooked.
That being said, how does DBIx::Recordset handle a search with a !Table
like, "This is a"" del!mited \Itdentifier as &^% a table 'na`me'."? or
maybe a table named "select"? Does the end-user have to use
$dbh->quote_indentifier() first?
Rudy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]