xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
结构体 | Public 成员函数 | 静态 Public 成员函数 | 静态 Public 属性 | 包函数 | 包属性 | 静态包属性
Sqlite类 参考
类 Sqlite 继承关系图:
Connection

结构体

class  CSTDNative
 
class  Native
 
class  SqlitePreparedStatement
 
class  SqliteRegister
 
class  SqliteResultSet
 

Public 成员函数

静态 Public 成员函数

静态 Public 属性

包函数

包属性

静态包属性

额外继承的成员函数

详细描述

在文件 Sqlite.xcsm5 行定义.

成员函数说明

◆ close()

void close ( )
override

实现了 Connection.

在文件 Sqlite.xcsm185 行定义.

185 {
186 if (hdb != 0){
187 Native.sqlite3_close(hdb);
188 hdb = 0;
189 }
190 }
long hdb
Definition Sqlite.xcsm:130

引用了 hdb.

被这些函数引用 finalize().

◆ commit()

int commit ( )

在文件 Sqlite.xcsm212 行定义.

212 {
213 return execute("COMMIT;");
214 }
int execute(String stmt)
Definition Sqlite.xcsm:230

引用了 execute().

◆ create()

void create ( String  uri,
String  username,
String  pwd 
)
override

实现了 Connection.

在文件 Sqlite.xcsm132 行定义.

132 {
133 int err = Native.sqlite3_open(uri, hdb);
134 if (err != 0){
135 throw new Sql.SqlException(err, "can not open database:" + uri);
136 }
137 /*if (pwd != nilptr){
138 err = Native.sqlite3_key(hdb, pwd, pwd.length());
139 if (err != 0){
140 throw new Sql.SqlException(err, "password incorrect");
141 }
142 }*/
143 }
Definition xsql.xcs:3

引用了 hdb.

◆ createStatement()

Sql.Statement createStatement ( )
override

实现了 Connection.

在文件 Sqlite.xcsm173 行定义.

173 {
174 return new SqlitePreparedStatement(this);
175 }

◆ enableSycnhronous()

int enableSycnhronous ( int  n)

在文件 Sqlite.xcsm200 行定义.

200 {
201 if (n < 0 || n > 2){
202 return -1;
203 }
204 String [] cof = {"FULL", "NORMAL", "OFF"};
205 return execute("PRAGMA synchronous = " + cof[n] + ";");
206 }
字符串类

引用了 execute().

◆ execute()

int execute ( String  stmt)

在文件 Sqlite.xcsm230 行定义.

230 {
231 if (hdb != 0){
232 long msg = 0;
233 int err = Native.sqlite3_exec(hdb, stmt, (long)0, (long)0, msg);
234 if (err != 0){
236 }
237 return err;
238 }
239 throw new Sql.SqlException(-1, "database not opened");
240 return -1;
241 }
void throw_sqlite_error()
Definition Sqlite.xcsm:153

引用了 hdb , 以及 throw_sqlite_error().

被这些函数引用 commit(), enableSycnhronous(), Sqlite.SqlitePreparedStatement.execute(), Sqlite.SqlitePreparedStatement.executeUpdate(), rollback() , 以及 workBegin().

◆ finalize()

void finalize ( )
package

在文件 Sqlite.xcsm192 行定义.

192 {
193 close();
194 }
void close() override
Definition Sqlite.xcsm:185

引用了 close().

◆ generateErrorText()

String generateErrorText ( long  herr,
String  fallback 
)

在文件 Sqlite.xcsm220 行定义.

220 {
221 if (herr != 0){
222 long len = CSTDNative.strlen(herr);
223 byte [] data = new byte[len + 1];
224 CSTDNative.memcpy(data, herr, len);
225 return new String(data, 0, len);
226 }
227 return fallback;
228 }

◆ get_changes()

int get_changes ( )

在文件 Sqlite.xcsm243 行定义.

243 {
244 return Native.sqlite3_changes(hdb);
245 }

引用了 hdb.

被这些函数引用 Sqlite.SqlitePreparedStatement.get_changes().

◆ getDb()

long getDb ( )

在文件 Sqlite.xcsm260 行定义.

260 {
261 return hdb;
262 }

引用了 hdb.

