mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-19 02:27:55 +08:00
Introduce MDB_BACKEND_* enum
This commit is contained in:
@@ -174,6 +174,16 @@ static MdbBackendType mdb_sqlite_types[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifndef JAVA
|
#ifndef JAVA
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MDB_BACKEND_ACCESS = 1,
|
||||||
|
MDB_BACKEND_ORACLE,
|
||||||
|
MDB_BACKEND_SYBASE,
|
||||||
|
MDB_BACKEND_POSTGRES,
|
||||||
|
MDB_BACKEND_MYSQL,
|
||||||
|
MDB_BACKEND_SQLITE,
|
||||||
|
};
|
||||||
|
|
||||||
static gboolean mdb_drop_backend(gpointer key, gpointer value, gpointer data);
|
static gboolean mdb_drop_backend(gpointer key, gpointer value, gpointer data);
|
||||||
|
|
||||||
static gchar*
|
static gchar*
|
||||||
@@ -573,18 +583,18 @@ mdb_get_relationships(MdbHandle *mdb, const gchar *dbnamespace, const char* tabl
|
|||||||
gchar *text = NULL; /* String to be returned */
|
gchar *text = NULL; /* String to be returned */
|
||||||
static char *bound[5]; /* Bound values */
|
static char *bound[5]; /* Bound values */
|
||||||
static MdbTableDef *table; /* Relationships table */
|
static MdbTableDef *table; /* Relationships table */
|
||||||
int backend = 0; /* Backends: 1=oracle, 2=postgres */
|
int backend = 0;
|
||||||
char *quoted_table_1, *quoted_column_1,
|
char *quoted_table_1, *quoted_column_1,
|
||||||
*quoted_table_2, *quoted_column_2,
|
*quoted_table_2, *quoted_column_2,
|
||||||
*constraint_name, *quoted_constraint_name;
|
*constraint_name, *quoted_constraint_name;
|
||||||
long grbit;
|
long grbit;
|
||||||
|
|
||||||
if (!strcmp(mdb->backend_name, "oracle")) {
|
if (!strcmp(mdb->backend_name, "oracle")) {
|
||||||
backend = 1;
|
backend = MDB_BACKEND_ORACLE;
|
||||||
} else if (!strcmp(mdb->backend_name, "postgres")) {
|
} else if (!strcmp(mdb->backend_name, "postgres")) {
|
||||||
backend = 2;
|
backend = MDB_BACKEND_POSTGRES;
|
||||||
} else if (!strcmp(mdb->backend_name, "sqlite")) {
|
} else if (!strcmp(mdb->backend_name, "sqlite")) {
|
||||||
backend = 3;
|
backend = MDB_BACKEND_SQLITE;
|
||||||
} else {
|
} else {
|
||||||
if (is_init == 0) { /* the first time through */
|
if (is_init == 0) { /* the first time through */
|
||||||
is_init = 1;
|
is_init = 1;
|
||||||
@@ -657,9 +667,9 @@ mdb_get_relationships(MdbHandle *mdb, const gchar *dbnamespace, const char* tabl
|
|||||||
" does not enforce integrity.\n", NULL);
|
" does not enforce integrity.\n", NULL);
|
||||||
} else {
|
} else {
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
case 1: /* oracle */
|
case MDB_BACKEND_ORACLE:
|
||||||
case 2: /* postgres */
|
case MDB_BACKEND_POSTGRES:
|
||||||
case 3: /* sqlite */
|
case MDB_BACKEND_SQLITE:
|
||||||
text = g_strconcat(
|
text = g_strconcat(
|
||||||
"ALTER TABLE ", quoted_table_1,
|
"ALTER TABLE ", quoted_table_1,
|
||||||
" ADD CONSTRAINT ", quoted_constraint_name,
|
" ADD CONSTRAINT ", quoted_constraint_name,
|
||||||
|
Reference in New Issue
Block a user