MCPcopy Create free account
hub / github.com/acl-dev/acl / sql_select

Method sql_select

lib_acl_cpp/src/db/db_mysql.cpp:941–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941bool db_mysql::sql_select(const char* sql, db_rows* result /* = NULL */)
942{
943 // ���ȵ��û��෽���ͷ��ϴεIJ�ѯ���
944 free_result();
945
946 if (!sane_mysql_query(sql)) {
947 return false;
948 }
949 MYSQL_RES *my_res = __mysql_store_result((MYSQL*) conn_);
950 if (my_res == NULL) {
951 if (__mysql_errno((MYSQL*) conn_) != 0) {
952 logger_error("db(%s), sql(%s) error(%s)",
953 dbname_.c_str(), sql, __mysql_error((MYSQL*) conn_));
954 close();
955 }
956 return false;
957 }
958
959 my_ulonglong nrow = __mysql_num_rows(my_res);
960 if (nrow <= 0) {
961 __mysql_free_result(my_res);
962 result_ = NULL;
963 return true;
964 }
965
966 if (result != NULL) {
967 mysql_rows_save(my_res, *result);
968 } else {
969 result_ = NEW db_rows();
970 mysql_rows_save(my_res, *result_);
971 }
972
973 return true;
974}
975
976bool db_mysql::sql_update(const char* sql)
977{

Callers

nothing calls this directly

Calls 5

sane_mysql_queryFunction · 0.85
mysql_rows_saveFunction · 0.85
closeFunction · 0.50
db_rowsClass · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected