易截截图软件、单文件、免安装、纯绿色、仅160KB

SQLite的封装类

package
{
import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.errors.SQLError;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;

import mx.collections.ArrayCollection;

public class DBUtil
{
/**
* 数据库操作类别
**/
private const typeArr:Array = ['select','insert','update','delete','create','alter','drop'];

/**
* 连接
**/
private var conn:SQLConnection;

/**
* 声明
**/
private var stmt:SQLStatement;

/**
* 结果集合
**/
private var rsAC:ArrayCollection;

public function DBUtil()
{
}

/**
* 获得连接
**/
private function getConn():SQLConnection
{
if(this.conn == null){
conn = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, sqlOpen);
conn.addEventListener(SQLErrorEvent.ERROR, sqlError);
}
return this.conn;
}

/**
* 关闭连接
**/
private function closeConn():void
{
if(this.conn != null){
this.conn.close();
this.conn = null;
}
}

/**
* 获得声明
**/
private function getStatement():SQLStatement
{
if(this.stmt == null)
{
stmt = new SQLStatement();
stmt.sqlConnection = getConn();
stmt.addEventListener(SQLErrorEvent.ERROR, sqlError);
}
return this.stmt;
}

/**
* 关闭声明
**/
private functio


相关文档:

Windows Mobile下访问Sqlite的Native C++封装

背景
当前移动设备开发领域,在本地数据存储方面,Sqlite几乎成了事实标准,Andriod (android.database.sqlite),iPhone (SQLite for iPhone SDK 和 FMDB for iPhone),Palm WebOS (webOS SQL Tutorial),新版本的Symbian也直接built-in Sqlite了(20 million Symbian smartphones shipped in Q3 2007 Newer versions of th ......

SQLite不支持的SQL语法总结


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条记录开始,往后 ......

SQLITE SQL语句的注意


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条记录开始,往后 ......

SQLite启动事物

事务(DbTransaction):
SQLite 缺省为每个操作启动一个事务,所以成批插入的时候,启动事务,比不启动事务快n倍。
在没启动事务之前往Sqlite数据库里插入1000多条数据的情况,结果每次都需要一两分钟才能完成.
而在启动事物以后所需要的时间直接变成不到2秒!原来sqlite花两分钟是由于ExecuteNonQuery方法执行时自己提交 ......

SQLite数据库的挂接及常用命令

安装:
官方网站下载最新的sqlite版本
官方网站: http://www.sqlite.org/
下载地址为: http://www.sqlite.org/download.html
官方的下载页面提供了很多版本的下载…这里介绍一下;
Source Code: 源代码版本的下载
Documentation:  相关文档
Precompiled Binaries for Linux / Precompiled Binaries For Mac ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号