$Revision: 1.42 $
SQL module (sq) - this is a MySQL implementation of the SQL module.
Status: NOT REVUED, TESTED
Included Files
pthread_mutex_t Lock
int SQ_abort_query ( MYSQL* sql_connection )
Call this function to close a connection to the server
SQ_connection_t *sql_connection The connection to the database.
More:
Authors:
ottrey
- Online References:
void SQ_close_connection ( MYSQL* sql_connection )
MYSQL* SQ_duplicate_connection ( MYSQL* orig )
Get the error number for the last error.
SQ_connection_t *sql_connection The connection to the database.
More:
Authors:
ottrey
- Online References:
int SQ_errno ( MYSQL* sql_connection )
Get the error string for the last error.
SQ_connection_t *sql_connection The connection to the database.
More:
Authors:
ottrey
- Online References:
char* SQ_error ( MYSQL* sql_connection )
Returns a copy of the string passed that has been escaped so it
may be safely used in SQL strings.
Return values
Escaped string (allocated memory which must be freed)
More:
Authors:
shane
- Online References:
char* SQ_escape_string ( MYSQL* sql_connection, char* str )
Execute the sql query.
SQ_connection_t *sql_connection Connection to database.
SQ_result_set_t *result ptr to the structure to hold result.
May be NULL if no result is needed.
Returns:
0 if the query was successful.
Non-zero if an error occured.
More:
Authors:
ottrey, andrei, marek
- Online References:
int SQ_execute_query ( MYSQL* sql_connection, const char* query, MYSQL_RES** result_ptr )
- MYSQL* sql_connection
- &nbs;
- const char* query
- SQL query.
- MYSQL_RES** result_ptr
- &nbs;
int SQ_execute_query_nostore ( MYSQL* sql_connection, const char* query, MYSQL_RES** result_ptr )
Free the result set.
SQ_result_set_t *result The results.
More:
Authors:
ottrey
- Online References:
void SQ_free_result ( MYSQL_RES* result )
Get the row count of a table
char *table The table to be examined
More:
Authors:
marek
int SQ_get_affected_rows ( MYSQL* sql_connection )
Get the column count.
SQ_result_set_t *result The results from the query.
More:
Authors:
ottrey
- Online References:
int SQ_get_column_count ( MYSQL_RES* result )
Get an integer from the column.
SQ_result_set_t *result The results.
SQ_row_t *current_row The current row.
returns -1 if error occurs, 0 otherwise.
Note - it never says what error occured....
More:
Authors:
ottrey
- Online References:
int SQ_get_column_int ( MYSQL_RES* result, MYSQL_ROW* current_row, unsigned int column, long* resultptr )
- MYSQL_RES* result
- &nbs;
- MYSQL_ROW* current_row
- &nbs;
- unsigned int column
- The column index.
- long* resultptr
- pointer where the result should be stored
Get the column label.
SQ_result_set_t *result The results from the query.
More:
Authors:
ottrey
- Online References:
char* SQ_get_column_label ( MYSQL_RES* result, unsigned int column )
- MYSQL_RES* result
- &nbs;
- unsigned int column
- The column index.
Get the max length of the column.
SQ_result_set_t *result The results from the query.
More:
Authors:
ottrey
- Online References:
unsigned int SQ_get_column_max_length ( MYSQL_RES* result, unsigned int column )
- MYSQL_RES* result
- &nbs;
- unsigned int column
- The column index.
Get the column string.
SQ_row_t *current_row The current row (obtained from a SQ_row_next() ).
More:
Authors:
ottrey
- Online References:
char* SQ_get_column_string ( MYSQL_RES* result, MYSQL_ROW* current_row, unsigned int column )
- MYSQL_RES* result
- &nbs;
- MYSQL_ROW* current_row
- &nbs;
- unsigned int column
- The column index.
char* SQ_get_column_string_nocopy ( MYSQL_RES* result, MYSQL_ROW* current_row, unsigned int column )
Get the all the strings in one column.
SQ_result_set_t *result The results.
More:
Authors:
ottrey
- Online References:
char* SQ_get_column_strings ( MYSQL_RES* result, unsigned int column )
- MYSQL_RES* result
- &nbs;
- unsigned int column
- The column index.
Get a connection to the database.
More:
Authors:
ottrey
- Online References:
MYSQL* SQ_get_connection ( const char* host, unsigned int port, const char* db, const char* user, const char* password )
Get additional information about the most
recently executed query.
SQ_connection_t *sql_connection The connection to the database.
int info[3] array of integers where information is stored
The meaning of the numbers returned depends on the query type:
info[SQL_RECORDS] - # of Records for INSERT
info[SQL_MATCHES] - # of Matches for UPDATE
info[SQL_DUPLICATES] - # of Duplicates
info[SQL_WARNINGS] - # of Warnings
More:
Authors:
andrei
- Online References:
int SQ_get_info ( MYSQL* sql_connection, int info[3] )
Get the ID that was most recently generated for an AUTO_INCREMENT field
More:
Authors:
andrei
long SQ_get_insert_id ( MYSQL* sql_connection )
Get the row count of a table
More:
Authors:
marek
int SQ_get_table_size ( MYSQL* sql_connection, char* table )
- MYSQL* sql_connection
- &nbs;
- char* table
- The table to be examined
Convert all available information about the sql server into a string.
SQ_connection_t *sql_connection The connection to the database.
More:
Authors:
ottrey
- Online References:
char* SQ_info_to_string ( MYSQL* sql_connection )
Prototyped in:
| /home/shane/code/RIP/include/mysql_driver.h
|
Calls:
| UT_strdup_real(), g_string_append(), g_string_free(), g_string_sized_new(), g_string_sprintfa(), mysql_dump_debug_info(), mysql_errno(), mysql_error(), mysql_get_client_info(), mysql_get_host_info(), mysql_get_proto_info(), mysql_get_server_info(), mysql_info(), mysql_ping(), mysql_stat(), mysql_thread_id()
|
Call this function to find out how many rows are in a query result
SQ_result_set_t *result The results.
More:
Authors:
ottrey
- Online References:
int SQ_num_rows ( MYSQL_RES* result )
Checks whether or not the connection to the server is working.
If it has gone down, an automatic reconnection is attempted.
Return values
Zero if the server is alive. Non-zero if an error occurred.
More:
Authors:
andrei
- Online References:
int SQ_ping ( MYSQL* sql_connection )
Convert the result set to a string.
SQ_result_set_t *result The results.
More:
Authors:
ottrey
- Online References:
char* SQ_result_to_string ( MYSQL_RES* result )
Get the next row.
SQ_result_set_t *result The results from the query.
unsigned int column The column index.
More:
Authors:
ottrey
- Online References:
MYSQL_ROW* SQ_row_next ( MYSQL_RES* result )
er_ret_t SQ_try_connection ( MYSQL** conn, const char* host, unsigned int port, const char* db, const char* user, const char* password )
long sq_get_minmax_id ( MYSQL* sql_connection, char* id_name, char* table, int max )
static char* asctime_r ( const struct tm* __tm, char* __buf )
static char* ctime_r ( const time_t* __time, char* __buf )
static int getlogin_r ( char* __name, int __len )
static int readdir_r ( DIR* __dp, struct dirent* __ent, struct dirent** __res )
static int sigwait ( const sigset_t* __setp, int* __signo )
static int ttyname_r ( int __fildes, char* __buf, size_t __size )