$Revision: 1.18 $
SQL module (sq) - this is a MySQL implementation of the SQL module.
Status: NOT REVUED, NOT TESTED
Included Files
- #include "include/memwrap.h"
- #include <include/erroutines.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <assert.h>
- #include <time.h>
- #include <stdarg.h>
- #include <strings.h>
- #include <include/bitmask.h>
- #include <include/er_aspects.h>
- #include <include/stubs.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include "include/er_facilities.h"
Preprocessor definitions
String sizes
#define STR_S 63
#define STR_M 255
#define STR_L 1023
#define STR_XL 4095
#define STR_XXL 16383
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 )
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 )
Execute the sql query.
SQ_connection_t *sql_connection Connection to database.
More:
Authors:
ottrey
- Online References:
MYSQL_RES* SQ_execute_query ( int store_or_not, MYSQL* sql_connection, const char* query )
- int store_or_not
-
- MYSQL* sql_connection
-
- const char* query
- SQL query.
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 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.
This uses atoi. So it may be advisable not to use it.
More:
Authors:
ottrey
- Online References:
int SQ_get_column_int ( MYSQL_RES* result, MYSQL_ROW* current_row, unsigned int column )
- MYSQL_RES* result
-
- MYSQL_ROW* current_row
-
- unsigned int column
- The column index.
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
-
- 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
-
- 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
-
- MYSQL_ROW* current_row
-
- unsigned int column
- The column index.
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
-
- unsigned int column
- The column index.
Prototyped in:
| modules/sq/mysql_driver.h
|
Calls:
| fprintf(), mysql_fetch_row(), sprintf(), strcat(), strcmp(), strcpy(), strlen(), wr_real_malloc()
|
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 )
MYSQL* SQ_get_connection2 ( void )
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:
| modules/sq/mysql_driver.h
|
Calls:
| fprintf(), mysql_dump_debug_info(), mysql_get_client_info(), mysql_get_host_info(), mysql_get_proto_info(), mysql_get_server_info(), mysql_list_processes(), mysql_ping(), mysql_stat(), sprintf(), strcat(), strcpy(), strlen(), wr_real_malloc()
|
Called by:
| command_sql() | modules/pc/protocol_config.c
|
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 )
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 )
Log the query. This should/will get merged with a tracing module.
More:
Authors:
ottrey
- Online References:
static void log_query ( const char* logfile, const char* query, struct timeb* start, struct timeb* stop )
Calls:
| fclose(), fopen(), fprintf(), printf(), strcmp()
|