使用SQLite

豆豆网   技术应用频道   2007年10月26日    社区交流

关键字: SQLite

本文详细介绍使用SQLite

  SQLite is a small, fast, embeddable database. What makes it popular is the combination of the database engine and interface into a single library as well as the ability to store all the data in a single file. Its functionality lies between MySQL and PostgreSQL, however it is faster than both databases.

  SQLite http://www.sqlite.org/

  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.

  The published speed comparison at http://www.sqlite.org/speed.html compares SQLite to both MySQL and PostgreSQL. It finds that SQLite can perform up to 20 times faster than PostgreSQL and more than twice as fast as MySQL for common operations.

  Security

  SQLite databases are stored to the filesystem and access control is performed by the underlying operating system based on that file's permission settings.

  SQL Implementation

  SQLite supports a large subset of the ANSI SQL-92 standard. Some features have a limited implementation and a few features are not supported at all.

  Programming Languages

  SQLite has APIs for many other programming languages, including C/C++,PHP,Perl,Tcl,Java, .NET, Smalltalk, and Ruby. As more languages become supported, they are added to the list at http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers.

  SQLite.Net provider

  http://sourceforge.net/projects/adodotnetsqlite

  http://www.phpguru.org/csharpdocs/SQLite.NET/

   SQLite作为一个嵌入式的数据库有很多的优势,最主要的是程序小(200多K),速度快,支持ANSI SQL-92 的大部分标准功能。

  Transactions

  特别要注意的是:它的速度和Transactions事务处理有很大关系。

  所以在持续插入或更新时一定要使用Transactions。

  原因是:When all the INSERTs are put in a transaction, SQLite no longer has to close and reopen the database or invalidate its cache between each statement. It also does not have to do any fsync()s until the very end. When unshackled in this way, SQLite is much faster than either PostgreSQL and MySQL.

  SQLite的弱点:

  1.没有专有的安全措施,数据库是一个文件。

  2.没有内嵌的压缩、解压机制,数据库文件看上去太大。

责编:豆豆技术应用

正在加载评论...