在iPhone模拟器中查看sqlite3数据库
我已经在我的iPhone应用程序中以编程方式在Xcode 4中创建了数据库。我还插入到数据库中,并从中选择所需的值。一切似乎都很好,但我想检查值是否被复制。我无法在Xcode中打开数据库文件,那么有没有办法打开数据库并检查其中的值?我建议使用适用于Mozilla Firefox的SQLite插件在iPhone模拟器中查看sqlite3数据库,iphone,ios,xcode4,sqlite,Iphone,Ios,Xcode4,Sqlite,我已经在我的iPhone应用程序中以编程方式在Xcode 4中创建了数据库。我还插入到数据库中,并从中选择所需的值。一切似乎都很好,但我想检查值是否被复制。我无法在Xcode中打开数据库文件,那么有没有办法打开数据库并检查其中的值?我建议使用适用于Mozilla Firefox的SQLite插件 我可以建议在Mozilla Firefox上使用SQLite插件 有两种方法可以做到这一点:- 1) 对Firefox浏览器使用SQLite管理器,然后使用工具-->SQLite管理器-->打开数据库
我可以建议在Mozilla Firefox上使用SQLite插件
有两种方法可以做到这一点:- 1) 对Firefox浏览器使用SQLite管理器,然后使用工具-->SQLite管理器-->打开数据库 现在可以运行查询了 从tablename中选择*; 现在可以手动检查重复的值 链接以安装SQLite管理器 2) 如果要通过数据库检查重复的值
-(NSMutableArray *) readFromDatabase:(NSString *)query{
// Setup the database object
sqlite3 *database;
// Init the animals Array
MutableArray = [[NSMutableArray alloc] init];
NSString *readCommand=query;
//readCommand=[readCommand stringByAppendingFormat:@"%@';",patientID];
// Open the database from the users filessytem
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
// Setup the SQL Statement and compile it for faster access
const char *sqlStatement = [readCommand UTF8String];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
// Loop through the results and add them to the feeds array
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
// Read the data from the result row
[MutableArray addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)]];
}
}
// Release the compiled statement from memory
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
return MutableArray;
}
调用这个函数。并检查返回的数组值。有两种方法:- 1) 对Firefox浏览器使用SQLite管理器,然后使用工具-->SQLite管理器-->打开数据库 现在可以运行查询了 从tablename中选择*; 现在可以手动检查重复的值 链接以安装SQLite管理器 2) 如果要通过数据库检查重复的值
-(NSMutableArray *) readFromDatabase:(NSString *)query{
// Setup the database object
sqlite3 *database;
// Init the animals Array
MutableArray = [[NSMutableArray alloc] init];
NSString *readCommand=query;
//readCommand=[readCommand stringByAppendingFormat:@"%@';",patientID];
// Open the database from the users filessytem
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
// Setup the SQL Statement and compile it for faster access
const char *sqlStatement = [readCommand UTF8String];
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
// Loop through the results and add them to the feeds array
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
// Read the data from the result row
[MutableArray addObject:[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)]];
}
}
// Release the compiled statement from memory
sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);
return MutableArray;
}
调用这个函数。然后检查返回的数组值。好吧,现在我找到了一篇很棒的帖子——好吧,现在我找到了一篇很棒的帖子-