Date: Thursday, December 15, 2005 @ 12:45:36
Author: zsolt
Path: /cvsroot/carob/libmysequoia/include
Modified: CarobMySQL.hpp (1.12 -> 1.13)
- changed the return value for function CarobMYSQL::next_result from bool to int
- reformatted the file with indent
----------------+
CarobMySQL.hpp | 134 +++++++++++++++++++++++++++++--------------------------
1 files changed, 71 insertions(+), 63 deletions(-)
Index: libmysequoia/include/CarobMySQL.hpp
diff -u libmysequoia/include/CarobMySQL.hpp:1.12
libmysequoia/include/CarobMySQL.hpp:1.13
--- libmysequoia/include/CarobMySQL.hpp:1.12 Thu Dec 15 11:33:47 2005
+++ libmysequoia/include/CarobMySQL.hpp Thu Dec 15 12:45:36 2005
@@ -42,8 +42,8 @@
class CarobMYSQL
{
public:
- CarobMYSQL(MYSQL *mysql, my_bool free_me);
- ~CarobMYSQL();
+ CarobMYSQL (MYSQL * mysql, my_bool free_me);
+ ~CarobMYSQL ();
/**
* Connect to sequoia through Carob. Initialize the corresponding fields
in the
@@ -61,10 +61,10 @@
* @return if the connection was successful return true otherwise false
* and set the corresponding mysql error
*/
- bool connect(const char *host, const char *user,
- const char *passwd, const char *db, unsigned int port,
- const char *unix_socket, unsigned long clientflag);
-
+ bool connect (const char *host, const char *user,
+ const char *passwd, const char *db, unsigned int port,
+ const char *unix_socket, unsigned long clientflag);
+
/**
* Modify the virtual database. If a lazy connection is ongoing then
* try to connect to the database
@@ -72,8 +72,8 @@
* @return if the connection was successful return true otherwise false
* and set the corresponding mysql error
*/
- bool select_db(const char *db);
-
+ bool select_db (const char *db);
+
/**
* Change the user or database. A default rollback will happen even if the
* user is the same. If the new user can't connect to the server, the
current
@@ -85,8 +85,8 @@
* @return if the connection was successful return true otherwise false
* and set the corresponding mysql error
*/
- bool change_user(const char *user, const char *passwd, const char *db);
-
+ bool change_user (const char *user, const char *passwd, const char *db);
+
/**
* Executes a query on the server. If a lazy connection is ongoing
* returns an error. If a query was n
@@ -94,9 +94,9 @@
* @param length the length of the query parameter
* @return true if the query was executed otherwise false and set the
* corresponding mysql error
- */
- bool real_query(const char *query, ulong length);
-
+ */
+ bool real_query (const char *query, ulong length);
+
/**
* Gets the result of the query in MYSQL_RES format, and set the
correspondent
* MYSQL fields. If fetch_all is specified it will fetch all rows from the
@@ -110,101 +110,105 @@
* if fetch_all was true will return a pointer to the newly
allocated
* results. The results must be fread after use with
free_results
* if fetch_all was false will return liveResultPtr
- */
- MYSQL_RES * get_results(my_bool fetch_all);
+ */
+ MYSQL_RES *get_results (my_bool fetch_all);
/**
* If a live query is ongoing return the next row from the result set.
* there are more results on the server
*/
- MYSQL_ROW fetch_row();
+ MYSQL_ROW fetch_row ();
/**
* In the case of multiple statement execution, returns true if
* there are more results on the server
*/
- bool more_results();
+ bool more_results ();
/**
* In the case of multiple statement execution, fetch the next result
from the
* server
- * @return true if the operation was successful
- */
- bool next_result();
-
+ * @return 0 for success
+ * -1 if there are no more results
+ * 1 if an error occured
+ */
+ int next_result ();
+
/**
* Free the stored results
* If res == liveResultPtr will close the query on the server
- */
- void free_results(MYSQL_RES *res);
-
+ */
+ void free_results (MYSQL_RES * res);
+
/**
* Return true if there are no more rows to fetch from the result set or
* there is no result set
*/
- bool eof();
-
+ bool eof ();
+
/**
* Set the autocommit mode. If autocommit is on then all SQL statements
will
* be executed and commited as individual transactions.
* @param mode - true set autocommit on
* false set autocommit off
* @return true on success otherwise false
- */
- bool set_autocommit(const my_bool mode);
-
+ */
+ bool set_autocommit (const my_bool mode);
+
/**
* Make all changes permanent since the previous commit/rollback
* @return true on success otherwise false
*/
- bool commit();
-
+ bool commit ();
+
/**
* Rollback all changes since the previous commit
* @return true on succes otherwise false
*/
- bool rollback();
-
+ bool rollback ();
+
/**
* List a table fields
* @param wild a regular expression mathing the field names
* @param table name of the table
* @return a MYSQL_RES with the name of the fields
*/
- MYSQL_RES *list_table_fields(const char *table, const char *wild);
-
+ MYSQL_RES *list_table_fields (const char *table, const char *wild);
+
/**
* List the databases names
* @param wild a regular expression matching the databases names
* @return MYSQL_RES with the name of the databases
*/
- MYSQL_RES *list_databases(const char *wild);
-
+ MYSQL_RES *list_databases (const char *wild);
+
/**
* List the table names in the current database
* @param wild a regular expression matching the tables names
* @return MYSQL_RES with the name of the tables
*/
- MYSQL_RES *list_tables(const char *wild);
-
+ MYSQL_RES *list_tables (const char *wild);
+
/**
* Returns a pointer to the MYSQL structure
- */
- MYSQL *getMYSQL();
+ */
+ MYSQL *getMYSQL ();
private:
- MYSQL *mysqlPtr;
- CarobNS::Connection *connectionPtr;
- CarobNS::ConnectionPool *connectionPool;
- CarobNS::Statement *stmtPtr;
- CarobNS::DriverResultSet *drsPtr;
- //holds the result set for 'live' type of results
- MYSQL_RES *liveResultPtr;
-
+ MYSQL * mysqlPtr;
+ CarobNS::Connection * connectionPtr;
+ CarobNS::ConnectionPool * connectionPool;
+ CarobNS::Statement * stmtPtr;
+ CarobNS::DriverResultSet * drsPtr;
+ //holds the result set for 'live' type of results
+ MYSQL_RES *liveResultPtr;
+
/**
* Private default constructor.
*/
- CarobMYSQL() {}
+ CarobMYSQL ()
+ {
+ }
/**
* Allocate and fill the MYSQL structure
@@ -214,21 +218,22 @@
* @param db name of the virtual database
* @param port number of the port
*/
- void set_connect_info(const char *host, const char *user,
- const char *passwd, const char *db, unsigned int port);
-
+ void set_connect_info (const char *host, const char *user,
+ const char *passwd, const char *db,
+ unsigned int port);
+
/**
* Delete and free the actual connection and it's associated resources
* @param free_mysql defines if the internal mysql structure is destroyed
*/
- void delete_connection();
-
+ void delete_connection ();
+
/**
* Set the current mysql error to the specified one. The mysql error message
will be filled from the error list.
* @param errcode mysql error code
* @param sqlstate ansi sql specific error code
*/
- void set_error(int errcode, int sqlstate);
+ void set_error (int errcode, int sqlstate);
/**
* Set the current mysql error to the specified one
@@ -236,7 +241,7 @@
* @param errmsg detailed mysql error message
* @param sqlstate ansi sql specific error message
*/
- void set_error(int errcode, const char *errmsg, const char *sqlstate);
+ void set_error (int errcode, const char *errmsg, const char *sqlstate);
/**
* Allocates the field info for a query
@@ -244,14 +249,15 @@
* @param drsPtr a pointer containing the driver resultset from sequoia
* @return numer of fields in the query
*/
- int get_query_fields(MYSQL_FIELD * &result, CarobNS::DriverResultSet
*rsPtr);
-
+ int get_query_fields (MYSQL_FIELD * &result,
+ CarobNS::DriverResultSet * rsPtr);
+
/**
* Release allocated field structure from the memory
* @param fields a pointer to the field structure
*/
- void delete_query_fields(MYSQL_FIELD * &fields, unsigned int field_count);
-
+ void delete_query_fields (MYSQL_FIELD * &fields, unsigned int field_count);
+
/**
* Allocates a row from the freshly fetched results
* @param row the resulting row
@@ -260,14 +266,16 @@
* @param length total length of the result
* @param lengths pointer to an array which will hold the length of each
field
*/
- void alloc_row_data(MYSQL_ROW &row, MYSQL_FIELD *fields, const unsigned int
field_count, unsigned long &length, unsigned long *lengths);
+ void alloc_row_data (MYSQL_ROW & row, MYSQL_FIELD * fields,
+ const unsigned int field_count, unsigned long &length,
+ unsigned long *lengths);
/**
* Release allocated row from the memory
* @param row a pointer containing the row with data
* @param field_count number of fields in the row
*/
- void delete_row_data(MYSQL_ROW &row, const unsigned int field_count);
+ void delete_row_data (MYSQL_ROW & row, const unsigned int field_count);
};
#endif /* _CAROBMYSQL_HPP */
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits