c++ - 如何将 wxTreeItemId 绑定为 sqlite3 数据库中的数据类型?
问题描述
我想让列wxTreeItemId
作为值插入,我在sqlite中看到了这个数据类型BLOB
,它接受数据,但我不确定什么sqlite3_bind_blob()
作为参数,我有一个函数将列更新wxTreeItemId
为,
{
try
{
rc = sqlite3_open("Samples.db", &DB);
std::string select = "UPDATE SAMPLES SET FAVORITEFOLDER = ? WHERE FILENAME = ?;";
rc = sqlite3_prepare_v2(DB, select.c_str(), select.size(), &stmt, NULL);
----> rc = sqlite3_bind_blob(sqlite3_stmt *, int, const void *, int n, void (*)(void *))
rc = sqlite3_bind_text(stmt, 2, Filename.c_str(), Filename.size(), SQLITE_STATIC);
if (sqlite3_step(stmt) == SQLITE_ROW)
{
wxLogDebug("Record found, updating..");
}
rc = sqlite3_finalize(stmt);
if (rc != SQLITE_OK)
{
msgDialog = new wxMessageDialog(NULL, "Error! Cannot update record.", "Error", wxOK | wxICON_ERROR);
msgDialog->ShowModal();
sqlite3_free(ErrorMessage);
}
else
{
wxLogDebug("Updated record successfully.");
}
sqlite3_close(DB);
}
catch (const std::exception &exception)
{
wxLogDebug(exception.what());
}
}
我想知道这些参数的期望是什么?
解决方案
wxTreeItemId
内部基本上是一个指针,因此将其存储在数据库中是没有意义的。如果您需要保存对树项的引用,您需要使用它的路径,例如它在其兄弟之间的位置序列或类似的东西。
推荐阅读
- javascript - 如何在一个文件中引用一个变量,并能够跨多个文件使用?
- ruby-on-rails - ruby on rails 应用程序中的代理字符()以问号格式(?)保存到 oracle 数据库
- kubernetes - kubernetes can not join workers centos 7
- swagger - Swagger 排序模式定义
- sql - SQL Server 从两个日期开始工作(不包括星期六和星期日)按月和年分组
- java - 尝试使用动态 jasper 5.1.2 和 struts 2 生成 xls 报告,但我的操作类有一些问题,但无法弄清楚
- php - 在 Symfony 应用程序中处理 Slack(事件 API)事件
- jenkins - 将构建历史从一个作业复制到另一个作业
- sql - SQL:获取一组日期对之间的所有日期
- tensorflow - 如何在 Keras Application VGG19 网络中获取 pre relu 层?