Sqlite判断字段存在
判断表存在的方法很简单,网上很多:
SELECT COUNT(*) from sqlite_master where type='table' and name='%s'" % tname;
那么判断字段是否存在, 或者说如何判断表的版本是否最新就只需要:
select * from sqlite_master where tbl_name='tblContactList';
sqlite_master 的表结构如下:
type |name |tbl_name |rootpage |sql
最后一个sql就是创建tblContactList表的sql语句, 所以只要判断这个sql语句是否和你的创建语句一样就可以知道该表是不是你最新的版本.
相关文档:
在SQLite on BlackBerry上,JDBC访问数据库,缺省是以UTF-8保存数据到数据库里面的,每个中文通常是3个字节保存到数据库上面的。
例子代码参考:
BlackBerry sample - SQLiteDemo。
注意:在插入中文的时候,请使用Statement.bind指令,在我的测试中,可以很好的保存中文数据。读取的时候只需要使用Result ......
我现在要使用SQLite3.0创建一个数据库,然后在数据库中创建一个表格。
首先要引入SQLite3.0的lib库。然后包含头文件#import <sqlite3.h>
【1】打开数据库,如果没有,那么创建一个
sqlite3* database_;
-(BOOL) open{
NSArray *paths = NSSearchPathForDirectoriesInDomai ......
AutoIt3开发的操作SQlite数据库的源码下载
部分源码
_SQLite_Startup () ;加载 SQLite.dll
If Not FileExists($SQLite_Data_Path) Then
SQLCreate()
EndIf
$GUI_Form = GUICreate($Title, 300, 435, -1, -1)
GUISetBkColor(0xECE9D8) ; will change background color
$GUI_ListBox = GUIC ......
********创建***********
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
public class DataBaseOpenHelper extends SQLiteOpenHelper {
public static fi ......