【发布时间】:2017-01-26 21:14:06
【问题描述】:
我使用libpqxx 连接到 C++ 中的 PostgreSQL 数据库。我想加密一列表并将其替换为当前列。我这样写:
int num;
cout << "Select Your COLUMN Number For Encryption: ";
cin >> num;
/* Create SQL statement */
sql = "SELECT * from " + tbName;
/* Execute SQL query */
result R3( N.exec( sql ));
/* List down all the records */
for (result::const_iterator c = R3.begin(); c != R3.end(); ++c) {
c[num].as<string>() = encnum->encryptionData(3,5,c[num].as<int>());
cout << "Encryption = " << c[num].as<string>() << endl;
}
但结果和加密前一样。我怎么了?如何将值替换为列中的其他值?
【问题讨论】:
-
如果您尝试更新表列,那么您应该执行update 语句。
-
你能告诉我吗?我尝试使用更新来获取一个值,但我想更新整个列。 @karastojko
-
你试过有更新语句的Brief example吗?
-
那么,当我想加密 ID 列时怎么样?@karastojko
标签: c++ database postgresql libpqxx