xlang v5.1 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
Mysql.MysqlPreparedStatement类 参考
类 Mysql.MysqlPreparedStatement 继承关系图:
Inheritance graph
Mysql.MysqlPreparedStatement 的协作图:
Collaboration graph

Public 成员函数

包属性

额外继承的成员函数

详细描述

在文件 Mysql.xcsm581 行定义.

构造及析构函数说明

◆ MysqlPreparedStatement()

MysqlPreparedStatement ( Mysql  m,
String  sql 
)

在文件 Mysql.xcsm587 行定义.

587 {
588 mysql = m;
589 hprepare_handle = Helper.create_statement_4x (m._mysql);
590
591 if (hprepare_handle != 0) {
592 argc = Helper.statement__prepare_4x (hprepare_handle, sql, sql.length() );
593
594 } else {
596 }
597 }
int getErrorCode() override
Definition Mysql.xcsm:861
byte [] _mysql
Definition Mysql.xcsm:87
String getError() override
Definition Mysql.xcsm:865
int length()

引用了 Mysql._mysql, Mysql.getError(), Mysql.getErrorCode() , 以及 String.length().

函数调用图:

成员函数说明

◆ close()

void close ( )
override

重载 Statement .

在文件 Mysql.xcsm812 行定义.

812 {
813 if (hprepare_handle != 0) {
814 Helper.close_statement_4x (hprepare_handle);
815 hprepare_handle = 0;
816 }
817 }

◆ execute() [1/2]

int execute ( )
override

重载 PreparedStatement .

在文件 Mysql.xcsm598 行定义.

598 {
599 if (0 != Helper.statement_execute_4x (hprepare_handle) ) {
600 throw new Sql.SqlException (mysql.getErrorCode(), Helper.get_statement_error_4x (hprepare_handle) );
601 }
602
603 if (mysql.return_option == MysqlOption.RET_CHANGES) {
604 return Helper.stmt_affected_rows_4x (hprepare_handle);
605 }
606
607 return 0;
608 }
int return_option
Definition Mysql.xcsm:91

引用了 Mysql.getErrorCode() , 以及 Mysql.return_option.

函数调用图:

◆ execute() [2/2]

int execute ( String  sql)
override

重载 Statement .

在文件 Mysql.xcsm618 行定义.

618 {
619 if (0 != Helper.x_mysql_query (mysql._mysql, sql) ) {
621 }
622
623 if (mysql.return_option == MysqlOption.RET_CHANGES) {
624 return Helper.get_affected_rows_4x (mysql._mysql);
625 }
626
627 return 0;
628 }

引用了 Mysql._mysql, Mysql.getError(), Mysql.getErrorCode() , 以及 Mysql.return_option.

函数调用图:

◆ executeQuery() [1/2]

Sql.ResultSet executeQuery ( )
override

重载 PreparedStatement .

在文件 Mysql.xcsm610 行定义.

610 {
611 if (0 != Helper.statement_execute_4x (hprepare_handle) ) {
612 throw new Sql.SqlException (mysql.getErrorCode(), Helper.get_statement_error_4x (hprepare_handle) );
613 }
614
615 return new MysqlPreparedResultSet (this, hprepare_handle);
616 }

引用了 Mysql.getErrorCode().

函数调用图:

◆ executeQuery() [2/2]

Sql.ResultSet executeQuery ( String  sql)
override

重载 Statement .

在文件 Mysql.xcsm630 行定义.

630 {
631 if (0 != Helper.x_mysql_query (mysql._mysql, sql) ) {
633 }
634
635 return getResult();
636 }
Sql.ResultSet getResult() override
Definition Mysql.xcsm:660

引用了 Mysql._mysql, Mysql.getError(), Mysql.getErrorCode() , 以及 Mysql.MysqlPreparedStatement.getResult().

函数调用图:

◆ executeUpdate() [1/2]

int executeUpdate ( )
override

重载 PreparedStatement .

在文件 Mysql.xcsm637 行定义.

