* para,
int nColumn,
char** colValue,
char**
colName)
{
sqlite3*
db;
char*
errmsg;
int nResult = sqlite3_open("MSG.db", &
db);
if (nResult !=
SQLITE_OK)
{
MessageBoxA(NULL, "数据库MSG.db打开失败"
, NULL, NULL);
return -1
;
}
for (
int i = 0; i < 1; i++
) {
int length = atoi(colValue[11
]);
unsigned char* pData =
new unsigned
char[length]();
//pData = (unsigned char*)colValue[10];
memcpy(pData, colValue[10
], length);
unsigned char c;
char buf[3
];
std::string result = ""
;
for (
int i = 0;i < length; i++
)
{
sprintf(buf, "%x"
, pData[i]);
result +=
buf;
}
char sql[3000] = { 0
};
sprintf_s(sql, "insert or ignore into MSG VALUES (%s, %s, %s, %s, %s, %s, %s, %s, ‘%s‘, ‘%s‘, X‘%s‘);", colValue[0], colValue[1], colValue[2], colValue[3], colValue[4], colValue[5], colValue[6], colValue[7], colValue[8], colValue[9
], result.c_str());
sqlite3_exec(db, sql, NULL, NULL, &
errmsg);
}
sqlite3_close(db);
Sleep(20
);
return 0
;
}
VOID getData(sqlite3*
db) {
char sql[1000] = { 0
};
sprintf_s(sql, "select a, b, c, d, e, f, g, h, i, j, k from MSG"
);
char* sqlErrmsg =
NULL;
sqlite3_exec(db, sql, getDataCallBack, NULL, &
sqlErrmsg);
}
sqlite3_exec读取blob数据
标签:str values memcpy get 数据库 sage sleep from blob