TinyMUSH 3.3
TinyMUSH Server
Loading...
Searching...
No Matches
db_sql.h
Go to the documentation of this file.
1
16#ifndef __DB_SQL_H
17#define __DB_SQL_H
18
19#ifdef HAVE_MSQL
20
21#define SQL_DRIVER "mSQL"
22
23#include <msql.h> /* required by code */
24
25/* See db_sql.h for details of what each of these functions do. */
26
27/*
28 * Because we cannot trap error codes in mSQL, just error messages, we have
29 * to compare against error messages to find out what really happened with
30 * something. This particular error message is SERVER_GONE_ERROR in mSQL's
31 * errmsg.h -- this needs to change if that API definition changes.
32 */
33
34#define MSQL_SERVER_GONE_ERROR "MSQL server has gone away"
35
36/*
37 * Number of times to retry a connection if we fail in the middle of a query.
38 */
39
40#define MSQL_RETRY_TIMES 3
41#endif
42
43#ifdef HAVE_MYSQL
44
45#define SQL_DRIVER "MySQL"
46
47#include <mysql.h>
48#include <errmsg.h>
49
50/*
51 * Number of times to retry a connection if we fail in the middle of a query.
52 */
53#define MYSQL_RETRY_TIMES 3
54
55static MYSQL *mysql_struct = NULL;
56#endif
57
58#ifdef HAVE_PGSQL
59
60#define SQL_DRIVER "PostgreSQL"
61
62#include <libpq-fe.h>
63
64/* See db_sql.h for details of what each of these functions do. */
65
66
67/*
68 * Number of times to retry a connection if we fail in the middle of a query.
69 */
70
71#define PGSQL_RETRY_TIMES 3
72#define CONNECT_STRING_SIZE 512
73
74static PGconn *pgsql_struct = NULL;
75
76#endif
77
78#ifdef HAVE_SQLITE3
79
80#define SQL_DRIVER "SQLite3"
81
82#include <sqlite3.h>
83
84/* See db_sql.h for details of what each of these functions do. */
85
86/*
87 * Number of times to retry a connection if we fail in the middle of a query.
88 */
89
90#define SQLITE_RETRY_TIMES 3
91
92static sqlite3 *sqlite3_struct = NULL;
93
94#endif
95
96typedef struct {
97 char *host; /* IP address of SQL database */
98 char *db; /* Database to use */
99 char *username; /* Username for database */
100 char *password; /* Password for database */
101 int reconnect; /* Auto-reconnect if connection dropped? */
102 int port; /* Port of SQL database */
103 int socket; /* Socket fd for SQL database connection */
105
106extern mod_db_sql_confstorage mod_db_sql_config;
107
108#endif /* __DB_SQL_H */
OBJ * db
Definition: db.c:34
Definition: db_sql.h:96