做个标记,在Android中使用网络下载的sqlite文件
先记下来:
FileOutputStream outputStream = openFileOutput("mydb", 0);
InputStream inputStream = response.getEntity().getContent();
byte[] data = new byte[bufferSize];
for (int i = inputStream.read(data); i > 0; i = inputStream
.read(data)) {
outputStream.write(data, 0, i);
}
SQLiteDatabase database = SQLiteDatabase
.openOrCreateDatabase(getFileStreamPath(fileName)
.getAbsolutePath(), null);
Cursor cursor = database.rawQuery("select * from users",
new String[] {});
if (cursor.moveToFirst()) {
Log.i(TAG, "user name: " + cursor.getString(1));
}
database.close();
相关文档:
SQLite Database Browser
SQLite Database browser is a light GUI editor for SQLite databases, built on top of Qt. The main goal of the project is to allow non-technical users to create, modify and edit SQLite databases using a set of wizards and a spreadsheet-like interface.
Downlo ......
sqlite3 *db;
sqlite3_stmt *stat;
char
*zErrMsg = 0;
char
temp[256], FileRoot[256];
char
buffer2[1024]="0";
sprintf(temp, _T("%s"), _T("utf.db")) ......
1:常用接口
个人比较喜欢
sqlite,
使用最方便,唯一的准备工作是下载
250K
的源;而且作者很热心,有问必答。
以下演示一下使用
sqlite
的步骤,先创建一个数据库,然后查询其中的内容。
2
个重要结构体和
5
个主要函数:
sqlite3 &nbs ......
from within a C/C++ program (or a script using Tcl/Ruby/Perl/Python
bindings) you can get access to table and index names by doing a SELECT
on a special table named "SQLITE_MASTER
". Every SQLite database has an SQLITE_MASTER table that defines the schema for the database.
SQL code
S ......