Perl DBI without accessing the database

前端 未结 6 1997
悲哀的现实
悲哀的现实 2021-01-18 16:08

I\'m creating a set of SQL INSERT statements for a database that doesn\'t exist yet, and I\'m saving them to file.

How can I use Perl\'s powerful DBI m

6条回答
  •  不思量自难忘°
    2021-01-18 16:52

    From DBI::quote:

    For most database types, at least those that conform to SQL standards, quote would return 'Don''t' (including the outer quotation marks). For others it may return something like 'Don\'t'

    That is, the behavior of DBI::quote varies from database to database, and it doesn't make sense to call it in a database-independent way.

    Make a trivial connection to a database of the same type you are writing for, or learn your database's quoting conventions and implement a quote method yourself. See the DBI source for a reference implementation.

提交回复
热议问题