Mark Lawrence wrote:
On Wed Mar 12, 2008 at 12:30:14PM +0000, Matt Lawrence wrote:
Mark Lawrence wrote:
You don't deal with binary (non-printable) data. Assuming this is method
is for debugging purposes its usefulness is limited to pure text and
won't work for mixed text/binary queries.
Specifying the data type for the bind columns should allow the driver to properly escape binary data where appropriate, albeit non-automatically.

Yes, the escaping would make the data safe/suitable for the database,
but that won't change the effects that binary data has on terminals.

AFAIK, escaping for the database will also make the data printable. Perhaps this is not true for every driver, though.

I guess I could add a failsafe to trap unprintable values still present after quote() and replace them with dummy values as in your previous example.

   # Store quoted versions of the values
   my @bind_vals = map {
       $_ = $storage->dbh->quote($_->[1], shift @$datatypes);
       $_ = $storage->dbh->quote('*BINARY DATA*') if /[^[:print:]\n\t]/;
       $_;
   } @$bind;


You don't need to care about newlines or tabs (in fact if you
specifically search for that you might not find what you are looking
for), you just want to know if it contains non-printable data:

   $_ = $storage->dbh->quote('*BINARY DATA*') if /[^[:print:]]/;

Newlines and tabs won't mess up terminals and they are not matched by [:print:].

Matt


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to