大佬教程收集整理的这篇文章主要介绍了如何在带引号的占位符中使用查询? (perl / postgresql),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
#!/usr/bin/perl -w use Strict; use DBI; my $db = "Pg"; my $db_database = "whatever"; my $user = "whatever"; my $password = "whatever"; my $dbh = DBI->connect("dbi:$db:dbname=$db_database",$user,$password); my $query = $dbh->prepare (q{SELECT arrival_date - INTERVAL '? minutE' FROM emails LIMIT 1}) or die ("unable to prepare"); $query->execute(60) or die("unable to execute"); print $query->fetchrow_array,"\n";
(arrival_date具有以下格式:带时区的时间戳NOT NULL默认CURRENT_TIMESTAMP)
问题是没有检测到问号占位符,因为它的内部单引号:
DBD::Pg::st execute failed: called with 1 bind variables when 0 are needed
如果我使用qq {},$1占位符,并使用$dbh-> quote尝试了一些变体,它无济于事.我怎样才能做到这一点?
以上是大佬教程为你收集整理的如何在带引号的占位符中使用查询? (perl / postgresql)全部内容,希望文章能够帮你解决如何在带引号的占位符中使用查询? (perl / postgresql)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。