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
Ïà¹ØÎĵµ£º
ÔÙ˵ÔÚlinuxϽ¨Á¢.a ºÍµãso
µ½ÍøÕ¾ÏÂÔØ sqlite-amalgamation-3.6.22.tar.gz Õâ¸ö°ü£¬·´ÕýÎÒÏÂÁËsqlite3-3.6.22.bin.gz½âѹºó±àÒë²»ÁË¡£
½âѹ£¬ÔËÐÐ
# ./configure --host=armv5l-linux --prefix=/opt/sqlite3/arm --enable-threadsafe.
......
/*=================================
.* The Standard include file.
.*
.*===============================*/
#include <stdio.h>
#include <stdlib.h>
/*=================================
.*
.* The extend include file.
.*
.*===============================*/
#include "sqlit ......
±³¾°
µ±Ç°Òƶ¯É豸¿ª·¢ÁìÓò£¬ÔÚ±¾µØÊý¾Ý´æ´¢·½Ã棬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
ÌØµã
1.Ö§³ÖÎåÖÖÊý¾ÝÀàÐÍ null,INTEGER,REAL(¸¡µãÊý),TEXT(×Ö·û´®Îı¾)ºÍBLOB£¨¶þ½øÖÆÎı¾£©Êý¾ÝÀàÐÍ£¬ËäÈ»
ËüÖ»ÓÐÎåÖÖ£¬µ«Êµ¼ÊÉÏsqlite3Ò²½ÓÊÖvarcher(n),char(n),decimal(p,s)µÈÊý¾ÝÀàÐÍ£ ......
//ËѼ¯ÕûÀíÁËÒ»ÏÂÍøÉϵĴúÂë.ÕÒÁ˰ëÌì¾ÓÈ»ÕÒ²»µ½Ò»Ìõ²åÈëÓï¾ä.ºÃÓôÃÆµÄ
//¸Ð¾õËÙ¶È»¹¿ÉÒÔ.СÎļþ.ºÜ¶àСӦÓóÌÐòÔÚÓÃÕâ¸öÊý¾Ý¿â
//SQLiteʹÓð취.Ö±½ÓCOPYDLLÎļþSystem.Data.SQLite.DLLµ½Ó¦ÓóÌÐòDEBUGĿ¼Ï¡£ È»ºóÔÚÏîÄ¿ÖÐÌí¼ÓÒýÓÃ,ÕÒµ½Õâ¸öÎļþ¼´¿É
//Ìí¼ÓÒýÓÃ
using System;
using System.Collections.Generic;
......