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语句是否和你的创建语句一样就可以知道该表是不是你最新的版本.
相关文档:
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 ......
android 的sqlite 主键与simpleCursorAdapter
最近在在做一个小例子时,出现一个小问题,就是不能显示从数据库中查出的数据,后来在网上查了一查,才知道原来是这个问题。
在使用simpleCursorAdapter显示sqlite数据时,必须注意sqlite的主键命名。由于simpleCursorAdapter的方法只识别_id,所以,当你用到sql ......
package com.jiao.sqlite;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widg ......
sqlite时间函数(转)
2007年12月10日 星期一 13:33
转贴原因:最近设计了一个跨数据库的函数,来测试测试sqlite。
SQLite分页显示:Select * from news order by id
desc Limit 10 Offset 10
这篇文章是根据 SQLite 官方 WIKI 里的内容翻译,如果有什么翻译不当的地方希望大家指出,毕竟我的英文水平实在很差。 SQ ......