fixed list tables/describe table bug from odbc restructure

This commit is contained in:
brianb
2001-09-29 00:16:16 +00:00
parent 90797c0121
commit 71775b190a
8 changed files with 14 additions and 9 deletions

View File

@@ -1,7 +1,6 @@
Basic Installation Basic Installation
================== ==================
$ cd src
$ ./configure $ ./configure
$ make $ make

3
TODO
View File

@@ -9,7 +9,8 @@ Things to Do
. Get automake working . Get automake working
. Check out text file unixODBC driver to see if it can be adapted to use . Check out text file unixODBC driver to see if it can be adapted to use
libmdb (it already has a SQL parser). libmdb (it already has a SQL parser).
. Straighten out which functions in libmdb are meant to be used and which ones should be static. . Straighten out which functions in libmdb are meant to be used and which
ones should be static.
. Create an API reference for libmdb (maybe some man pages). . Create an API reference for libmdb (maybe some man pages).
. Sargs need to support all datatypes . Sargs need to support all datatypes
. Need a way to express logical relationships between sargs (tree) . Need a way to express logical relationships between sargs (tree)

View File

@@ -76,6 +76,7 @@ fprintf(stdout,"\n");
} }
if (mdb->jet_version==MDB_VER_JET4) i++; if (mdb->jet_version==MDB_VER_JET4) i++;
} }
//fprintf(stderr,"name: %s type: %d\n",entry->object_name, entry->object_type);
entry->object_name[j] = '\0'; entry->object_name[j] = '\0';
entry->kkd_pg = mdb_get_int16(mdb,offset+31+strlen(entry->object_name)+7); entry->kkd_pg = mdb_get_int16(mdb,offset+31+strlen(entry->object_name)+7);
entry->kkd_rowid = mdb->pg_buf[offset+31+strlen(entry->object_name)+6]; entry->kkd_rowid = mdb->pg_buf[offset+31+strlen(entry->object_name)+6];
@@ -138,7 +139,7 @@ int next_pg, next_pg_off;
if (mdb->pg_buf[0]==0x01 && if (mdb->pg_buf[0]==0x01 &&
mdb->pg_buf[1]==0x01 && mdb->pg_buf[1]==0x01 &&
mdb_get_int32(mdb,4)==2) { mdb_get_int32(mdb,4)==2) {
/* fprintf(stderr,"cat page %d\n", next_pg); */ // fprintf(stderr,"cat page %d\n", next_pg);
rows = mdb_catalog_rows(mdb); rows = mdb_catalog_rows(mdb);
for (i=0;i<rows;i++) { for (i=0;i<rows;i++) {
if (mdb->pg_buf[11 + 2 * i] & 0x40) continue; if (mdb->pg_buf[11 + 2 * i] & 0x40) continue;

View File

@@ -246,7 +246,7 @@ MdbHandle *mdb = entry->mdb;
if (!mdb_read_pg(mdb, table->cur_phys_pg++)) if (!mdb_read_pg(mdb, table->cur_phys_pg++))
return 0; return 0;
} while (mdb->pg_buf[0]!=0x01 || mdb_get_int32(mdb, 4)!=entry->table_pg); } while (mdb->pg_buf[0]!=0x01 || mdb_get_int32(mdb, 4)!=entry->table_pg);
/* fprintf(stderr,"returning new page %ld\n", table->cur_phys_pg); */ /*fprintf(stderr,"returning new page %ld\n", table->cur_phys_pg); */
return table->cur_phys_pg; return table->cur_phys_pg;
} }
int mdb_rewind_table(MdbTableDef *table) int mdb_rewind_table(MdbTableDef *table)

View File

@@ -23,7 +23,7 @@
#include <stdio.h> #include <stdio.h>
static char software_version[] = "$Id: unittest.c,v 1.3 2001/07/25 01:55:43 brianb Exp $"; static char software_version[] = "$Id: unittest.c,v 1.4 2001/09/29 00:16:16 brianb Exp $";
static void *no_unused_var_warn[] = {software_version, static void *no_unused_var_warn[] = {software_version,
no_unused_var_warn}; no_unused_var_warn};
@@ -185,7 +185,8 @@ int i;
szSqlState, szErrorMsg); szSqlState, szErrorMsg);
exit(1); exit(1);
} }
SQLBindCol(hstmt, 2, SQL_CHAR, szCol1, 60, NULL); //SQLBindCol(hstmt, 2, SQL_CHAR, szCol1, 60, NULL);
SQLBindCol(hstmt, 1, SQL_CHAR, szCol1, 60, NULL);
/* Execute statement with first row. */ /* Execute statement with first row. */

View File

@@ -229,6 +229,10 @@ MdbSQLColumn *c;
MdbSQLTable *t; MdbSQLTable *t;
MdbSQLSarg *sql_sarg; MdbSQLSarg *sql_sarg;
if (sql->cur_table) {
mdb_free_tabledef(sql->cur_table);
sql->cur_table = NULL;
}
for (i=0;i<sql->num_columns;i++) { for (i=0;i<sql->num_columns;i++) {
c = g_ptr_array_index(sql->columns,i); c = g_ptr_array_index(sql->columns,i);
if (c->name) g_free(c->name); if (c->name) g_free(c->name);
@@ -377,7 +381,6 @@ char colsize[11];
/* the column and table names are no good now */ /* the column and table names are no good now */
mdb_sql_reset(sql); mdb_sql_reset(sql);
} }
void mdb_sql_select(MdbSQL *sql) void mdb_sql_select(MdbSQL *sql)
{ {

View File

@@ -25,7 +25,7 @@
#line 1 "parser.y" #line 1 "parser.y"
/* MDB Tools - A library for reading MS Access database file /* MDB Tools - A library for reading MS Access database files
* Copyright (C) 2000 Brian Bruns * Copyright (C) 2000 Brian Bruns
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or

View File

@@ -1,5 +1,5 @@
%{ %{
/* MDB Tools - A library for reading MS Access database file /* MDB Tools - A library for reading MS Access database files
* Copyright (C) 2000 Brian Bruns * Copyright (C) 2000 Brian Bruns
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or