嗨,我在我的 C++ 代码中使用 tntdb 类时遇到问题,只有整数值 atr 在数据库中更新,而字符串值作为垃圾值更新,我在下面给出我的代码,请帮助我解决这个问题
#include <tntdb/connection.h>
#include <tntdb/connect.h>
#include <stdio.h>
#include <string>
#include <sys/shm.h>
using namespace std;
int main()
{
string s="create table test2(T1 int not null primary key,NAME varchar(20),STATUS varchar(20));";
try{
tntdb::Connection conn;
conn = tntdb::connect("sqlite:/home/gaian/Desktop/test.db");
string k="abc";
conn.execute(s);
tntdb::Statement st = conn.prepare("insert into test2(T1,NAME,STATUS) values (:T1, :NAME,:STATUS)");
st.set("T1",10)
.set("NAME",k)
.set("STATUS","bye")
.execute();
}
catch(const std::exception& e){
printf("error is %s\n",e.what());
}
return 0;
}