1    | /***************************************
2    |   $Revision: 1.7 $
3    | 
4    |   SQL module (sq) - MySQL implementation of SQL driver.
5    | 
6    |   Status: NOT REVUED, NOT TESTED
7    | 
8    |   ******************/ /******************
9    |   Copyright (c) 1999                              RIPE NCC
10   |  
11   |   All Rights Reserved
12   |   
13   |   Permission to use, copy, modify, and distribute this software and its
14   |   documentation for any purpose and without fee is hereby granted,
15   |   provided that the above copyright notice appear in all copies and that
16   |   both that copyright notice and this permission notice appear in
17   |   supporting documentation, and that the name of the author not be
18   |   used in advertising or publicity pertaining to distribution of the
19   |   software without specific, written prior permission.
20   |   
21   |   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
22   |   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
23   |   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
24   |   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
25   |   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
26   |   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27   |   ***************************************/
28   | #ifndef READ_MYSQL_DRIVER
29   | #define READ_MYSQL_DRIVER
30   | 
31   | #include "mysql.h"
32   | 
33   | #define SQ_NOSTORE 0
34   | #define SQ_STORE   1
35   | 
36   | #define SQ_connection_t MYSQL
37   | #define SQ_result_set_t MYSQL_RES
38   | 
39   | #define SQ_row_t MYSQL_ROW
40   | 
41   | SQ_connection_t *sq_connection_init(void);
42   | SQ_connection_t *sq_connection_get(SQ_connection_t *sql_connection, const char *host, unsigned int port,const char *db, const char *user, const char *password);
43   | SQ_connection_t *SQ_get_connection(const char *host, unsigned int port, const char *db, const char *user, const char *password);
44   | SQ_connection_t *SQ_get_connection2(void);
45   | SQ_result_set_t *SQ_execute_query(int store_or_not, 
46   | 				  SQ_connection_t *sql_connection, 
47   | 				  const char *query);
48   | int SQ_get_column_count(SQ_result_set_t *result);
49   | char *SQ_get_column_label(SQ_result_set_t *result, unsigned int column);
50   | unsigned int SQ_get_column_max_length(SQ_result_set_t *result, unsigned int column);
51   | SQ_row_t *SQ_row_next(SQ_result_set_t *result);
52   | char *SQ_get_column_string(SQ_result_set_t *result, SQ_row_t *current_row, unsigned int column);
53   | char *SQ_get_column_strings(SQ_result_set_t *result, unsigned int column);
54   | int SQ_get_column_int(SQ_result_set_t *result, SQ_row_t *current_row, unsigned int column);
55   | char *SQ_result_to_string(SQ_result_set_t *result);
56   | void SQ_free_result(SQ_result_set_t *result);
57   | SQ_connection_t *SQ_connect_to_server (char *host,char *user,char *passwd,char *db,uint port);
58   | void SQ_close_connection(SQ_connection_t *sql_connection);
59   | SQ_result_set_t *SQ_query_server(SQ_connection_t *sql_connection, char *query);
60   | int SQ_num_rows(SQ_result_set_t *result);
61   | char *SQ_info_to_string(SQ_connection_t *sql_connection);
62   | char *SQ_error(SQ_connection_t *sql_connection);
63   | int SQ_errno(SQ_connection_t *sql_connection);
64   | 
65   | #endif /* READ_MYSQL_DRIVER */