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.
......
sqliteÊý¾Ý¿âµÚÈý·½javaÀ©Õ¹°üÏÂÔصØÖ·£ºhttp://www.zentus.com/sqlitejdbc/
ÓÐ2¸ö°ü£¬Ò»¸öÊÇnested£¨Ç¶ÈëʽµÄ£©£¬Ò»¸öÊÇnative(±¾µØµÄ)¡£
Çø±ðÔÚÓÚ:nested ²»ÐèÒª¶îÍâµÄdllÎļþ£¬µ«ÊÇËÙ¶ÈÂý¡£nativeÐèÒªÒ»¸ö¶îÍâµÄdllÎļþ£¬ËٶȺܿ졣
1.ʹÓÃnested°ü£ºsqlitejdbc-v037-nested.jar
java´úÂ룺
java ´úÂë
packa ......
Õª Òª: Óë³£¼ûµÄÊý¾Ý¿âÏà±È£¬Ç¶Èëʽ
Êý
¾Ý¿â¾ßÓÐÌå»ýС¡¢¹¦ÄÜÆ뱸¡¢¿ÉÒÆÖ²ÐÔ¡¢½¡×³ÐÔµÈÌص㣬±¾ÎÄ·ÖÎöºÍ±È½ÏÁ˵äÐ͵ÄǶÈëʽÊý¾Ý¿âSQLiteºÍBerkeley DB¡£Ê×ÏÈ´ÓÌåϵ½á¹¹¡¢×Óϵͳ
¼äµ÷ÓùØϵ¡¢ÈÎÎñÖ´Ðйý³ÌµÈ½Ç¶È¶ÔSQLiteºÍBerkeley DB½øÐÐÁËÏêϸ·ÖÎö£¬È»ºóÖصã´ÓÊý¾ÝÀàÐÍ¡¢´æ´¢·½Ê½¡¢Ä£Ê½¡¢Êý¾Ý¿âÒýÇ ......
Ç°Á½ÆªÈÕÖ¾ÎÒÒѾ×ܽáÁ˱¾µØÊý¾Ý´æ´¢µÄÇ°Á½ÖÖ£ºÎļþºÍÅäÖÃÏî¡£»¹Ê£ÏÂ×îºóÒ»ÖÖÊý¾Ý¿â´æ´¢——SQLite¡£
Ò»¡¢SQLite¼ò½é
ÔÚAndroidƽ̨ÉÏ£¬¼¯³ÉÁËÒ»¸öǶÈëʽ¹ØϵÐÍÊý¾Ý¿â—SQLite£¬SQLite3Ö§³Ö NULL¡¢INTEGER¡¢REAL£¨¸¡µãÊý×Ö£©¡¢TEXT(×Ö·û´®Îı¾)ºÍBLOB(¶þ½øÖƶÔÏó)Êý¾ÝÀàÐÍ£¬ËäÈ»ËüÖ§³ÖµÄÀàÐÍËäȻֻÓÐÎåÖÖ ......
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 ......