DBD::CSV and placeholders

自作多情 提交于 2019-12-02 00:06:06

Placeholders can only be used where an expression is expected. What follows LIMIT must be a row count (not an expression), so it can't be a placeholder.

#!/usr/bin/perl
use warnings;
use strict;
use DBI qw( );

my $dbh = DBI->connect("DBI:CSV:", undef, undef, {
   PrintError => 0, RaiseError => 1,
} );

{
   my $sth = $dbh->prepare( "SELECT 1 LIMIT 1" );
   $sth->execute();
   $sth->finish();
   print "ok\n";
}

{
   my $sth = $dbh->prepare( "SELECT 1 LIMIT 0+1" );
   $sth->execute();
   $sth->finish();
   print "ok\n";
}

ok
DBD::CSV::db prepare failed: Bad limit clause! at .../SQL/Statement.pm line 88.
 [for Statement "SELECT 1 LIMIT 0+1"] at a.pl line 18.

According to documentation, placeholders can be use only for values.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!