Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : Sqlite

SQLite¼ò½é

1¡¢SQLite¼ò½é
¡¡¡¡SQLiteµÚÒ»¸öAlpha°æ±¾µ®ÉúÓÚ2000Äê5ÔÂ. ÖÁ½ñÒѾ­ÓÐ4¸öÄêÍ·ÁË. SQLiteÒ²Ó­À´ÁËÒ»¸ö°æ±¾ SQLite 3ÒѾ­·¢²¼.
¡¡
¡¡SQLiteÊÇÒ»¿îÇáÐ͵ÄÊý¾Ý¿â£¬ÊÇ×ñÊØACIDµÄ¹ØÁªÊ½Êý¾Ý¿â¹ÜÀíϵͳ£¬ËüµÄÉè¼ÆÄ¿±êÊÇǶÈëʽµÄ£¬¶øÇÒÄ¿Ç°ÒѾ­ÔںܶàǶÈëʽ²úÆ·ÖÐʹÓÃÁËËü£¬ËüÕ¼ÓÃ×Ê
Ô´·Ç³£µÄµÍ£¬ÔÚǶÈëʽÉ豸ÖУ¬¿ÉÄÜÖ»ÐèÒª¼¸°ÙKµÄÄÚ´æ¾Í¹»ÁË¡£ËüÄܹ»Ö§³ÖWindows/Linux/UnixµÈµÈÖ÷Á÷µÄ²Ù×÷ϵͳ£¬Í¬Ê±Äܹ»¸úºÜ¶à³ÌÐòÓï
ÑÔÏà½áºÏ£¬±ÈÈçTcl¡¢PHP¡¢JavaµÈ£¬»¹ÓÐODBC½Ó¿Ú£¬Í¬Ñù±ÈÆðMysql¡¢PostgreSQLÕâÁ½¿î¿ªÔ´ÊÀ½çÖøÃûµÄÊý¾Ý¿â¹ÜÀíϵͳÀ´½²£¬ËüµÄ
´¦ÀíËٶȱÈËûÃǶ¼¿ì¡£
¡¡¡¡SQLiteËäÈ»ºÜСÇÉ£¬µ«ÊÇÖ§³ÖµÄSQLÓï¾ä²»»áÑ·É«ÓÚÆäËû¿ªÔ´Êý¾Ý¿â£¬ËüÖ§³ÖµÄSQL°üÀ¨£º
¡¡¡¡ATTACH DATABASE
¡¡¡¡BEGIN TRANSACTION
¡¡¡¡comment
¡¡¡¡COMMIT TRANSACTION
¡¡¡¡COPY
¡¡¡¡CREATE INDEX
¡¡¡¡CREATE TABLE
¡¡¡¡CREATE TRIGGER
¡¡¡¡CREATE VIEW
¡¡¡¡DELETE
¡¡¡¡DETACH DATABASE
¡¡¡¡DROP INDEX
¡¡¡¡DROP TABLE
¡¡¡¡DROP TRIGGER
¡¡¡¡DROP VIEW
¡¡¡¡END TRANSACTION
¡¡¡¡EXPLAIN
¡¡¡¡expression
¡¡¡¡INSERT
¡¡¡¡ON CONFLICT clause
¡¡¡¡PRAGMA
¡¡¡¡R ......

SqliteÅжÏ×ֶδæÔÚ

Åжϱí´æÔڵķ½·¨ºÜ¼òµ¥,ÍøÉϺܶà:
SELECT COUNT(*) from sqlite_master where type='table' and name='%s'" % tname;
ÄÇôÅжÏ×Ö¶ÎÊÇ·ñ´æÔÚ, »òÕß˵ÈçºÎÅжϱíµÄ°æ±¾ÊÇ·ñ×îоÍÖ»ÐèÒª:
select * from sqlite_master where tbl_name='tblContactList';
sqlite_master µÄ±í½á¹¹ÈçÏÂ:
type   |name    |tbl_name    |rootpage   |sql
×îºóÒ»¸ösql¾ÍÊÇ´´½¨tblContactList±íµÄsqlÓï¾ä, ËùÒÔÖ»ÒªÅжÏÕâ¸ösqlÓï¾äÊÇ·ñºÍÄãµÄ´´½¨Óï¾äÒ»Ñù¾Í¿ÉÒÔÖªµÀ¸Ã±íÊDz»ÊÇÄã×îеİ汾. ......

