postgresql – libpq,带参数插入
发布时间:2020-12-13 15:56:16 所属栏目:百科 来源:网络整理
导读:我想知道我是否可以使用libpq直接从C/C++进行参数化查询,而不是使用字符串,如果这样的代码看起来怎么样? string tblins = "";tblins = "INSERT INTO " + commtable + " " "(vdoc,bdoc,mytime,txml) VALUES (" "'" + cxml.vdoc + "'," + cxml.bdoc + "," //i
我想知道我是否可以使用libpq直接从C/C++进行参数化查询,而不是使用字符串,如果这样的代码看起来怎么样?
string tblins = ""; tblins = "INSERT INTO " + commtable + " " "(vdoc,bdoc,mytime,txml) VALUES (" "'" + cxml.vdoc + "'," + cxml.bdoc + "," //integer "'" + cxml.mytime + "'," "'" + cxml.txml + "')"; result = PQexec(conn,tblins.c_str()); 谢谢. 解决方法
是的,您可以使用PQexecParams函数,如
in the documentation所述.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |