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
相关文档:
先记下来:
FileOutputStream outputStream = openFileOutput("mydb", 0);
InputStream inputStream = response.getEntity().getContent();
byte[] data = new byte[bufferSize];
for (int i = inputStream.read(data); i > 0; i = inputStream
.read(data)) {
& ......
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
的最新版本可以从这里下载
。下面我们以Windows版本sqlite-3_5_1.zip
为例介绍其安装方法。
(大家可以选择下载安装适合自己的版本)
下载后,将sqlite-3_5_1.zip解压缩至C:\sqlite目录即完成安装。
C:\sqlite目录构造为:
C:\sqlite
|
+--sqlite3.exe
打开一个CMD命令窗口
C:\ ......
内存数据库FastDB和SQLite性能测评
作者:tamsyn
来源:www.sqlite.com.cn
时间:2009-10-21
一、引言
在很多项目中,经常会碰到这样的需求,需要对大量数据进行快速存储、查询、删除等操作,特别是在一些针对诸如运营商、银行等大型企业的应用中,这些 ......
本文以数据库中的数据表UserInfo为实例展示数据库表的创建及数据记录的录入。
#!/bin/sh
#variables definition
#database location
db=/conf/db
#
#create table userInfo
#name: User name
#passwd: Password
#Privilege: User privilege -- Administrator:0 Operator:1
#
echo "create table UserInfo(n ......