易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

SQLite3的C编程

/*=================================
.*  The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.*  The extend include file.
.*
.*===============================*/
#include "sqlit ......

SQLite用触发器来替代外键约束

SQLite用触发器来替代外键约束 CREATE TABLE [Category] (
  [Pkid] INTEGER  PRIMARY KEY AUTOINCREMENT NOT NULL,
  [CategoryName] NVARCHAR(32)  NOT NULL,
  [CategoryGuid] char(36)  UNIQUE NOT NULL,
  [CategoryDesc] nvarchar(256)  NULL
) C ......

做个标记,在Android中使用网络下载的sqlite文件

先记下来:
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)) {
& ......

用vs2008编译出sqlite dll和lib (图解)

1:从sqlite的官网上下载源码 http://www.sqlite.org/download.html
2:打开vs2008工程新建一个空的dll工程。
3:把sqlite3.h,sqlite3.cpp,sqlite3.def分别加入到head file 和source file下。
4:编译程序。 这时只能得到sqlite3.dll文件。
5:打开vs2008自带的命令行: 切到sqlite3.def所在的目录。
 
6:运行 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号