2 #include "../acl_cpp_define.hpp" 4 #include "../stdlib/string.hpp" 5 #include "../stdlib/noncopyable.hpp" 6 #include "../connpool/connect_client.hpp" 8 #if !defined(ACL_DB_DISABLE) 22 db_row(
const std::vector<const char*>& names);
30 const char* field_name(
size_t ifield)
const;
38 const char* field_value(
const char*
name)
const;
47 const char* operator[](
const char*
name)
const;
55 const char* field_value(
size_t ifield)
const;
63 const char* operator[](
size_t ifield)
const;
71 int field_int(
size_t ifield,
int null_value = 0)
const;
79 int field_int(
const char*
name,
int null_value = 0)
const;
89 #if defined(_WIN32) || defined(_WIN64) 90 __int64 field_int64(
size_t ifield, __int64 null_value = 0)
const;
92 long long int field_int64(
size_t ifield,
93 long long int null_value = 0)
const;
103 #if defined(_WIN32) || defined(_WIN64) 104 __int64 field_int64(
const char*
name, __int64 null_value = 0)
const;
106 long long int field_int64(
const char*
name,
107 long long int null_value = 0)
const;
117 double field_double(
size_t ifield,
double null_value = 0.0)
const;
126 double field_double(
const char*
name,
double null_value = 0.0)
const;
133 const char* field_string(
size_t ifield)
const;
140 const char* field_string(
const char*
name)
const;
147 size_t field_length(
size_t ifield)
const;
153 size_t field_length(
const char*
name)
const;
160 void push_back(
const char* value,
size_t len);
166 size_t length(
void)
const;
175 const std::vector<const char*>& names_;
178 std::vector<const char*> values_;
181 std::vector<size_t> lengths_;
200 const std::vector<const db_row*>& get_rows(
201 const char*
name,
const char* value);
208 const std::vector<db_row*>& get_rows()
const;
216 const db_row* operator[](
size_t idx)
const;
228 size_t length()
const;
245 void (*result_free)(
void* result);
274 virtual const char* dbtype()
const = 0;
291 return "unkonwn error";
299 virtual bool dbopen(
const char* charset = NULL) = 0;
305 virtual bool is_opened()
const = 0;
311 virtual bool tbl_exists(
const char* tbl_name) = 0;
317 virtual bool close() = 0;
327 virtual bool sql_select(
const char* sql,
db_rows* result = NULL) = 0;
335 virtual bool sql_update(
const char* sql) = 0;
385 virtual string& escape_string(
const char* in,
size_t len,
string& out);
391 virtual int affect_count()
const = 0;
400 const db_rows* get_result()
const;
409 const std::vector<const db_row*>* get_rows(
410 const char*
name,
const char* value);
417 const std::vector<db_row*>* get_rows()
const;
424 const db_row* get_first_row()
const;
441 const db_row* operator[](
size_t idx)
const;
447 size_t length()
const;
460 void print_out(
size_t max = 0)
const;
498 static void set_loadpath(
const char* path);
504 static const char* get_loadpath();
519 #endif // !defined(ACL_DB_DISABLE)
HTTP_API void const char * name
std::vector< const char * > names_
virtual int get_errno() const
std::vector< const db_row * > rows_tmp_
const char * get_id() const
virtual bool begin_transaction()
std::vector< db_row * > rows_
virtual const char * get_error() const