本文整理汇总了C++中db::Result::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ Result::getString方法的具体用法?C++ Result::getString怎么用?C++ Result::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db::Result
的用法示例。
在下文中一共展示了Result::getString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: can_update_text_attribute_bound_value
void test_a_db_with_a_connection_with_tables::can_update_text_attribute_bound_value()
{
can_insert_records();
// query all objects
DB::Statement statement = connection->prepare("select id from object");
CPPUNIT_ASSERT(statement.isValid());
DB::Result result = connection->perform(statement);
CPPUNIT_ASSERT(result.isValid());
long long object_id = result.getLongLong(1); // field indices start at 1
statement = connection->prepare(
"update attribute_text set value=? where type=%d and object_id=%lld",
1234,
object_id);
CPPUNIT_ASSERT(statement.isValid());
std::string msg("testing quote ' and accents é.");
CPPUNIT_ASSERT(DB::Bindings(statement).bindText(1,msg.c_str(),msg.size(),NULL));
CPPUNIT_ASSERT(connection->execute(statement));
statement = connection->prepare(
"select value from attribute_text as t where t.type=%d and t.object_id=%lld",
1234,
object_id);
result = connection->perform(statement);
CPPUNIT_ASSERT_EQUAL(std::string(result.getString(1)), msg);
}
示例2: can_retrieve_records
void test_a_db_with_a_connection_with_tables::can_retrieve_records()
{
can_insert_records();
DB::Statement statement = connection->prepare(
"select value from attribute_text as t where t.type=%d",
1234);
DB::Result result = connection->perform(statement);
CPPUNIT_ASSERT_EQUAL(std::string(result.getString(1)), std::string("testing testing testing"));
}