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
相关文档:
/*=================================
.* The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.* The extend include file.
.*
.*===============================*/
#include "sqlit ......
本篇文章来源于:开发学院 http://edu.codepub.com 原文链接:http://edu.codepub.com/2009/0825/14358.php
SQLite是个典型的嵌入式DBMS,它有很多优点,它是轻量级的,在编译之后很小,其中一个原因就是在查询优化方面比较简单,它只是运用索引机制来进行优化的,经过对SQLite的查询优化的分析以及对源代码的 ......
SQLite
的最新版本可以从这里下载
。下面我们以Windows版本sqlite-3_5_1.zip
为例介绍其安装方法。
(大家可以选择下载安装适合自己的版本)
下载后,将sqlite-3_5_1.zip解压缩至C:\sqlite目录即完成安装。
C:\sqlite目录构造为:
C:\sqlite
|
+--sqlite3.exe
打开一个CMD命令窗口
C:\ ......
今天很自然的在写Sql语句的时候用了Top,一开始没发现问题,因为我从数据库读出的值正好是0,而我习惯变量定义的时候也都赋值0,可是到我不要0的时候我就发现问题了。后来才知道,可爱的小sqlite竟然有不支持的sql语法。
看到某个论坛有个新手也发现了这个问题并发帖了,下面一牛人的回复是“top是哪家的关键词?s ......
//搜集整理了一下网上的代码.找了半天居然找不到一条插入语句.好郁闷的
//感觉速度还可以.小文件.很多小应用程序在用这个数据库
//SQLite使用办法.直接COPYDLL文件System.Data.SQLite.DLL到应用程序DEBUG目录下。 然后在项目中添加引用,找到这个文件即可
//添加引用
using System;
using System.Collections.Generic;
......