Features and Limitations鐗規у拰灞闄愭?/font>
In this section we will look at the key features of SQLite and some of its limitations. The nature of SQLite makes it an ideal choice for quite a number of tasks, but it's not suitable for everything.
鍦ㄦ湰閮ㄥ垎鎴戜滑灝嗚鐪嬩竴涓婼QLite鍏抽敭鐗規у拰瀹冪殑涓浜涘眬闄愭с係QLite鐨勬湰璐ㄤ嬌瀹冩垚涓鴻澶氫換鍔$殑鐞嗘兂閫夋嫨錛屼絾瀹冨茍涓嶉傚悎鎵鏈夌殑鏂歸潰銆?br />
Speed閫熷害
SQLite is extremely efficient, benefiting from a highly optimized internal architecture and a small memory footprint. Because SQLite is not a client/server database, the overheads of running a database daemon and socket communication are eliminated.
SQLite 闈炲父楂樻晥錛岃繖寰楃泭浜庨珮搴︿紭鍖栫殑鍐呴儴緇撴瀯鍜屽緢灝忕殑鍐呭瓨闇姹傘傚洜涓篠QLite 涓嶆槸涓涓鎴風/鏈嶅姟鍣ㄧ被鍨嬬殑鏁版嵁搴擄紝榪愯涓涓暟鎹簱榪涚▼鍜屽鎺ュ瓧閫氫俊鐨勫紑閿琚秷闄や簡銆?br />
鍦?/font>
http://www.sqlite.org/speed.html
涓婄殑鍙戣〃浜嗗畠鍜孧ySQL鍜孭ostgreSQL閫熷害瀵規瘮銆傚姣旇〃鏄庯紝SQLite鍦ㄦ墽琛屾櫘閫氭搷浣滅殑鏃跺欓熷害姣擯ostgreSQL蹇?0鍊嶏紝鏄疢ySQL鐨勪袱鍊嶃?/font>
榪欎釜鏄湪姣忎釜鏁版嵁搴撶殑榛樿瀹夎鎯呭喌涓嬫祴璇曠殑錛屽敖綆″湪緇欏畾鐨勭幆澧冧腑璋冩暣涔嬪悗錛孧ySQL鍜?PostgreSQL 鐨勬墽琛屾儏鍐典細鐣ユ湁鎻愰珮錛屼絾鏄疭QLite鏄笉闇瑕佷換浣曚紭鍖栫殑銆?/font>
Portability縐繪鎬?/font>
Because SQLite databases are stored as single files on the filesystem, they are very portable indeed. A database can be copied from one file to another, even across different operating systems. This means that for a cross-platform distribution you just need to concentrate on making your code portable even when a populated database is to be shipped with the application.
鍥犱負SQLite鏁版嵁搴撳湪鏂囦歡緋葷粺涓婃槸浣滀負鍗曚釜鏂囦歡瀛樺偍鐨勶紝瀹為檯涓婂畠浠槸闈炲父瀹規槗縐繪鐨勩備竴涓暟鎹簱鍙浠庝竴涓枃浠舵嫹璐濆埌鍙︿竴涓枃浠訛紝鐢氳嚦鏄法瓚婁笉鍚岀殑鎿嶄綔緋葷粺銆傝繖鎰忓懗鐫鍦ㄦ湁涓涓氦鍙夊鉤鍙頒笂鍙戝竷鐨勬椂鍊欙紝浣犲彧闇瑕佸叧娉ㄤ簬浣夸綘鐨勪唬鐮?浣垮叾鍙互縐繪錛岀敋鑷蟲槸褰撲竴涓彲縐繪鐨勬暟鎹簱鏄拰搴旂敤涓璧峰彂甯冪殑銆?/font>
Security
|
浠嬬粛
SQLite is an embeddable SQL-driven database engine that implements both the database engine and its interface as a C/C++ library. Started in 2000 by D. Richard Hipp, it was written from the ground up and contains absolutely no legacy code, and the SQLite source code has been in the public domain since the first prerelease of version 2.0 in 2001.
SQLite鏄竴涓祵鍏ュ紡鐨凷QL椹卞姩鐨勬暟鎹簱寮曟搸錛屽畠鍙互浣滀負鏁版嵁搴撳紩鎿庢垨鑰匔/C++搴撶殑鎺ュ彛浣跨敤銆傚畠鐢盌. Richard Hipp鍦?000騫村垱寤猴紝瀹冩槸瀹屽叏閲嶅啓鐨勭粷瀵逛笉鍖呭惈浠諱綍鐨勮佺▼搴忋傝嚜浠?001騫寸殑2.0鐗堟湰SQLite鐨勯鍙戣鐗堝彂甯冧互鏉ユ簮浠g爜灝卞叕寮浜嗐?/font>
The primary design goals when SQLite was conceived were that it should be
SQLite鏋勬兂鏃跺欑殑涓昏璁捐鐩爣鏄細
Simple to administer
鏄撲簬綆$悊
Simple to operate
鏄撲簬鎿嶄綔
Simple to use in a program
鏄撲簬鍦ㄧ▼搴忎腑浣跨敤
Simple to maintain and customize
鏄撲簬緇存姢鍜屽畾鍒?/font>
The fact that SQLite is small, fast, and reliable arguably its greatest strengthsis, according to Hipp, a happy coincidence. He concentrated on making SQLite simple, and reliability is a byproduct of having fewer things to go wrong. Having simpler code in the database engine makes it much easier to optimize.
鎸塇ipp鎵璇達紝浜嬪疄涓奡QLite寰堝皬錛屽緢蹇拰鍙互淇¤禆鐨勶紝騫朵笖璇佹槑鏈夊崜瓚婄殑寮哄害錛宎 happy coincidence銆備粬鑷村姏浜庝嬌SQLite綆鍗曞寲錛岃鏇村皯鐨勪笢瑗垮嚭閿欑殑鍓駭鍝佸氨鏄彲淇¤禆鎬с傛暟鎹簱寮曟搸浠g爜鐨勭畝鍗曞寲浣垮緱瀹冪殑浼樺寲瀹規槗鐨勫銆?br />
Note
娉ㄦ剰
The acronym SQL is sometimes pronounced sequel, although in common usage it is most often said as three letters. SQLite, however, is pronounced sequel-lite by its creatorin the same way that Microsoft SQL Server is usually pronounced sequel-serverand therefore that is how we have assumed it is said in this book. As we will refer to a SQLite database and an SQL statement, it will help if you are used to hearing them this way as you read on.
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽鎽樿嚜銆奡QLite銆?/font>Chris聽Newman钁?/font>
涓轟粈涔堜嬌鐢⊿QLite錛?/font>
There are many reasons for choosing SQLite, including
閫夋嫨SQLite鏈夎澶氱悊鐢憋紝鍖呮嫭錛?/font>
Performance SQLite performs database operations efficiently and is faster than other free databases such as MySQL and PostgreSQL.
鎬ц兘 SQLite鍦ㄦ墽琛屾暟鎹簱鎿嶄綔鐨勬椂鍊欒姣旇濡侻ySQL鍜?/font> PostgreSQL絳夎嚜鐢辨暟鎹簱楂樻晥鍜屽揩閫熴?/font>
Size SQLite has a small memory footprint and only a single library is required to access databases, making it ideal for embedded database applications.
澶у皬 SQLite鏈夊緢灝忕殑闇瑕佸緢灝戠殑鍐呭瓨錛屽茍涓旇闂暟鎹簱鍙渶瑕佷竴涓崟鐙殑搴撴枃浠訛紝榪欎簺浣垮畠鎴愪負宓屽叆寮忔暟鎹簱搴旂敤鐨勭悊鎯抽夋嫨銆?/font>
Portability SQLite runs on many platforms and its databases can be ported easily with no client/server setup or ongoing administration required.
鍙Щ妞嶆?/strong> SQLite鍙互鍦ㄥ緢澶氬鉤鍙頒笂榪愯錛屽茍涓斾粬鐨勬暟鎹簱鍙互鍦ㄦ病鏈夊鎴風/鏈嶅姟鍣ㄨ緗?鍜岀鐞嗕笉闂存柇鐨勬儏鍐典笅榪涜縐繪銆?/font>
Stability SQLite is ACID-compliant, meeting all four criteria Atomicity, Consistency, Isolation, and Durability.
紼沖畾鎬?/strong> SQLite閬典粠涓嶅彲鍒嗗壊鎬у師鍒欙紝絎﹀悎鎵鏈夌殑鍥涗釜鏍囧噯鍘熷瓙鎬э紝涓鑷存э紝闅旂鎬э紝鍜岃愪箙鎬с?/font>
SQL support SQLite implements a large subset of the ANSI-92 SQL standard, including views, subqueries, and triggers.
SQL聽 SQLite鏀寔ANSI-92 SQL鏍囧噯鐨勪竴涓ぇ鐨勫瓙闆嗗伐鍏鳳紝鍖呮嫭瑙嗗浘錛屽瓙鏌ヨ鍜岃Е鍙戝櫒銆?/font>
Interfaces SQLite has language APIs for C/C++, PHP, Perl, Python, Tcl, and many more beyond those covered in this book.
鎺ュ彛 SQLite鏈?C/C++, PHP, Perl, Python, Tcl鍜屾洿澶氱殑鍦ㄦ湰涔︿箣澶栫殑璇█銆?/font>
Cost SQLite is in the public domain and therefore is free to use for any purpose without cost and can be freely redistributed.
璐圭敤 SQLite 鏄叕寮鐨勶紝鍥犳鍙互浠繪剰鐨勮嚜鐢變嬌鐢ㄥ畠鑰屼笉闇瑕佷粯璐癸紝騫朵笖鍙互鑷敱鐨勯噸鏂板彂甯冦?/font>