易截截图软件、单文件、免安装、纯绿色、仅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与ACCESS性能简单测试对比

这段时间在做CMS(客户管理系统,不是内容管理)的访问管理功能,要求实现对服务提供设备,客户端,计费,权限认证等信息的存储统计,远程管理。要求系统发布要方便,远程管理软件要跑在WIN平台。考虑到系统规模,客户要求,最后选择了WIN+ACCESS的方案,而最近又发现一个免费的SQLITE,而且可能在以后的手持设备上用,花点 ......

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

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

SQLite支持的数据类型(日期函数)


SQLite驱动支持的SQL 列类型
类型描述
TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, BYTEA
不限制长度的字符串类型. 二进制数据必须安全地编码存储, 见text类型.
CHAR(), VARCHAR(), TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT
不限制长度的字符串类型. 不会被截断或者填充
ENUM
不限制长度的字符串类型. 不像 MySQL, 使用 ......

SQLite使用

OS X自从10.4后把SQLite这套相当出名的数据库软件,放进了作业系统工具集里。OS X包装的是第三版的SQLite,又称SQLite3。这套软件有几个特色:
软件属于公共财(public domain),SQLite可说是某种「美德软件」(virtueware),作者本人放弃着作权,而给使用SQLite的人以下的「祝福」(blessing):
May you do good an ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号