易截截图软件、单文件、免安装、纯绿色、仅160KB

Unity3d 使用sqlite数据库

dbAccess.js
import System.Data; // we import our data class
import Mono.Data.SqliteClient; // we import our sqlite client

class dbAccess {
// variables for basic query access
private var connection : String;
private var dbcon : IDbConnection;
private var dbcmd : IDbCommand;
private var reader : IDataReader;

function OpenDB(p : String){
connection = "URI=file:" + p; // we set the connection to our database
dbcon = new SqliteConnection(connection);
dbcon.Open();
}

function BasicQuery(q : String, r : boolean){ // run a baic Sqlite query
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = q; // fill the command
reader = dbcmd.ExecuteReader(); // execute command which returns a reader
if(r){ // if we want to return the reader
return reader; // return the reader
}
}

function CreateTable(name : String, col : Array, colType : Array){ // Create a table, name, column array, column type array
var query : String;
query = "CREATE TABLE " + name + "(" + col[0] + " " + colType[0];
for(var i=1; i<col.length; i++){
query += ", " + col[i] + " " + colType[i];
}
query += ")";
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = query; // fill the command
reader = dbcmd.ExecuteReader(); // execute command which returns a reader

}

function InsertIntoSingle(tableName : String, colName : String, value : String){ // single insert
var query : String;
query = "INSERT INTO " + tableName + "(" + colName + ") " + "VALUES (" + value + ")";
dbcmd = dbcon.CreateCommand(); // create empty command
dbcmd.CommandText = query; // fill the command
reader = dbcmd.ExecuteReader(); // execute command which returns a reader
}

function InsertIntoSpecific


相关文档:

SQLite学习笔记

 SQLite学习笔记
1.查看有哪些数据库,显示数据库列表
show databases;
2.显示表的结构
方法一:
use student;
describe student;
方法二:
des student.student;
方法三:
show columns from student;
3.显示MYSQL的版本
select version();
4.显示库中的数据表
use  mysql;
show tables;
5.建库 ......

SQLite操作指南(SQLite version 3.6.21)

1、.back ?DB? FILE  备份DB(默认为main)到文件
2、.bail ON|OFF  遇到一个错误扣停止,该值默认为OFF
3、.databases  列举附加到数据库的数据库名和文件名
4、.dump ?TABLE? ...  用SQL文本格式列举数据库,如果指定TABLE,仅仅列举匹配的表,LIKE类型TABLE
5、.echo ON|OFF  设置echo的状态 ......

SQLITE入门 逐步讲解SQLITE命令行(五)

.help 显示帮助信息
.import FILE TABLE 把文件中的数据导入到表中,各字段用separator(默认是"|")的值为分隔符,下面我们举个例子。 我们在F盘下建一个data.txt文件,内容如下:
4|开源
5|技术
.import命令操作如下:
sqlite> .import data.txt websites
sqlite>
查看结果如下:
sqlite> select * from ......

SQLITE入门 逐步讲解SQLITE命令行(六)


.nullvalue STRING 用STRING代替null值显示,不难理解,就不再累述了。
.output FILENAME 设置把查询输出到文件,后面的输出结果都保存到文件中,如:
sqlite> .mode list
sqlite> .output websites.txt
sqlite> select * from websites;
sqlite>
可以在F盘下发现建立了websites.txt文件,其内容如下:
......

Sqlite移植到ARM开发板

Sqlite3.3.8移植
1、下载sqlite-3.3.8.tar.gz源码包,解压tar –zxvf sqlite-3.3.8.tar.gz
2、Cd sqlite-3.3.8
3、手动修改makefile 文件,目录下有一个makefile案例文件: Makefile.linux-gcc
4、重命名一个Makefile文件,cp Makefile.linux-gcc Makefile
5、   打开Makefile文件:vi Makefile
6、&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号