change catalogentry to GPtrArray, documentation fixes, add ifdef wrapper to mdbsql.h

This commit is contained in:
brianb
2002-03-27 13:00:00 +00:00
parent 16ecc4fe4d
commit 9b8285d937
24 changed files with 111 additions and 112 deletions

View File

@@ -82,7 +82,7 @@ bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-heade
LIBS = `glib-config --libs` $(READLINE_LIBS) -lfl
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
LDADD = ../libmdb/libmdb.la
#mdb_sql_LDADD = #../libmdb/libmdb.la ../sql/libmdbsql.la
mdb_sql_LDADD = ../libmdb/libmdb.la ../sql/libmdbsql.la
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS)
@@ -123,8 +123,8 @@ mdb_header_DEPENDENCIES = ../libmdb/libmdb.la
mdb_header_LDFLAGS =
mdb_sql_SOURCES = mdb-sql.c
mdb_sql_OBJECTS = mdb-sql.o
#mdb_sql_DEPENDENCIES = ../libmdb/libmdb.la \
#../sql/libmdbsql.la
mdb_sql_DEPENDENCIES = ../libmdb/libmdb.la \
../sql/libmdbsql.la
mdb_sql_LDFLAGS =
mdb_ver_SOURCES = mdb-ver.c
mdb_ver_OBJECTS = mdb-ver.o
@@ -156,7 +156,7 @@ prdump_OBJECTS = prdump.o
prdump_LDADD = $(LDADD)
prdump_DEPENDENCIES = ../libmdb/libmdb.la
prdump_LDFLAGS =
CFLAGS = -g -O2
CFLAGS = -g -O2 -DSQL
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)

View File