ǶÈëʽÊý¾Ý¿âSQLiteÓëJava

ǶÈëʽÊý¾Ý¿âSQLiteÓëJava
SQLite×÷Ϊһ¸ö¿ªÔ´µÄǶÈëʽÊý¾Ý¿â²úÆ·£¬¾ßÓÐϵͳ¿ªÏúС£¬¼ìË÷ЧÂʸߵÄÌØÐÔ£¬ÊÊÓÃÓÚÊÖ»ú¡¢PDA¡¢»ú¶¥ºÐÉ豸µÈµçÆ÷£¬²¢ÇÒ×÷ΪǶÈëʽÊý¾Ý¿âÔÚ¿ÉÏÂÔصÄÏû·ÑÀàÓ¦ÓóÌÐòÖÐÔËÐеĺܺá£ÕâƪÎÄÕ½éÉÜǶÈëʽÊý¾Ý¿â²úÆ·SQLiteµÄ¼¼ÊõÌص㣬²¢×ÅÖØÌÖÂÛÑо¿ÓëJavaÓïÑÔÖ®¼äµÄ½Ó¿Ú£¬²¢ÒÔʵÀý˵Ã÷ÈçºÎʹÓÃJAVA¿ª·¢»ùÓÚSQLiteµÄÓ¦ÓóÌÐò¡£
ͨ³£ÎÒÃDzÉÓø÷ÖÖÊý¾Ý¿â²úÆ·À´ÊµÏÖ¶ÔÊý¾ÝµÄ´æ´¢¡¢¼ìË÷µÈ¹¦ÄÜ£¬ÀýÈ磬Oracle£¬SQL Server£¬MySQLµÈµÈ¡£ÕâЩ²úÆ·³ýÌṩ»ù±¾µÄ²éѯ£¬É¾³ý£¬Ìí¼ÓµÈ¹¦ÄÜÍ⣬ҲÌṩÁ˺ܶà¸ß¼¶ÌØÐÔ£¬Èç´¥·¢Æ÷£¬´æ´¢¹ý³Ì£¬Êý¾Ý±¸·Ý»Ö¸´£¬È«ÎļìË÷¹¦Äܵȡ£µ«Êµ¼ÊÉÏ£¬ºÜ¶àµÄÓ¦Ó㬽ö½öÀûÓõ½ÁËÕâЩÊý¾Ý¿â²úÆ·µÄ»ù±¾ÌØÐÔ¶øÒÑ¡£¶øÇÒÔÚһЩСÐÍÓ¦ÓÃÉÏ£¬»òÕßijЩÌØÊⳡºÏµÄÓ¦Ó㬱ÈÈç×ÀÃæ³ÌÐò£¬ÕâЩÊý¾Ý¿â²úÆ·¾ÍÃ÷ÏÔÓÐһЩӷÖס£ÔÚÕâЩÇé¿öÏ£¬Ç¶ÈëʽÊý¾Ý¿âµÄÓÅÊƾÍÌرðÃ÷ÏÔÁË¡£
ǶÈëʽÊý¾Ý¿âÎÞÐë¶ÀÁ¢ÔËÐеÄÊý¾Ý¿âÒýÇ棬ËüÊÇÓɳÌÐòÖ±½Óµ÷ÓÃÏàÓ¦µÄAPIȥʵÏÖ¶ÔÊý¾ÝµÄ´æÈ¡²Ù×÷¡£¸üÖ±°×µÄ½²£¬Ç¶ÈëʽÊý¾Ý¿âÊÇÒ»Ö־߱¸ÁË»ù±¾Êý¾Ý¿âÌØÐÔµÄÊý¾ÝÎļþ¡£Ç¶ÈëʽÊý¾Ý¿âÓëÆäËüÊý¾Ý¿â²úÆ·µÄÇø±ðÊÇ£¬Ç°ÕßÊdzÌÐòÇý¶¯Ê½, ¶øºóÕßÊÇÒýÇæÏìӦʽ¡£Ç¶ÈëʽÊý¾Ý¿âµÄÒ»¸öºÜÖØÒªµÄÌصãÊ ......

C#ÓëSqliteÊý¾Ý¿â²Ù×÷ʵÀý