◆ getError()

String getError ( )
override

实现了 Connection.

在文件 Sqlite.xcsm160 行定义.

160 {
161 return Native.sqlite3_errmsg(hdb);
162 }

引用了 hdb.

被这些函数引用 throw_sqlite_error().

◆ getErrorCode()

int getErrorCode ( )
override

实现了 Connection.

在文件 Sqlite.xcsm156 行定义.

156 {
157 return Native.sqlite3_errcode(hdb);
158 }

引用了 hdb.

被这些函数引用 throw_sqlite_error().

◆ getLastInsertedRowId()

long getLastInsertedRowId ( )

在文件 Sqlite.xcsm181 行定义.

181 {
182 return Native.sqlite3_last_insert_rowid(hdb);
183 }

引用了 hdb.

◆ getOption()

Object getOption ( int  opt)
override

实现了 Connection.

在文件 Sqlite.xcsm164 行定义.

164 {
165 throw new Sql.DatabaseNotSupportException("getOption");
166 return nilptr;
167 }

◆ isClosed()

bool isClosed ( )
override

实现了 Connection.

在文件 Sqlite.xcsm177 行定义.

177 {
178 return hdb != 0;
179 }

引用了 hdb.

◆ prepare()

long prepare ( String  sql)

在文件 Sqlite.xcsm247 行定义.

247 {
248 long nstmt = 0;
249 if (hdb != 0){
250 int err = Native.sqlite3_prepare_v2(hdb, sql, sql.length(), nstmt, nilptr);
251 if (err != 0 || nstmt == 0){
253 }
254 return nstmt;
255 }
256 throw new Sql.SqlException(-1, "database not opened");
257 return nstmt;
258 }
int length()

引用了 hdb, String.length() , 以及 throw_sqlite_error().

被这些函数引用 Sqlite.SqlitePreparedStatement.executeQuery() , 以及 Sqlite.SqlitePreparedStatement.SqlitePreparedStatement().

◆ prepareStatement()

Sql.PreparedStatement prepareStatement ( String  sql)
override

实现了 Connection.

在文件 Sqlite.xcsm169 行定义.

169 {
170 return new SqlitePreparedStatement(this, sql);
171 }

◆ registry()

static bool registry ( )
static

在文件 Sqlite.xcsm8 行定义.

8 {
9 if (Native.init()){
10 Sql.Database.reigstry(DRIVERNAME, new SqliteRegister());
11 return true;
12 }
13 return false;
14 }
static bool reigstry(String name, ConnectionRegister reg)
Definition xsql.xcs:210
static const String DRIVERNAME
Definition Sqlite.xcsm:6

引用了 DRIVERNAME , 以及 Database.reigstry().

◆ rollback()

int rollback ( )

在文件 Sqlite.xcsm216 行定义.

216 {
217 return execute("ROLLBACK;");
218 }

引用了 execute().

◆ setOption()

void setOption ( int  opt,
Object  option 
)
override

设置参数

@Exception : SqlException

实现了 Connection.

在文件 Sqlite.xcsm149 行定义.

149 {
150 throw new Sql.DatabaseNotSupportException("setOption");
151 }

◆ throw_sqlite_error()

void throw_sqlite_error ( )

◆ workBegin()

int workBegin ( )

在文件 Sqlite.xcsm208 行定义.

208 {
209 return execute("BEGIN;");
210 }

引用了 execute().

结构体成员变量说明

◆ DRIVERNAME

const String DRIVERNAME = "sqlite"
staticpackage

在文件 Sqlite.xcsm6 行定义.

被这些函数引用 registry().

◆ hdb

long hdb = 0
package

◆ registried

bool registried = registry()
staticpackage

在文件 Sqlite.xcsm129 行定义.

◆ SYNCHRONOUS_FULL

const int SYNCHRONOUS_FULL = 2
static

在文件 Sqlite.xcsm196 行定义.

◆ SYNCHRONOUS_NORMAL

const int SYNCHRONOUS_NORMAL = 1
static

在文件 Sqlite.xcsm197 行定义.

◆ SYNCHRONOUS_OFF

const int SYNCHRONOUS_OFF = 0
static

在文件 Sqlite.xcsm198 行定义.