SQLite数据库连接方式
SQLite数据库连接方式
SQLite.NET
Type: .NET Framework Class Library
Usage: System.Data.SQLite.SQLiteConnection
Basic
Data Source=filename;Version=3;
Version 2 is not supported by this class library.
Using UTF16
Data Source=filename;Version=3;UseUTF16Encoding=True;
With password
Data Source=filename;Version=3;Password=myPassword;
Using the pre 3.3x database format
Data Source=filename;Version=3;Legacy Format=True;
With connection pooling
Connection pooling is not enabled by default. Use the following parameters to control the connection pooling mechanism.
Data Source=filename;Version=3;Pooling=False;Max Pool Size=100;
Read only connection
Data Source=filename;Version=3;Read Only=True;
Using DateTime.Ticks as datetime format
Data Source=filename;Version=3;DateTimeFormat=Ticks;
The default value is ISO8601 which activates the use of the ISO8601 datetime format
Store GUID as text
Normally, GUIDs are stored in a binary format. Use this connection string to store GUIDs as text.
Data Source=filename;Version=3;BinaryGUID=False;
Note that storing GUIDs as text uses more space in the database.
Specify cache size
Data Source=filename;Version=3;Cache Size=2000;
The Cache Size value measured in bytes
Specify page size
Data Source=filename;Version=3;Page Size=1024;
The Page Size value measured in bytes
Disable enlistment in distributed transactions
Data Source=filename;Version=3;Enlist=N;
Disable enlistment in distributed transactions
Data Source=filename;Version=3;Enlist=N;
Disable create database behaviour
If
the database file doesn't exist, the default behaviour is to create a
new file. Use the following parameter to raise an error instead of
creating a new database file.
Data Source=filename;Version=3;FailIfMissing=True;
Limit the size of database
Data Source=filename;Version=3;Max Page Count=5000
相关文档:
内存数据库FastDB和SQLite性能测评
作者:tamsyn
来源:www.sqlite.com.cn
时间:2009-10-21
一、引言
在很多项目中,经常会碰到这样的需求,需要对大量数据进行快速存储、查询、删除等操作,特别是在一些针对诸如运营商、银行等大型企业的应用中,这些 ......
代码很乱,而且没有用到模板,把html代码跟Python代码混在一起了,而且也没有用到web.py本身提供的数据库操作模块,绝对粗超的代码!
学习了很多东西,首先当然是web.py,然后是sqlite,接下来是time模块——看来也唯有不断的实践,才真正能进步!
说实在的,偶学html到现在这么久,还是半桶水,悲剧了!
01&n ......
1 TOP
这是一个大家经常问到的问题,例如在SQLSERVER中可以使用如下语句来取得记录集中的前十条记录:
SELECT TOP 10 * from [index] ORDER BY indexid DESC;
但是这条SQL语句在SQLite中是无法执行的,应该改为:
SELECT * from [index] ORDER BY indexid DESC limit 0,10;
其中limit 0,10表示从第0 ......