PQescapeLiteral没有定义?
这是我能想到的最基本的libpq示例来说明我的问题。这里的目标是打印出转义字符串。
#include <iostream>
#include <libpq-fe.h>
#include <string.h>
using namespace std;
int main(){
PGconn *db;
char connstring[] = "dbname=TheInternet";
db = PQconnectdb(connstring);
char url[] = "http://www.goo'gle.com/";
cout<<PQescapeLiteral(db, (const char *)url, (size_t) strlen(url))<<"n";
}
当我编译时:
g++ PQescapeLiteral_test.cpp -lpq
甚至是:
g++ PQescapeLiteral.cpp -I/usr/include/pgsql:/usr/include/pgsql/server:/usr/include/pgsql/server/libpq -lpq
我收到错误:
PQescapeLiteral.cpp: In function ‘int main()’:
PQescapeLiteral.cpp:12: error: ‘PQescapeLiteral’ was not declared in this scope
我在第31.3.4节的pgsql 9.0手册中找到了PQescapeLiteral:在SQL命令中包含了包含的字符串。我从yum获得了最新版本的libpq和libpq-devel,所以我很确定它应该被定义。
如果有人能指出我正确的方向,我会很感激。
没有找到相关结果
已邀请:
1 个回复
细屠截殴些