sqlite´¥·¢Æ÷Ò»Àý
int column_names_printed = 0;
void print_row(int n_values, char** values)
{
int i;
for (i = 0; i < n_values; ++i) {
printf("%10s", values[i]);
}
printf("\n");
}
int print_result(void* data, int n_columns, char** column_values, char** column_names)
{
if (!column_names_printed) {
print_row(n_columns, column_names);
column_names_printed = 1;
}
print_row(n_columns, column_values);
return 0;
}
int sqlite()
{
sqlite3 *db=NULL;
char *errMsg = NULL;
int rc;
rc = sqlite3_open("test.db", &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
else printf("open test.db successfully!\n");
rc = sqlite3_exec(db, "BEGIN TRANSACTION;", NULL, NULL, NULL);
rc = sqlite3_exec(db, "CREATE TABLE students(number varchar(10), name varchar(10), \
sex varchar(6), age varchar(2));", NULL, NULL, NULL);
rc = sqlite3_exec(db, "INSERT INTO students VALUES('00001', 'Mary', 'female', '15');\
&
Ïà¹ØÎĵµ£º
Õª Òª: Óë³£¼ûµÄÊý¾Ý¿âÏà±È£¬Ç¶Èëʽ
Êý
¾Ý¿â¾ßÓÐÌå»ýС¡¢¹¦ÄÜÆ뱸¡¢¿ÉÒÆÖ²ÐÔ¡¢½¡×³ÐÔµÈÌص㣬±¾ÎÄ·ÖÎöºÍ±È½ÏÁ˵äÐ͵ÄǶÈëʽÊý¾Ý¿âSQLiteºÍBerkeley DB¡£Ê×ÏÈ´ÓÌåϵ½á¹¹¡¢×Óϵͳ
¼äµ÷ÓùØϵ¡¢ÈÎÎñÖ´Ðйý³ÌµÈ½Ç¶È¶ÔSQLiteºÍBerkeley DB½øÐÐÁËÏêϸ·ÖÎö£¬È»ºóÖصã´ÓÊý¾ÝÀàÐÍ¡¢´æ´¢·½Ê½¡¢Ä£Ê½¡¢Êý¾Ý¿âÒýÇ ......
1 TOP
ÕâÊÇÒ»¸ö´ó¼Ò¾³£Îʵ½µÄÎÊÌ⣬ÀýÈçÔÚSQLSERVERÖпÉÒÔʹÓÃÈçÏÂÓï¾äÀ´È¡µÃ¼Ç¼¼¯ÖеÄÇ°Ê®Ìõ¼Ç¼£º
SELECT TOP 10 * from [index] ORDER BY indexid DESC;
µ«ÊÇÕâÌõSQLÓï¾äÔÚSQLiteÖÐÊÇÎÞ·¨Ö´Ðеģ¬Ó¦¸Ã¸ÄΪ£º
SELECT * from [index] ORDER BY indexid DESC limit 0,10;
ÆäÖÐlimit 0,10±íʾ´ÓµÚ0Ìõ¼Ç¼¿ªÊ¼£¬Íùºó ......
ÔÚSQLite on BlackBerryÉÏ£¬JDBC·ÃÎÊÊý¾Ý¿â£¬È±Ê¡ÊÇÒÔUTF-8±£´æÊý¾Ýµ½Êý¾Ý¿âÀïÃæµÄ£¬Ã¿¸öÖÐÎÄͨ³£ÊÇ3¸ö×Ö½Ú±£´æµ½Êý¾Ý¿âÉÏÃæµÄ¡£
Àý×Ó´úÂë²Î¿¼£º
BlackBerry sample - SQLiteDemo¡£
×¢Ò⣺ÔÚ²åÈëÖÐÎĵÄʱºò£¬ÇëʹÓÃStatement.bindÖ¸ÁÔÚÎҵIJâÊÔÖУ¬¿ÉÒԺܺõı£´æÖÐÎÄÊý¾Ý¡£¶ÁÈ¡µÄʱºòÖ»ÐèҪʹÓÃResult ......
ÎÒÏÖÔÚҪʹÓÃSQLite3.0´´½¨Ò»¸öÊý¾Ý¿â£¬È»ºóÔÚÊý¾Ý¿âÖд´½¨Ò»¸ö±í¸ñ¡£
Ê×ÏÈÒªÒýÈëSQLite3.0µÄlib¿â¡£È»ºó°üº¬Í·Îļþ#import <sqlite3.h>
¡¾1¡¿´ò¿ªÊý¾Ý¿â£¬Èç¹ûûÓУ¬ÄÇô´´½¨Ò»¸ö
sqlite3* database_;
-(BOOL) open{
NSArray *paths = NSSearchPathForDirectoriesInDomai ......
ÎÄÕ·ÖÀà:Êý¾Ý¿â
SQLiteÔÚVCϵÄʹÓã¨×ª£©http://www.sqlite.com.cn/MySqlite/4/523.Html
Ò»¡¢SQLite¼ò½é
SQLite
ÊÇÓÃCÓïÑÔ±àдµÄ¿ªÔ´Êý¾Ý¿â£¬Ö÷ÒªÓÃÓÚǶÈëʽ£¬ÄãÒ²¿ÉÒÔ°ÑËü¼¯³ÉÔÚ×Ô¼ºµÄ×ÀÃæ³ÌÐòÖУ¬Ò²ÓÐÈ˽«ÆäÌæ´úAccess£¬ÓÃ×÷ºǫ́Êý¾Ý¿â¡£
SQLite Ö§³Ö¶àÊýSQL92 ......