sqlite的安装
使用版本:sqlite-3.6.14.2
下载地址:http://www.sqlite.org/sqlite-3.6.14.2.tar.gz
首先参考readme的提示:
“
tar xzf sqlite.tar.gz ;# Unpack the source tree into "sqlite"
mkdir bld ;# Build will occur in a sibling directory
cd bld ;# Change to the build directory
../sqlite/configure ;# Run the configure script
make ;# Run the makefile.
make install ;# (Optional) Install the build products
”
下面开始安装
第一步:创建sqlite安装目录
mkdir sqlite
第二部:创建build目录
mkdir bld
cd bld
第三步:最关键的一步,生成makefile文件
../sqlite-3.6.14.2/configure --disable-tcl --prefix=/root/sqlite
这一步和readme中描述的不同
如果不加--disable-tcl,会因为tcl.h文件找不到而编译通不过。
最后执行make & make install,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  ......
这是一个有关分页的实例,仅供参考(代码来自网络)
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;
us ......
SQLite 作为一个轻量级嵌入式数据库,还是非常好用的。雨痕极力推荐~~~~~~
今天有个朋友测试 SQLite,然后得出的结论是:SQLite 效率太低,批量插入1000条记录,居然耗时 2 分钟!
下面是他发给我的测试代码。我晕~~~~~~
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
......
(1) 如何建立自动增长字段?
简短回答:声明为 INTEGER PRIMARY KEY 的列将会自动增长。
长一点的答案: 如果你声明表的一列为 INTEGER PRIMARY KEY,那么, 每当你在该列上插入一NULL值时, NULL自动被转换为一个比该列中最大值大1的一个整数,如果表是空的, 将会是1。 (如果是最大可能的主键 9223372036854775807 ......