ÕâÊÇÒ»¸öÓйطÖÒ³µÄʵÀý,½ö¹©²Î¿¼(´úÂëÀ´×ÔÍøÂç)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
using System.Threading;
using System.Collections;
using System.IO;
namespace ReadCardDemo
{
public partial class Form3 : Form
{
Form4 form4 = new Form4();
int pageSize = 12; //ÿҳÏÔʾÐÐÊý
int nMax = 0; //×ܼǼÊý
int totalPage = 0; //×ÜÒ³Êý£½×ܼǼÊý/ÿҳÏÔʾÐÐÊý
int currentPage = 1; //µ±Ç°Ò³ºÅ
int pageCount = 0; //µ±Ç°Ò³ÊýµÄ¼Ç¼Êý
int selectRow; //µ±Ç°Ñ¡ÖеÄÐÐÊý
DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable();
SQLiteDataAdapter dataAdapter;
SQLiteConnection conn = new SQLiteConnection();
SQLiteCommand cmd;
SQLiteDataReader dr;
string datasource;
st ......

C#ÓëSqliteÊý¾Ý¿â²Ù×÷ʵÀý

ÕâÊÇÒ»¸öÓйطÖÒ³µÄʵÀý,½ö¹©²Î¿¼(´úÂëÀ´×ÔÍøÂç)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SQLite;
using System.Threading;
using System.Collections;
using System.IO;
namespace ReadCardDemo
{
public partial class Form3 : Form
{
Form4 form4 = new Form4();
int pageSize = 12; //ÿҳÏÔʾÐÐÊý
int nMax = 0; //×ܼǼÊý
int totalPage = 0; //×ÜÒ³Êý£½×ܼǼÊý/ÿҳÏÔʾÐÐÊý
int currentPage = 1; //µ±Ç°Ò³ºÅ
int pageCount = 0; //µ±Ç°Ò³ÊýµÄ¼Ç¼Êý
int selectRow; //µ±Ç°Ñ¡ÖеÄÐÐÊý
DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable();
SQLiteDataAdapter dataAdapter;
SQLiteConnection conn = new SQLiteConnection();
SQLiteCommand cmd;
SQLiteDataReader dr;
string datasource;
st ......

sqliteµÄѧϰ±Ê¼ÇתÔØ

Ç°Ðò£º
Sqlite3 µÄÈ·ºÜºÃÓá£Ð¡ÇÉ¡¢Ëٶȿ졣µ«ÊÇÒòΪ·Ç΢ÈíµÄ²úÆ·£¬°ïÖúÎĵµ×ܾõµÃ²»¹»¡£ÕâЩÌìÔÙ´ÎÑо¿Ëü£¬ÓÖÓÐһЩÊÕ»ñ£¬ÕâÀï°ÑÎÒ¶Ô sqlite3 µÄÑо¿ÁгöÀ´£¬ÒÔ±¸Íü¼Ç¡£
ÕâÀïҪעÃ÷£¬ÎÒÊÇÒ»¸ö¿çƽ̨רעÕߣ¬²¢²»Ï²»¶Ö»Óà windows ƽ̨¡£ÎÒÒÔÇ°µÄ¹¤×÷¾ÍÊÇΪ unix ƽ̨д´úÂë¡£ÏÂÃæÎÒËùдµÄ¶«Î÷£¬ËäȻûÓÐÑéÖ¤£¬µ«ÊÇÎÒÒѾ¡Á¿²»Ê¹ÓÃÈκΠwindows µÄ¶«Î÷£¬Ö»Ê¹Óñê×¼ C »ò±ê×¼C++¡£µ«ÊÇ£¬ÎÒûÓг¢ÊÔ¹ýÔÚ±ðµÄϵͳ¡¢±ðµÄ±àÒëÆ÷ϱàÒ룬Òò´ËÏÂÃæµÄÐðÊöÈç¹û²»ÕýÈ·£¬ÔòÁô´ýÒÔºóÐ޸ġ£
ÏÂÃæÎҵĴúÂëÈÔÈ»Óà VC ±àд£¬ÒòΪÎÒ¾õµÃVCÊÇÒ»¸öºÜ²»´íµÄIDE£¬¿ÉÒÔ¼Ó¿ì´úÂë±àдËٶȣ¨ÀýÈçÅäºÏ Vassist £©¡£ÏÂÃæÎÒËù˵µÄ±àÒë»·¾³£¬ÊÇVC2003¡£Èç¹û¶ÁÕß¾õµÃ×Ô¼ºÏ°¹ßÓÚ unix ÏÂÓà vi ±àд´úÂëËٶȽϿ죬¿ÉÒÔ²»ÓùÜÎÒµÄ˵Ã÷£¬Ö»ÐèÒª·ûºÏ×Ô¼ºÏ°¹ß¼´¿É£¬ÒòΪÎÒÓõÄÊDZê×¼ C »ò C++ ¡£²»»á¸øÈκÎÈË´øÀ´²»±ã¡£
Ò»¡¢ °æ±¾
´Ó www.sqlite.org ÍøÕ¾¿ÉÏÂÔص½×îÐ嵀 sqlite ´úÂëºÍ±àÒë°æ±¾¡£ÎÒд´ËÎÄÕÂʱ£¬×îдúÂëÊÇ 3.3.17 °æ±¾¡£
ºÜ¾ÃûÓÐÈ¥ÏÂÔØ sqlite дúÂ룬Òò´ËÒ²²»ÖªµÀ sqlite ±ä»¯Õâô´ó¡£ÒÔÇ°ºÜ¶àÎļþ£¬ÏÖÔÚÈ«²¿ºÏ²¢³ÉÒ»¸ö sqlite3.c Îļþ¡£Èç¹ûµ¥¶ÀÓôËÎļþ£¬ÊÇͦºÃµÄ£¬Ê¡È¥¿½±´Ò»¶ÑÎļþ»¹µ£Ð ......

sqlite´úÂëµÄ±àд

