2012-08-09 62 views
0

如何在運行時更改SQLITE_LIMIT_COMPOUND_SELECT。我需要知道如何使用該聲明更改SQLITE LIMIT COMPOUND SELECT

int sqlite3_limit(sqlite3*, int id, int newVal); 
+0

[documentation](http://www.sqlite.org/c3ref/limit.html)對我來說似乎很清楚。你嘗試了什麼,當你嘗試時發生了什麼? – 2012-08-09 13:06:37

回答

0

我看到你的問題被標記爲iPhone,儘管在你的問題中沒有任何提及。在Objective-C中,您可以這樣做:

#import <sqlite3.h> 

... 

NSString *pathToDatabase = @"Path to database file"; 
NSInteger limitAmount = 10; // or whatever number you want 
sqlite3 *database; 
if(sqlite3_open([pathToDatabase UTF8String], &database) != SQLITE_OK) 
{ 
    NSLog(@"Unable to connect to the database..."); 
} 
sqlite3_limit(database, SQLITE_LIMIT_COMPOUND_SELECT, limitAmount);