mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
Oracle Indexes
Add syntax for creating indexes in oracle (it's the same as PostgreSQL)
This commit is contained in:
@@ -506,7 +506,9 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
backend = MDB_BACKEND_POSTGRES;
|
backend = MDB_BACKEND_POSTGRES;
|
||||||
} else if (!strcmp(mdb->backend_name, "mysql")) {
|
} else if (!strcmp(mdb->backend_name, "mysql")) {
|
||||||
backend = MDB_BACKEND_MYSQL;
|
backend = MDB_BACKEND_MYSQL;
|
||||||
} else {
|
} else if (!strcmp(mdb->backend_name, "oracle")) {
|
||||||
|
backend = MDB_BACKEND_ORACLE;
|
||||||
|
} else {
|
||||||
fprintf(outfile, "-- Indexes are not implemented for %s\n\n", mdb->backend_name);
|
fprintf(outfile, "-- Indexes are not implemented for %s\n\n", mdb->backend_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -535,6 +537,7 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
quoted_name = mdb->default_backend->quote_schema_name(dbnamespace, index_name);
|
quoted_name = mdb->default_backend->quote_schema_name(dbnamespace, index_name);
|
||||||
if (idx->index_type==1) {
|
if (idx->index_type==1) {
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
|
case MDB_BACKEND_ORACLE:
|
||||||
case MDB_BACKEND_POSTGRES:
|
case MDB_BACKEND_POSTGRES:
|
||||||
fprintf (outfile, "ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY (", quoted_table_name, quoted_name);
|
fprintf (outfile, "ALTER TABLE %s ADD CONSTRAINT %s PRIMARY KEY (", quoted_table_name, quoted_name);
|
||||||
break;
|
break;
|
||||||
@@ -544,6 +547,7 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
|
case MDB_BACKEND_ORACLE:
|
||||||
case MDB_BACKEND_POSTGRES:
|
case MDB_BACKEND_POSTGRES:
|
||||||
fprintf(outfile, "CREATE");
|
fprintf(outfile, "CREATE");
|
||||||
if (idx->flags & MDB_IDX_UNIQUE)
|
if (idx->flags & MDB_IDX_UNIQUE)
|
||||||
|
|||||||
Reference in New Issue
Block a user