 ÏÂÔØ´úÂë
È¡µÃÒ»·Ý¶þ½øÖÆ¿½±´, »òÕßÊÇÔ´´úÂë²¢×Ô¼º±àÒëËü. ¹ØÓÚ ÏÂÔØÒ³£¨download£© µÄ¸ü¶àÐÅÏ¢.
´´½¨Ò»¸öÐÂÊý¾Ý¿â
ÔÚ DOS ÃüÁîÐÐÏÂ, ÊäÈë: "sqlite3 test.db". ½«´´½¨Ò»¸öеÄÊý¾Ý¿âÎļþÃû½Ð"test.db". (Äã¿ÉÒÔʹÓò»Í¬µÄÃû×Ö)
ÊäÈë SQL ÃüÁîÔÚÌáʾ·ûÏ´´½¨ºÍдÈëеÄÊý¾Ý.
д³ÌÐòʹÓà SQLite
ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄ TCL ³ÌÐòÈÃÎÒÃÇ¿´¿´ÔõôʹÓà sqlite µÄ TCL ½Ó¿Ú. ´Ë³ÌÐòÖ´ÐÐ SQL ÉùÃ÷µÄµÚ¶þ¸ö²ÎÊý Ö´ÐÐSQLÃüÁî. Õâ¸öÃüÁîÊÇ sqlite3 ÔÚµÚ 7 Ðдò¿ªÒ»¸ö SQLite Êý¾Ý¿â²¢ÇÒ´´½¨Ò»¸öÐ嵀 TCL ÃüÁÃû×ÖÊÇ"db" Á¬½Óµ½Êý¾Ý¿â,Õâ¸ö db ÃüÁîÔÚµÚ 8 ÐÐÖ´ÐÐ SQL ÃüÁî¶ÔÊý¾Ý¿â,²¢ÇҹرÕÓëÊý¾Ý¿âµÄÁ¬½Ó.
´úÂë:
#!/usr/bin/tclsh
if {$argc!=2} {
puts stderr "Usage: %s DATABASE SQL-STATEMENT"
exit 1
}
load /usr/lib/tclsqlite3.so Sqlite3
sqlite3 db [lindex $argv 0]
db eval [lindex $argv 1] x {
foreach v $x(*) {
puts "$v = $x($v)"
}
puts ""
}
db close
ÏÂÃæÊÇÒ»¸öC³ÌÐòµÄÀý×Ó£¬ÏÔʾÔõôʹÓà sqlite µÄ C/C++ ½Ó¿Ú. Êý¾Ý¿âµÄÃû×ÖÓɵÚÒ»¸ö²ÎÊýÈ¡µÃÇÒµÚ¶þ¸ö²ÎÊý»ò¸ü¶àµÄ²ÎÊýÊÇ SQL Ö´ÐÐÓï¾ä. Õâ¸öº¯Êýµ÷ÓÃsqlite3_open() ÔÚ 22 ÐÐ ......
×ܼǼÊý:155; ×ÜÒ³Êý:26; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [17] [18] [19] [20] [21] 22 [23] [24] [25] [26]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