¹ØÓÚsqliteÖ´ÐÐʱ¼äµÄÒÉÎÊ£¿
Êý¾Ý¿âÖÐÓÐÒ»¸öusers±í¡£
create table users(name text, number text);
Ñ»·²åÈëÒ»°ÙÌõ£¬²»Ê¹ÓÃÊÂÎñµÄ»°£¬ÔÚÎҵĻúÆ÷ÉÏÐèÒª6s¡£
¶øÔÚÎÒÅóÓѵĻúÆ÷ÉÏÕâÑùµÄ²Ù×÷»¨·Ñ²»µ½1s¡£
¿ÉÄÜÊÇÄÄ·½ÃæµÄÔÒòµ¼ÖÂÕâÑùµÄ²îÒ죿
ϵͳµÄ²»Í¬£¬sqlite°æ±¾µÄ²»Í¬»òÊDZàÒëÆ÷µÄ²»Í¬£¿
C/C++ code:
sqlite3* pHandle = 0;
int nOpenRet = sqlite3_open("/home/test.db", &pHandle);
//ouput_time();
int i = 0;
char sExec[256] = {0};
snprintf(sExec, 255, "insert into users values('user', '1');");
char* pErrMsg=0;
for (; i < 100; i++)
{
if (sqlite3_exec(pHandle,sExec, 0, 0, &pErrMsg)!= 0)
{
printf("sqlite execute fail, i=%d\n", i);
return 0;
}
}
ллÄãµÄ»Ø¸´¡£
ÎÒÅóÓѵĻúÆ÷ͬÎÒµÄÅäÖö¼Ò»Ä£Ò»Ñù£¬ËùÒÔ¿ÉÒÔÅųýÕâÀàÎÊÌâ¡£
ÎÒÔÚÆäËûÁ½Ì¨»úÆ÷ÉÏÔËÐйý,һ̨ϵͳºÍÎÒµÄÒ»Ñù¶¼ÊÇubuntu.²»¹ý±àÒëÆ÷ÓõIJ»Í¬,
ËûÊÇʹÓÃemacs.
Ö»ÊǾõµÃ±àÒëÆ÷Ôì³ÉÕâÑùµÄ²îÒìÊDz»ÊÇÓÐЩ¿äÕÅ?
ÕÒµ½ÔÒòÁË,ºÍϵͳµÄÎļþϵͳ¸ñʽ²îÒìÓйØ.
ÔÚext3 ºÍext4ÉϵIJ»Í¬.
лл¸÷λ»ØÌû
Ïà¹ØÎÊ´ð£º
СµÜ Ūµã¶«Î÷¿ÉÊǵ÷Óà sqlite3_prepare Õâ¸öº¯Êý select ¾ÍºÃʹ Ö»Òª ¸Ä±äÊý¾Ý¿â µÄ¾Í²»ÐÐ ±ÈÈçinsert Ö®ÀàµÄ ËÀ´°ï¸öæ°¡ ÇëÎÊÕâÊÇʲôÔÒò °¡ Óà c ȥʵÏÖµÄ
ÄãÓõÄʲô¹¤¾ß°¡?
°ÑÄã×Ô¼ºµÄ´úÂë·¢ ......
sqlite ÖÐ
CREATE TABLE table1 (
id integer primary key autoincrement,
name text default '',
[index] integer default ROWID
)
ÓÐûÓÐÀàËƵŦÄÜ£¬Èà index µÄֵĬÈϵÈÓÚid£¬ ......
ΪʲôÓÃselect name,distinct phone from phone_book¾Í˵Óï·¨´íÎó£¬
ÓÃselect distinct phone,name from phone_book¾Í¿ÉÒÔ£¿
ûÓÐΪʲô distinct ÊÇ select µÄÐÞÊηû£¬Ö»ÄÜÔÚ select ºóÖ ......
GUID£º0C3EDEE8-B14F-4220-8D64-990E00D84AF7
SELECT fldGuid, fldName, fldUserGuid from table
Äܲéѯ fldUserGuid Ϊ£º0C3EDEE8-B14F-4220-8D64-990E00D84AF7 µÄÊý¾ÝÒ»Ìõ
SELECT fldGuid, fldN ......
ÓÃevc±àдӦÓóÌÐò£¬¿ª·¢Êý¾Ý¿â¹ÜÀíϵͳ¡£ÉèÖÃencodingΪUTF-8£¬Äܹ»²åÈëÖÐÎÄÊý¾Ý£¬ÓÃSQLite Expert Personal¿´Êý¾Ý¿â£¬ÖÐÎÄÕý³£¡£±ðµÄ³ÌÐò²éѯÊý¾Ý¿â£¬²¢ÏÔʾÓÚEDIT¿Ø¼þÖУ¬Õý³£¡£µ«ÊÇʹÓÃlist control ¿Ø¼ ......