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

SQLite ÖÐÎÄ FAQ

zz from https://www.dream4ever.org/showthread.php?t=86440 feuvan @ DRL
Ô­ÎÄÔÚhttp://sqlitecn.feuvan.net/faq.html
Óï·¨²¿·ÖÕýÔÚ·­ÒëÖУ¬¾´ÇëÆÚ´ý
FAQÖÐÎÄ°æ
ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
SQLite Ö§³ÖÄÄЩÊý¾ÝÀàÐÍ£¿
ΪʲôÄÜÏò SQLite Êý¾Ý¿âµÄÕûÐÍ×Ö¶ÎÖвåÈë×Ö·û´®£¿
Ϊʲô SQLite ÈÏΪ±í´ïʽ '0'=='00' ΪÕ棿
Ϊʲô SQLite ²»ÔÊÐíÔÚͬһÕűíÀïʹÓà '0' ºÍ '0.0' ×÷ΪÁ½¸ö²»Í¬µÄÐеÄÖ÷¼ü£¿
Ϊʲô²»ÄÜÔÚ Linux box ÖжÁÈ¡ÔÚ SparcStation Öд´½¨µÄ SQLite Êý¾Ý¿â£¿
¶à¸öÓ¦ÓóÌÐò»òÕßͬһ¸öÓ¦ÓóÌÐòµÄ¶à¸öÀý³ÌÄÜͬʱ´æȡͬһ¸öÊý¾Ý¿âÎļþÂð£¿
SQLiteÊÇḬ̈߳²È«µÄÂð?
ÈçºÎÁгöÒ»¸ö SQLite Êý¾Ý¿âÖеÄËùÓеıí/Ë÷Òý£¿
SQLiteÊý¾Ý¿âÊÇ·ñÓÐÒÑÖªµÄ´óСÏÞÖÆ£¿
ÔÚ SQLite ÖÐ VARCHAR µÄ×î´ó³¤¶ÈÊǶàÉÙ£¿
SQLite ÊÇ·ñÖ§³Ö BLOB ÀàÐÍ£¿
ÈçºÎ´ÓÒ»¸öÒÑ´æÔÚµÄ SQLite Êý¾Ý±íÖÐÌí¼Ó/ɾ³ý×ֶΣ¿
ÎÒɾ³ýÁ˺ܶàÊý¾Ýµ«ÊÇÊý¾Ý¿âÎļþ²¢Ã»ÓмõС£¬ÊDz»ÊÇ Bug£¿
ÊÇ·ñÄܽ« SQLite ÓÃÓÚÉÌÒµÓÃ;¶ø²»Óý»°æȨ·ÑÓã¿
ÎÒÈçºÎʹÓú¬Óе¥ÒýºÅ(')µÄ×Ö·û´®£¿
SQLITE_SCHEMA ´íÎó´ú±íʲô£¿
ΪʲôROUND(9.95,1) ·µ»Ø 9.9 ¶ø²»ÊÇ 10.0? ÄѵÀ9.95 ²»¸ÃÏòÉϽøλô£¿
--------------------------------------------------------------------------------
(1) ÈçºÎ´´½¨×ÔÔö×ֶΣ¿
¼òµ¥µÄ»Ø´ð£ºÒ»¸öÉùÃ÷Ϊ INTEGER PRIMARY KEY µÄ×ֶν«×Ô¶¯Ôö¼Ó¡£
ÕâÀïÊÇÏêϸµÄ´ð°¸£º ´Ó SQLite µÄ 2.3.4 °æ±¾¿ªÊ¼£¬Èç¹ûÄ㽫һ¸ö±íÖеÄÒ»¸ö×Ö¶ÎÉùÃ÷Ϊ INTEGER PRIMARY KEY£¬ÄÇôÎÞÂÛÄãºÎʱÏò¸Ã±íµÄ¸Ã×ֶβåÈëÒ»¸ö NULL Öµ£¬Õâ¸ö NULL Öµ½«×Ô¶¯±»¸ü»»Îª±È±íÖиÃ×Ö¶ÎËùÓÐÐеÄ×î´óÖµ´ó 1 µÄÕûÊý£»Èç¹û±íΪ¿Õ£¬ÄÇô½«±»¸ü»»Îª 1¡£±ÈÈ磬¼ÙÉèÄãÓÐÕâÑùµÄÒ»ÕÅÊý¾Ý±í:
CREATE TABLE t1(
a INTEGER PRIMARY KEY,
b INTEGER
);
ÔÚÕâÕÅÊý¾Ý±íÀÉùÃ÷
INSERT INTO t1 VALUES(NULL,123);
ÔÚÂß¼­ÒâÒåÉϵȼÛÓÚ£º
INSERT INTO t1 VALUES((SELECT max(a) from t1)+1,123);
Ò»¸öеÄAPIº¯Êý sqlite3_last_insert_rowid() ·µ»Ø×î½üµÄ²åÈë²Ù×÷µÄÕûÐμü
×¢ÒâÕâ¸öÕûÐͼüʼÖÕ±È֮ǰ²åÈë±íÖеÄ×îºóÒ»¸ö¼ü´ó1¡£Ð¼üÏà¶ÔÓÚ±íÖеÄÒÑÓмüÀ´ËµÊÇΨһµÄ£¬ µ«Ëü¿ÉÄÜÓë֮ǰ´Ó±íÖÐɾ³ýµÄ¼üÖµÖصþ¡£ÒªÊ¼Öյõ½ÔÚÕû¸ö±íÖÐΨһµÄ¼ü£¬ÔÚINTEGER PRIMARY KEYµÄÉùÃ÷֮ǰ¼Ó¹Ø¼ü´ÊAUTOINCREMENT.ÕâÑù±»Ñ¡µÄ¼ü½«×ÜÊDZȱíÖÐÒÑ´æÔÚµÄ×î´ó¼ü´ó1¡£Èô¿ÉÄÜµÄ ×î´ó¼üÒÑ´æÔÚÓÚ±íÖУ¬INSERT²Ù×÷½«Ê§°Ü²


Ïà¹ØÎĵµ£º

iphone¿ª·¢ SQLiteÊý¾Ý¿âʹÓÃ

ÎÒÏÖÔÚҪʹÓÃSQLite3.0´´½¨Ò»¸öÊý¾Ý¿â£¬È»ºóÔÚÊý¾Ý¿âÖд´½¨Ò»¸ö±í¸ñ¡£
Ê×ÏÈÒªÒýÈëSQLite3.0µÄlib¿â¡£È»ºó°üº¬Í·Îļþ#import <sqlite3.h>
¡¾1¡¿´ò¿ªÊý¾Ý¿â£¬Èç¹ûûÓУ¬ÄÇô´´½¨Ò»¸ö
sqlite3* database_;
-(BOOL) open{
       NSArray *paths = NSSearchPathForDirectoriesInDomai ......

Ò»¸ö¹ØÓÚSQLiteС³ÌÐò £¬Çë´ó¼Ò¶à¶àÖ¸½Ì£¡

package com.jiao.sqlite;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widg ......

Android SQLITE ¼òµ¥Æð²½

1£º¶¨Òå±íµÄ½á¹¹ºÍÃû×Ö£¬ÎÒʹÓÃÒÔÏ·½·¨£º
public interface Constatnts extends BaseColumns {
   public static final String TABLE_NAME = "test";
  
   public static final String TIME = "time";
   public static final String TITLE = "title";
}
ÔÚÕâÀÎҼ̳Р......

c# sqlite Êý¾Ý¿â¼ÓÃÜ


ÓÃÁËADO.NET 2.0 SQLite Data Provider ÕâÑù¿ÉÒÔÖ±½ÓÀûÓÃËüÀ´´´½¨Ò»¸ö¼ÓÃܵÄsqliteÊý¾Ý¿â¡£
ÓйØc#´úÂëÈçÏ£º
1¡¢´´½¨¿ÕµÄsqliteÊý¾Ý¿â¡£
//Êý¾Ý¿âÃûµÄºó׺Äã¿ÉÒÔÖ±½ÓÖ¸¶¨£¬ÉõÖÁûÓкó׺¶¼¿ÉÒÔ
//·½·¨Ò»£º´´½¨Ò»¸ö¿ÕsqliteÊý¾Ý¿â£¬ÓÃIOµÄ·½Ê½
FileStream fs = File.Create(“c:\\test.db“);
//·½·¨¶þ£ºÓ ......

Android (SQLite Êý¾Ý¿âÓëContentProvider)

ÔÚ AndroidÖУ¬¶ÔÓÚÊý¾ÝµÄ´æÖü£¬Óм¸ÖÖ·½Ê½£¬ÓÐÎļþ·½Ê½£¬ÓÐÎļþʽÊý¾Ý¿â·½Ê½,Android×Ô´øÁËÒ»¸öSQLiteÊý¾Ý¿â£¬×öǶÈ뿪·¢µÄÈ˶ÔÕâ¸ö¿çƽ̨µÄ±¾µØÎļþÊý¾Ý¿âÒ»¶¨²»»áÄ°Éú£¬ÔÚAndroid¶ÔÓÚÊý¾ÝµÄ·ÃÎÊ£¬Ìá³öÁËеķ½Ê½£¬ContentProvider·½Ê½£¬ÀàËÆÓÚMSµÄ ContentProvider·½Ê½µÄ£¬OLEDB£¬¼°ODBCͳһµÄÊý¾Ý·½Ê½¡£
ÎÒÃÇÊ×ÏÈÀ´¿´¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