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条记录开始,往后 ......
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官方网站例子:
#include <stdio.h>
#include <sqlite3.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
i ......
内存数据库FastDB和SQLite性能测评
作者:tamsyn
来源:www.sqlite.com.cn
时间:2009-10-21
一、引言
在很多项目中,经常会碰到这样的需求,需要对大量数据进行快速存储、查询、删除等操作,特别是在一些针对诸如运营商、银行等大型企业的应用中,这些 ......