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

结构体

class  Helper
 
enum  MysqlOption
 
class  MysqlPreparedStatement
 
class  MysqlRegister
 
class  MysqlResultSet
 
class  MysqlStatement
 

Public 成员函数

静态 Public 成员函数

包函数

包属性

静态包属性

额外继承的成员函数

详细描述

在文件 Mysql.xcsm4 行定义.

成员函数说明

◆ close()

void close ( )
override

实现了 Connection.

在文件 Mysql.xcsm334 行定义.

334 {
335 //TODO:
336 if (_mysql != nilptr){
337 Helper.x_mysql_close(_mysql);
338 _mysql = nilptr;
339 }
340 }
byte [] _mysql
Definition Mysql.xcsm:7

引用了 _mysql.

被这些函数引用 finalize().

◆ create()

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

实现了 Connection.

在文件 Mysql.xcsm346 行定义.

346 {
347 //TODO:
348 byte [] __mysql = new byte[2048];
349
350
351 if (0l == Helper.x_mysql_init(__mysql)){
352 throw new Sql.SqlException(Helper.x_mysql_errno(__mysql), Helper.x_mysql_error(__mysql));
353 }
354
355 if (timeout != 0){
356 if (0 == Helper.x_mysql_options(__mysql,0,timeout)){
357 throw new Sql.SqlException(Helper.x_mysql_errno(__mysql), Helper.x_mysql_error(__mysql));
358 }
359 }
360
361 if (0l == Helper.x_mysql_real_connect(__mysql,uri,username,pwd,nilptr,port,nilptr,0)){
362 throw new Sql.SqlException(Helper.x_mysql_errno(__mysql), Helper.x_mysql_error(__mysql));
363 }
364 _mysql = __mysql;
365 }
int timeout
Definition Mysql.xcsm:10
int port
Definition Mysql.xcsm:9
Definition xsql.xcs:3

引用了 _mysql, port , 以及 timeout.

◆ createStatement()

Sql.Statement createStatement ( )
override

实现了 Connection.

在文件 Mysql.xcsm425 行定义.

425 {
426 return new MysqlStatement(this);
427 }

◆ finalize()

void finalize ( )
package

在文件 Mysql.xcsm342 行定义.

342 {
343 close();
344 }
void close() override
Definition Mysql.xcsm:334

引用了 close().

◆ getError()

String getError ( )
override

◆ getErrorCode()

int getErrorCode ( )
override

◆ getInfo()

String getInfo ( )

在文件 Mysql.xcsm385 行定义.

385 {
386 return Helper.x_mysql_info(_mysql);
387 }

引用了 _mysql.

◆ getOption()

Object getOption ( int  opt)
override

实现了 Connection.

在文件 Mysql.xcsm389 行定义.

389 {
390 //TODO:
391 throw new Sql.DatabaseNotSupportException("getOption");
392 return nilptr;
393 }

◆ getSqlState()

String getSqlState ( )

在文件 Mysql.xcsm381 行定义.

381 {
382 return Helper.x_mysql_state(_mysql);
383 }

引用了 _mysql.

◆ isClosed()

bool isClosed ( )
override

实现了 Connection.

在文件 Mysql.xcsm367 行定义.

367 {
368 //TODO:
369 return _mysql != nilptr;
370 }

引用了 _mysql.

◆ prepareStatement()

Sql.PreparedStatement prepareStatement ( String  sql)
override

实现了 Connection.

在文件 Mysql.xcsm429 行定义.

429 {
430 return new MysqlPreparedStatement(this, sql);
431 }

◆ registry()

static bool registry ( )
static

在文件 Mysql.xcsm28 行定义.

28 {
29 if (Helper.init()){
30 Sql.Database.reigstry(DRIVERNAME, new MysqlRegister());
31 return true;
32 }
33 return false;
34 }
static const String DRIVERNAME
Definition Mysql.xcsm:6
static bool reigstry(String name, ConnectionRegister reg)
Definition xsql.xcs:210

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

◆ setOption()

void setOption ( int  opt,
Object  option 
)
override

实现了 Connection.

在文件 Mysql.xcsm395 行定义.

395 {
396 switch(opt){
397 case MysqlOption.PORT:
398 port = (int)option;
399 break;
400 case MysqlOption.TIMEOUT:
401 timeout = (int)option;
402 break;
403 case MysqlOption.CHARSET:
404 if (_mysql == nilptr){
405 throw new Sql.SqlException(-1, "mysql not connected!");
406 }
407 if (0 != Helper.x_mysql_set_character_set(_mysql, (String)option)){
408 throw new Sql.SqlException(Helper.x_mysql_errno(_mysql), Helper.x_mysql_error(_mysql));
409 }
410 break;
411 case MysqlOption.SELECTDB:
412 if (_mysql == nilptr){
413 throw new Sql.SqlException(-1, "mysql not connected!");
414 }
415 if (0 != Helper.x_mysql_select_db(_mysql, (String)option)){
416 throw new Sql.SqlException(Helper.x_mysql_errno(_mysql), Helper.x_mysql_error(_mysql));
417 }
418 break;
419 default:
420 throw new Sql.DatabaseNotSupportException("setOption:" + opt);
421 break;
422 }
423 }
字符串类

引用了 _mysql, port , 以及 timeout.

结构体成员变量说明

◆ _mysql

byte [] _mysql
package

◆ DRIVERNAME

const String DRIVERNAME = "mysql"
staticpackage

在文件 Mysql.xcsm6 行定义.

被这些函数引用 registry().

◆ port

int port = 3306
package

在文件 Mysql.xcsm9 行定义.

被这些函数引用 create() , 以及 setOption().

◆ registried

bool registried = registry()
staticpackage

在文件 Mysql.xcsm116 行定义.

◆ timeout

int timeout = 0
package

在文件 Mysql.xcsm10 行定义.

被这些函数引用 create() , 以及 setOption().