637 {
638 if (0 != Helper.statement_execute_4x (hprepare_handle) ) {
639 throw new Sql.SqlException (mysql.getErrorCode(), Helper.get_statement_error_4x (hprepare_handle) );
640 }
641
642 if (mysql.return_option == MysqlOption.RET_CHANGES) {
643 return Helper.stmt_affected_rows_4x (hprepare_handle);
644 }
645
646 return 0;
647 }

引用了 Mysql.getErrorCode() , 以及 Mysql.return_option.

函数调用图:

◆ executeUpdate() [2/2]

int executeUpdate ( String  sql)
override

重载 Statement .

在文件 Mysql.xcsm648 行定义.

648 {
649 if (0 != Helper.x_mysql_query (mysql._mysql, sql) ) {
651 }
652
653 if (mysql.return_option == MysqlOption.RET_CHANGES) {
654 return Helper.get_affected_rows_4x (mysql._mysql);
655 }
656
657 return 0;
658 }

引用了 Mysql._mysql, Mysql.getError(), Mysql.getErrorCode() , 以及 Mysql.return_option.

函数调用图:

◆ get_changes()

int get_changes ( )
override

重载 PreparedStatement .

在文件 Mysql.xcsm804 行定义.

804 {
805 return Helper.stmt_affected_rows_4x (hprepare_handle);
806 }

◆ get_lastInsertId()

int get_lastInsertId ( )
override

重载 Statement .

在文件 Mysql.xcsm808 行定义.

808 {
809 return Helper.stmt_lastinserted_id_4x (hprepare_handle);
810 }

◆ getResult()

Sql.ResultSet getResult ( )
override

重载 Statement .

在文件 Mysql.xcsm660 行定义.

660 {
661 long res = Helper.x_mysql_store_result (mysql._mysql);
662
663 if (res != 0) {
664 return new MysqlResultSet (res);
665 }
666
667 return nilptr;
668 }

引用了 Mysql._mysql.

被这些函数引用 Mysql.MysqlPreparedStatement.executeQuery().

这是这个函数的调用关系图:

◆ setValue() [1/10]

void setValue ( byte  value)
override

重载 PreparedStatement .

在文件 Mysql.xcsm706 行定义.

706 {
707 if (param_index < argc) {
708 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, 0, 3) ) {
709 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
710 }
711 } else {
712 throw new Sql.SqlException (-1, "out of argc value:" + value);
713 }
714 }

◆ setValue() [2/10]

void setValue ( double  value)
override

重载 PreparedStatement .

在文件 Mysql.xcsm716 行定义.

716 {
717 if (param_index < argc) {
718 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, 0, 4) ) {
719 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
720 }
721 } else {
722 throw new Sql.SqlException (-1, "out of argc value:" + value);
723 }
724 }

◆ setValue() [3/10]

void setValue ( int  id,
byte  value 
)
override

重载 PreparedStatement .

在文件 Mysql.xcsm763 行定义.

763 {
764 if (id > 0 && id < (argc + 1) ) {
765 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, value, 0, 3) ) {
766 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
767 }
768 } else {
769 throw new Sql.SqlException (-1, "out of argc value:" + value);
770 }
771 }

◆ setValue() [4/10]

void setValue ( int  id,
double  value 
)
override

重载 PreparedStatement .

在文件 Mysql.xcsm773 行定义.

773 {
774 if (id > 0 && id < (argc + 1) ) {
775 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, value, 0, 4) ) {
776 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
777 }
778 } else {
779 throw new Sql.SqlException (-1, "out of argc value:" + value);
780 }
781 }

◆ setValue() [5/10]

void setValue ( int  id,
int  value 
)
override

重载 PreparedStatement .

在文件 Mysql.xcsm743 行定义.

743 {
744 if (id > 0 && id < (argc + 1) ) {
745 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, value, 0, 1) ) {
746 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
747 }
748 } else {
749 throw new Sql.SqlException (-1, "out of argc value:" + value);
750 }
751 }

◆ setValue() [6/10]

