Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlite ×Ö¶ÎĬÈÏÖµµÈÓÚidÖµ

sqlite ÖÐ
CREATE TABLE table1 (
id integer primary key autoincrement,
name text default '',
[index] integer default ROWID
)

ÓÐûÓÐÀàËƵŦÄÜ£¬Èà index µÄֵĬÈϵÈÓÚid£¬±ÈÈç
insert into table1 (id,name) values (null,'µÚÒ»ÐÐ');
insert into table1 (id,name) values (null,'µÚ¶þÐÐ');

ÎÒÏ£Íû½á¹ûÊÇ
id  name  index
1  µÚÒ»ÐÐ 1
2  µÚ¶þÐÐ 2

ÄÜʵÏÖÂð£¿

ÒýÓÃ
CREATE TABLE table1 (
id integer primary key autoincrement,
name text default '',
[index] integer 
)

trigger:
Begin Transaction;
Drop Trigger If Exists MAIN.[dd];
Create  Trigger MAIN.[dd] AFTER INSERT On [table1b] FOR EACH ROW
begin
update table1b set 'index'=id  where id=new.id    ;
end;
Commit Transaction;

insert into table1 (id,name) values (null,'µÚÒ»ÐÐ');
insert into table1 (id,name) values (null,'µÚ¶þÐÐ');


Ò»¶¨ÒªÓõ½´¥·¢Æ÷ºÍ´æ´¢¹ý³ÌÂ𣿲»ÄÜÖ±½ÓÉèÖóÉĬÈÏÖµÂð

ºÇºÇ£¬²»ÄÜ£¬²âÊÔÁËһϲ»ÐÐ

ÒýÓÃ
ºÇºÇ£¬²»ÄÜ£¬²âÊÔÁËһϲ»ÐÐ

àÅ£¬ÖªµÀÁË£¬¹ûÈ»ÊDz»ÐеÄ

²âÊÔ¿ÉÒÔÕâÑù £º
insert into table1c  values (null,'µÚÒ»ÐÐ',(select rowid from table1c));

ÒýÓÃ
ÒýÓà 3 Â¥ wwwwb µÄ»Ø¸´:
ºÇºÇ£¬²»ÄÜ£¬²âÊÔÁËһϲ»ÐÐ

àÅ£¬ÖªµÀÁË£¬¹ûÈ»ÊDz»ÐеÄ



Ïà¹ØÎÊ´ð£º

sqlite£¬updateµÄÎÊÌâ

ÎÒÏë×öÒ»¸ösqliteµÄ¼à¿ØÈí¼þ£¬ÊµÊ±ÖªµÀÓû§¶ÔÊý¾Ý±í¶¼×öÁËÄÄЩ²Ù×÷¡£

ÔÚÓû§update Ò»¸öÓû§Êý¾Ý±íֵʱ£¬ÎÒÈçºÎ¿ÉÒÔµÃÖªÓû§updateµÄÄĸö×ֶεÄÖµ£¿ÎÒ±¾À´¸øÓû§±íÌí¼Ó´¥·¢Æ÷À´ÊµÏֵģ¬µ«´¥·¢Æ÷ºÃÏñÖ»Äܵõ½Ó ......

ÊìϤSqliteµÄÇë½øÀ´£¡£¡£¡£¡£¡

´ó¼ÒºÃ£¡
  sqlite×Ö¶ÎΪfloatÐ͵ÄÖµÔõÑù·ÃÎÊ£¿
ÊÔ¹ýÓÃsqlite3_column_double£¬È··µ»ØµÄÊý¾Ý²»ÕýÈ·£»
ûÓùý,°ï¶¥.

Ò»Ñù°¡£¬·µ»ØÈ«ÊÇ string

ÄãµÄ´úÂëÊÇʲô£¿
double sqlite3_column_double(sqli ......

sqlite ¸ßÊÖ½øÀ´°¡

СµÜ Ūµã¶«Î÷¿ÉÊǵ÷Óà sqlite3_prepare Õâ¸öº¯Êý select ¾ÍºÃʹ Ö»Òª ¸Ä±äÊý¾Ý¿â µÄ¾Í²»ÐÐ ±ÈÈçinsert Ö®ÀàµÄ Ë­À´°ï¸öæ°¡ ÇëÎÊÕâÊÇʲôԭÒò °¡ Óà c ȥʵÏÖµÄ
ÄãÓõÄʲô¹¤¾ß°¡?
°ÑÄã×Ô¼ºµÄ´úÂë·¢ ......

sqliteÊý¾Ý¿â²éѯ±í¿¿Ç°

¸ÕÈëÃÅ ÏëʵÏÖÐÂÎűíÐÂÎÅÖö¥µÄ¹¦ÄÜ

select * from web_news  order by id desc limit 0,6

web_news ±íÀïÓÐTOPÁÐ ÔõÑùÈÃTOPÁмǼΪ1µÄΪÖÃÇ°  ¸÷λ´ó´óÃÇ°ï°ïæ ·Ö²»¶à Çë°üº­£¡£¡
order ......

sqlite3 linuxÏÂCÓïÑÔµÄÎÊÌâ

ÓõÄÊÇsqllite3£¬ÇëÎÊÔÚlinuxÏÈÈçºÎÓÃCÓïÑÔµ¼³öÊý¾Ý¿â°¡£¿
"µ¼³öÊý¾Ý¿â"ÊÇÊÇʲô£¿

½« tab_xx ÖеÄÊý¾Ýµ¼³öµ½Îļþa.txt
sqlite> .output a.txt
sqlite> select * from tab_xx;
sqli ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