@@ -28,7 +28,7 @@ main (int argc, char **argv)
int rows;
int i, j;
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
MdbColumn *col;
/* doesn't handle tables > 256 columns. Can that happen? */
@@ -51,11 +51,11 @@ int started;
for (i = 0; i < mdb->num_catalog; i++)
{
entry = g_array_index (mdb->catalog, MdbCatalogEntry, i);
if (entry.object_type == MDB_TABLE &&
!strcmp (entry.object_name, argv [2]))
entry = g_ptr_array_index (mdb->catalog, i);
if (entry->object_type == MDB_TABLE &&
!strcmp (entry->object_name, argv [2]))
{
table = mdb_read_table (&entry);
table = mdb_read_table (entry);
mdb_read_columns (table);
mdb_rewind_table (table);

View File

@@ -26,7 +26,7 @@ int rows;
int i, j;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
MdbColumn *col;
/* doesn't handle tables > 256 columns. Can that happen? */
@@ -75,10 +75,10 @@ int opt;
mdb_read_catalog(mdb, MDB_TABLE);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_array_index(mdb->catalog,MdbCatalogEntry,i);
if (entry.object_type == MDB_TABLE &&
!strcmp(entry.object_name,argv[argc-1])) {
table = mdb_read_table(&entry);
entry = g_ptr_array_index(mdb->catalog,i);
if (entry->object_type == MDB_TABLE &&
!strcmp(entry->object_name,argv[argc-1])) {
table = mdb_read_table(entry);
mdb_read_columns(table);
mdb_rewind_table(table);

View File

@@ -33,7 +33,7 @@ main (int argc, char **argv)
{
int i, j, k;
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
MdbColumn *col;
FILE *typesfile;
@@ -74,30 +74,30 @@ FILE *cfile;
for (i=0; i < mdb->num_catalog; i++)
{
entry = g_array_index (mdb->catalog, MdbCatalogEntry, i);
entry = g_ptr_array_index (mdb->catalog, i);
/* if it's a table */
if (entry.object_type == MDB_TABLE)
if (entry->object_type == MDB_TABLE)
{
/* skip the MSys tables */
if (strncmp (entry.object_name, "MSys", 4))
if (strncmp (entry->object_name, "MSys", 4))
{
/* make sure it's a table (may be redundant) */
if (!strcmp (mdb_get_objtype_string (entry.object_type), "Table"))
if (!strcmp (mdb_get_objtype_string (entry->object_type), "Table"))
{
fprintf (typesfile, "typedef struct _%s\n", entry.object_name);
fprintf (typesfile, "typedef struct _%s\n", entry->object_name);
fprintf (typesfile, "{\n");
fprintf (headerfile, "void dump_%s (%s x);\n",
entry.object_name, entry.object_name);
entry->object_name, entry->object_name);
fprintf (cfile, "void dump_%s (%s x)\n{\n",
entry.object_name, entry.object_name);
fprintf (cfile, "\tfprintf (stdout, \"**************** %s ****************\\n\");\n", entry.object_name);
table = mdb_read_table (&entry);
entry->object_name, entry->object_name);
fprintf (cfile, "\tfprintf (stdout, \"**************** %s ****************\\n\");\n", entry->object_name);
table = mdb_read_table (entry);
/* get the columns */
mdb_read_columns (table);
@@ -138,7 +138,7 @@ FILE *cfile;
fprintf (cfile, ");\n");
}
fprintf (typesfile, "\n} %s ;\n", entry.object_name);
fprintf (typesfile, "\n} %s ;\n", entry->object_name);
fprintf (typesfile, "\n");
fprintf (cfile, "}\n\n");
}

View File

@@ -24,7 +24,7 @@ main (int argc, char **argv)
{
int i, j, k;
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
MdbColumn *col;
char *the_relation;
@@ -55,28 +55,28 @@ char *the_relation;
for (i=0; i < mdb->num_catalog; i++)
{
entry = g_array_index (mdb->catalog, MdbCatalogEntry, i);
entry = g_ptr_array_index (mdb->catalog, i);
/* if it's a table */
if (entry.object_type == MDB_TABLE)
if (entry->object_type == MDB_TABLE)
{
/* skip the MSys tables */
if (strncmp (entry.object_name, "MSys", 4))
if (strncmp (entry->object_name, "MSys", 4))
{
/* make sure it's a table (may be redundant) */
if (!strcmp (mdb_get_objtype_string (entry.object_type), "Table"))
if (!strcmp (mdb_get_objtype_string (entry->object_type), "Table"))
{
/* drop the table if it exists */
fprintf (stdout, "DROP TABLE %s;\n", entry.object_name);
fprintf (stdout, "DROP TABLE %s;\n", entry->object_name);
/* create the table */
fprintf (stdout, "CREATE TABLE %s\n", entry.object_name);
fprintf (stdout, "CREATE TABLE %s\n", entry->object_name);
fprintf (stdout, " (\n");
table = mdb_read_table (&entry);
table = mdb_read_table (entry);
/* get the columns */
mdb_read_columns (table);

View File

@@ -24,7 +24,7 @@ main (int argc, char **argv)
{
int i, j, k;
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
MdbColumn *col;
@@ -48,22 +48,22 @@ MdbColumn *col;
for (i=0; i < mdb->num_catalog; i++)
{
entry = g_array_index (mdb->catalog, MdbCatalogEntry, i);
entry = g_ptr_array_index (mdb->catalog, i);
/* if it's a table */
if (entry.object_type == MDB_TABLE)
if (entry->object_type == MDB_TABLE)
{
/* skip the MSys tables */
if (strncmp (entry.object_name, "MSys", 4))
if (strncmp (entry->object_name, "MSys", 4))
{
/* make sure it's a table (may be redundant) */
if (!strcmp (mdb_get_objtype_string (entry.object_type), "Table"))
if (!strcmp (mdb_get_objtype_string (entry->object_type), "Table"))
{
/* drop the table if it exists */
fprintf (stdout, "%s ", entry.object_name);
fprintf (stdout, "%s ", entry->object_name);
}
}
}

View File

@@ -26,7 +26,7 @@ int rows;
int i;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
GList *l;
@@ -42,10 +42,10 @@ GList *l;
mdb_read_catalog(mdb, MDB_TABLE);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_array_index(mdb->catalog,MdbCatalogEntry,i);
if (entry.object_type == MDB_TABLE &&
!strcmp(entry.object_name,argv[2])) {
table = mdb_read_table(&entry);
entry = g_ptr_array_index(mdb->catalog,i);
if (entry->object_type == MDB_TABLE &&
!strcmp(entry->object_name,argv[2])) {
table = mdb_read_table(entry);
mdb_read_columns(table);
mdb_data_dump(table);
}

View File

@@ -26,7 +26,7 @@ int rows;
int i;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
GList *l;
@@ -41,10 +41,10 @@ GList *l;
mdb_read_catalog(mdb, MDB_TABLE);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_array_index(mdb->catalog,MdbCatalogEntry,i);
if (entry.object_type == MDB_TABLE &&
!strcmp(entry.object_name,argv[2])) {
mdb_table_dump(&entry);
entry = g_ptr_array_index(mdb->catalog,i);
if (entry->object_type == MDB_TABLE &&
!strcmp(entry->object_name,argv[2])) {
mdb_table_dump(entry);
}
}

View File

@@ -32,7 +32,7 @@ int rows;
int i;
unsigned char buf[2048];
MdbHandle *mdb;
MdbCatalogEntry entry;
MdbCatalogEntry *entry;
MdbTableDef *table;
mdb_init();
@@ -44,10 +44,10 @@ MdbTableDef *table;
mdb_read_catalog(mdb, MDB_TABLE);
for (i=0;i<mdb->num_catalog;i++) {
entry = g_array_index(mdb->catalog,MdbCatalogEntry,i);
if (entry.object_type == MDB_TABLE &&
!strcmp(entry.object_name,TABLE_NAME)) {
table = mdb_read_table(&entry);
entry = g_ptr_array_index(mdb->catalog,i);
if (entry->object_type == MDB_TABLE &&
!strcmp(entry->object_name,TABLE_NAME)) {
table = mdb_read_table(entry);
print_table(table);
}
}