void setValue ( int  id,
long  value 
)
override

重载 PreparedStatement .

在文件 Mysql.xcsm753 行定义.

753 {
754 if (id > 0 && id < (argc + 1) ) {
755 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, value, 0, 2) ) {
756 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
757 }
758 } else {
759 throw new Sql.SqlException (-1, "out of argc value:" + value);
760 }
761 }

◆ setValue() [7/10]

void setValue ( int  id,
String  value 
)
override

重载 PreparedStatement .

在文件 Mysql.xcsm727 行定义.

727 {
728 if (id > 0 && id < (argc + 1) ) {
729 if (value == nilptr) {
730 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, nilptr, 0, 0xf) ) {
731 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
732 }
733 } else {
734 if (!Helper.bind_statement_param_4x (hprepare_handle, id - 1, value, value.length(), 0) ) {
735 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
736 }
737 }
738 } else {
739 throw new Sql.SqlException (-1, "out of argc value:" + value);
740 }
741 }

引用了 String.length().

函数调用图:

◆ setValue() [8/10]

void setValue ( int  value)
override

重载 PreparedStatement .

在文件 Mysql.xcsm686 行定义.

686 {
687 if (param_index < argc) {
688 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, 0, 1) ) {
689 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
690 }
691 } else {
692 throw new Sql.SqlException (-1, "out of argc value:" + value);
693 }
694 }

◆ setValue() [9/10]

void setValue ( long  value)
override

重载 PreparedStatement .

在文件 Mysql.xcsm696 行定义.

696 {
697 if (param_index < argc) {
698 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, 0, 2) ) {
699 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
700 }
701 } else {
702 throw new Sql.SqlException (-1, "out of argc value:" + value);
703 }
704 }

◆ setValue() [10/10]

void setValue ( String  value)
override

重载 PreparedStatement .

在文件 Mysql.xcsm670 行定义.

670 {
671 if (param_index < argc) {
672 if (value == nilptr) {
673 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, 0, 0xf) ) {
674 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
675 }
676 } else {
677 if (!Helper.bind_statement_param_4x (hprepare_handle, param_index++, value, value.length(), 0) ) {
678 throw new Sql.SqlException (-1, Helper.get_statement_error_4x (hprepare_handle) );
679 }
680 }
681 } else {
682 throw new Sql.SqlException (-1, "out of argc value:" + value);
683 }
684 }

引用了 String.length().

被这些函数引用 Mysql.MysqlPreparedStatement.setValues().

函数调用图:
这是这个函数的调用关系图:

◆ setValues()

void setValues ( Object []  args)
override

重载 PreparedStatement .

在文件 Mysql.xcsm784 行定义.

784 {
785 for (int i = 0; i < args.length; i++) {
786 if (args[i] == nilptr) {
787 setValue ( (String) nilptr);
788 } else if (args[i].instanceOf (String) ) {
789 setValue ( (String) args[i]);
790 } else if (args[i].instanceOf (int) ) {
791 setValue ( (int) args[i]);
792 } else if (args[i].instanceOf (long) ) {
793 setValue ( (long) args[i]);
794 } else if (args[i].instanceOf (byte) ) {
795 setValue ( (byte) args[i]);
796 } else if (args[i].instanceOf (double) ) {
797 setValue ( (double) args[i]);
798 } else {
799 throw new Sql.SqlException (-1, "sql unknow type:" + i);
800 }
801 }
802 }
void setValue(String value) override
Definition Mysql.xcsm:670
Definition String.x:5

引用了 Mysql.MysqlPreparedStatement.setValue().

函数调用图:

结构体成员变量说明

◆ argc

int argc = 0
package

在文件 Mysql.xcsm586 行定义.

◆ hprepare_handle

long hprepare_handle = 0
package

在文件 Mysql.xcsm583 行定义.

◆ mysql

Mysql mysql
package

在文件 Mysql.xcsm582 行定义.

◆ param_index

int param_index = 0
package

在文件 Mysql.xcsm584 行定义.