我正在尝试从 SQLite 中的表中获取行:
_tempPath = [[NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES)
objectAtIndex:0] stringByAppendingPathComponent:@"test.db"];
sqlite3 *pHandle;
sqlite3_stmt *pStatementHandle;
NSLog(@"OPEN: %i ", sqlite3_open([_tempPath UTF8String], &pHandle));
const char *query = "select * from Transactions";
NSLog(@"PREP: %i", sqlite3_prepare (pHandle, query, -1, &pStatementHandle, NULL));
while(sqlite3_step(pStatementHandle) != SQLITE_DONE);
{
NSLog(@"ROW");
}
sqlite3_finalize(pStatementHandle);
sqlite3_close(pHandle);
但是,我总是得到一个空行。表是空的还是满的都无关紧要。
open() 和 prepare() 命令返回 SQLITE_OK。
出了什么问题?