mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
massive sync up of my code to CVS. not sure what changed.
This commit is contained in:
parent
71775b190a
commit
ea8fd2a6ba
25
ChangeLog
25
ChangeLog
@ -0,0 +1,25 @@
|
||||
2001-09-29 Brian Bruns <camber@ais.org>
|
||||
|
||||
* src/odbc/odbc.c:
|
||||
Added implementation of SQLNumResultCols()
|
||||
|
||||
* src/sql/lexer.l:
|
||||
Added yywrap function, so ODBC driver may be linked without libfl
|
||||
|
||||
* src/util/mdb-sql.c
|
||||
src/sql/parser.y
|
||||
src/odbc/odbc.c:
|
||||
Added mdb_sql_set() function so mdb-sql and ODBC driver do not need to
|
||||
set g_sql directly.
|
||||
|
||||
2001-09-28 Brian Bruns <camber@ais.org>
|
||||
|
||||
* src/odbc/unittest.c:
|
||||
Changed dwNativeError vars to SQLINTEGER to fix compile warning
|
||||
|
||||
* src/util/mdb-sql.c
|
||||
src/sql/mdbsql.c:
|
||||
Check for cur_table before calling mdb_dump_results()
|
||||
Make mdb_sql_reset() dealloc and clear cur_table
|
||||
|
||||
|
2
INSTALL
2
INSTALL
@ -12,6 +12,8 @@ mdb-export -- export table to CSV format
|
||||
mdb-tables -- a simple dump of table names to be used with shell scripts
|
||||
mdb-header -- generates a C header to be used in exporting mdb data to a C prog.
|
||||
mdb-parsecvs -- generates a C program given a CSV file made with mdb-export
|
||||
mdb-sql -- if --enable-sql is specified, a simple SQL engine (also used by
|
||||
ODBC).
|
||||
|
||||
And some utilities useful for debugging:
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
|
10
config.cache
10
config.cache
@ -24,14 +24,14 @@ ac_cv_lib_fl_yywrap=${ac_cv_lib_fl_yywrap=yes}
|
||||
ac_cv_lib_ncurses_initscr=${ac_cv_lib_ncurses_initscr=yes}
|
||||
ac_cv_lib_readline_add_history=${ac_cv_lib_readline_add_history=yes}
|
||||
ac_cv_path_LD=${ac_cv_path_LD=/usr/bin/ld}
|
||||
ac_cv_path_NM=${ac_cv_path_NM='/usr/bin/nm -B'}
|
||||
ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'}
|
||||
ac_cv_path_NM=${ac_cv_path_NM=$'/usr/bin/nm -B'}
|
||||
ac_cv_path_install=${ac_cv_path_install=$'/usr/bin/install -c'}
|
||||
ac_cv_prog_CC=${ac_cv_prog_CC=gcc}
|
||||
ac_cv_prog_CPP=${ac_cv_prog_CPP='gcc -E'}
|
||||
ac_cv_prog_CPP=${ac_cv_prog_CPP=$'gcc -E'}
|
||||
ac_cv_prog_LEX=${ac_cv_prog_LEX=flex}
|
||||
ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'}
|
||||
ac_cv_prog_LN_S=${ac_cv_prog_LN_S=$'ln -s'}
|
||||
ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib}
|
||||
ac_cv_prog_YACC=${ac_cv_prog_YACC='bison -y'}
|
||||
ac_cv_prog_YACC=${ac_cv_prog_YACC=$'bison -y'}
|
||||
ac_cv_prog_cc_cross=${ac_cv_prog_cc_cross=no}
|
||||
ac_cv_prog_cc_g=${ac_cv_prog_cc_g=yes}
|
||||
ac_cv_prog_cc_works=${ac_cv_prog_cc_works=yes}
|
||||
|
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
|
59
include/mdbodbc.h
Normal file
59
include/mdbodbc.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* MDB Tools - A library for reading MS Access database file
|
||||
* Copyright (C) 2000 Brian Bruns
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef _mdbodbc_h_
|
||||
#define _mdbodbc_h_
|
||||
|
||||
#include <mdbtools.h>
|
||||
#include <mdbsql.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static char rcsid_sql_h [ ] =
|
||||
"$Id: mdbodbc.h,v 1.1 2002/01/24 12:34:12 brianb Exp $";
|
||||
static void *no_unused_sql_h_warn[]={rcsid_sql_h, no_unused_sql_h_warn};
|
||||
|
||||
struct _henv {
|
||||
MdbSQL *sql;
|
||||
};
|
||||
struct _hdbc {
|
||||
struct _henv *henv;
|
||||
};
|
||||
struct _hstmt {
|
||||
struct _hdbc *hdbc;
|
||||
/* reminder to self: the following is here for testing purposes.
|
||||
* please make dynamic before checking in
|
||||
*/
|
||||
char query[4096];
|
||||
struct _sql_bind_info *bind_head;
|
||||
};
|
||||
|
||||
struct _sql_bind_info {
|
||||
int column_number;
|
||||
int column_bindtype;
|
||||
int column_bindlen;
|
||||
char *varaddr;
|
||||
struct _sql_bind_info *next;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
|
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
@ -95,7 +95,7 @@ mdb_dump_OBJECTS = mdb-dump.o mdbsupport.o
|
||||
mdb_dump_LDADD = $(LDADD)
|
||||
mdb_dump_DEPENDENCIES = ../libmdb/libmdb.la
|
||||
mdb_dump_LDFLAGS =
|
||||
CFLAGS = -g -O2 -DSQL
|
||||
CFLAGS = -g -O2 -DUNIXODBC -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)
|
||||
|
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
@ -94,7 +94,7 @@ libmdb_la_LDFLAGS =
|
||||
libmdb_la_LIBADD =
|
||||
libmdb_la_OBJECTS = catalog.lo mem.lo file.lo kkd.lo table.lo data.lo \
|
||||
dump.lo backend.lo money.lo sargs.lo index.lo like.lo
|
||||
CFLAGS = -g -O2 -DSQL
|
||||
CFLAGS = -g -O2 -DUNIXODBC -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)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
@ -78,12 +78,23 @@ SQL =
|
||||
VERSION = 0.3
|
||||
YACC = bison -y
|
||||
|
||||
include_HEADERS = connectparams.h
|
||||
SQLDIR = ../sql
|
||||
SQLSOURCES = mdbsql.c parser.c lexer.c
|
||||
MDBDIR = ../libmdb
|
||||
MDBSOURCES = backend.c index.c money.c catalog.c kkd.c sargs.c \
|
||||
data.c like.c table.c dump.c file.c mem.c
|
||||
|
||||
bin_PROGRAMS = unittest
|
||||
lib_LTLIBRARIES = libmdbodbc.la
|
||||
libmdbodbc_la_SOURCES = odbc.c connectparams.c
|
||||
#libmdbodbc_la_LIBADD= ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
INCLUDES = -I ../../include `glib-config --cflags`
|
||||
LIBS = -lfl
|
||||
libmdbodbc_la_SOURCES = odbc.c connectparams.c
|
||||
libmdbodbc_la_LIBADD = $(patsubst %, $(SQLDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(SQLSOURCES))) \
|
||||
$(patsubst %, $(MDBDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(MDBSOURCES))) -lglib
|
||||
|
||||
LIBS = -lfl `glib-config --libs`
|
||||
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -94,7 +105,9 @@ DEFS = -DPACKAGE=\"mdbtools\" -DVERSION=\"0.3\" -DYYTEXT_POINTER=1 -DSTDC_HEADE
|
||||
CPPFLAGS =
|
||||
LDFLAGS =
|
||||
libmdbodbc_la_LDFLAGS =
|
||||
libmdbodbc_la_LIBADD =
|
||||
libmdbodbc_la_DEPENDENCIES = $(patsubst %, $(SQLDIR)/%, $(patsubst %.c, \
|
||||
%.lo, $(SQLSOURCES))) $(patsubst %, $(MDBDIR)/%, $(patsubst %.c, %.lo, \
|
||||
$(MDBSOURCES)))
|
||||
libmdbodbc_la_OBJECTS = odbc.lo connectparams.lo
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
@ -103,11 +116,13 @@ unittest_OBJECTS = unittest.o
|
||||
unittest_DEPENDENCIES = libmdbodbc.la ../libmdb/libmdb.la \
|
||||
../sql/libmdbsql.la
|
||||
unittest_LDFLAGS =
|
||||
CFLAGS = -g -O2 -DSQL
|
||||
CFLAGS = -g -O2 -DUNIXODBC -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)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
@ -219,6 +234,21 @@ unittest: $(unittest_OBJECTS) $(unittest_DEPENDENCIES)
|
||||
@rm -f unittest
|
||||
$(LINK) $(unittest_LDFLAGS) $(unittest_OBJECTS) $(unittest_LDADD) $(LIBS)
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
@ -311,20 +341,22 @@ installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \
|
||||
uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \
|
||||
$(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@ -372,10 +404,11 @@ distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \
|
||||
clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
|
||||
install-binPROGRAMS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
|
||||
clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
||||
install-binPROGRAMS uninstall-includeHEADERS install-includeHEADERS \
|
||||
tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
|
||||
distdir mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
|
@ -1,9 +1,18 @@
|
||||
include_HEADERS = connectparams.h
|
||||
SQLDIR = ../sql
|
||||
SQLSOURCES = mdbsql.c parser.c lexer.c
|
||||
MDBDIR = ../libmdb
|
||||
MDBSOURCES = backend.c index.c money.c catalog.c kkd.c sargs.c \
|
||||
data.c like.c table.c dump.c file.c mem.c
|
||||
bin_PROGRAMS = unittest
|
||||
lib_LTLIBRARIES = libmdbodbc.la
|
||||
libmdbodbc_la_SOURCES= odbc.c connectparams.c
|
||||
#libmdbodbc_la_LIBADD= ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
INCLUDES = -I ../../include `glib-config --cflags`
|
||||
LIBS = @LEXLIB@
|
||||
libmdbodbc_la_SOURCES= odbc.c connectparams.c
|
||||
libmdbodbc_la_LIBADD= $(patsubst %, $(SQLDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(SQLSOURCES))) \
|
||||
$(patsubst %, $(MDBDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(MDBSOURCES))) -lglib
|
||||
LIBS = @LEXLIB@ `glib-config --libs`
|
||||
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
|
||||
## Need blank statement to avoid compiling odbc.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -78,12 +78,23 @@ SQL = @SQL@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
include_HEADERS = connectparams.h
|
||||
SQLDIR = ../sql
|
||||
SQLSOURCES = mdbsql.c parser.c lexer.c
|
||||
MDBDIR = ../libmdb
|
||||
MDBSOURCES = backend.c index.c money.c catalog.c kkd.c sargs.c \
|
||||
data.c like.c table.c dump.c file.c mem.c
|
||||
|
||||
bin_PROGRAMS = unittest
|
||||
lib_LTLIBRARIES = libmdbodbc.la
|
||||
libmdbodbc_la_SOURCES = odbc.c connectparams.c
|
||||
#libmdbodbc_la_LIBADD= ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
INCLUDES = -I ../../include `glib-config --cflags`
|
||||
LIBS = @LEXLIB@
|
||||
libmdbodbc_la_SOURCES = odbc.c connectparams.c
|
||||
libmdbodbc_la_LIBADD = $(patsubst %, $(SQLDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(SQLSOURCES))) \
|
||||
$(patsubst %, $(MDBDIR)/%, \
|
||||
$(patsubst %.c, %.lo, $(MDBSOURCES))) -lglib
|
||||
|
||||
LIBS = @LEXLIB@ `glib-config --libs`
|
||||
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -94,7 +105,9 @@ DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
libmdbodbc_la_LDFLAGS =
|
||||
libmdbodbc_la_LIBADD =
|
||||
libmdbodbc_la_DEPENDENCIES = $(patsubst %, $(SQLDIR)/%, $(patsubst %.c, \
|
||||
%.lo, $(SQLSOURCES))) $(patsubst %, $(MDBDIR)/%, $(patsubst %.c, %.lo, \
|
||||
$(MDBSOURCES)))
|
||||
libmdbodbc_la_OBJECTS = odbc.lo connectparams.lo
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
|
||||
@ -108,6 +121,8 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CF
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
@ -219,6 +234,21 @@ unittest: $(unittest_OBJECTS) $(unittest_DEPENDENCIES)
|
||||
@rm -f unittest
|
||||
$(LINK) $(unittest_LDFLAGS) $(unittest_OBJECTS) $(unittest_LDADD) $(LIBS)
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
@ -311,20 +341,22 @@ installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-binPROGRAMS \
|
||||
uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) \
|
||||
$(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
@ -372,10 +404,11 @@ distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool mostlyclean-binPROGRAMS distclean-binPROGRAMS \
|
||||
clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
|
||||
install-binPROGRAMS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir mostlyclean-depend distclean-depend \
|
||||
clean-depend maintainer-clean-depend info-am info dvi-am dvi check \
|
||||
check-am installcheck-am installcheck install-exec-am install-exec \
|
||||
install-binPROGRAMS uninstall-includeHEADERS install-includeHEADERS \
|
||||
tags mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
|
||||
distdir mostlyclean-depend distclean-depend clean-depend \
|
||||
maintainer-clean-depend info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "connectparams.h"
|
||||
|
||||
static char software_version[] = "$Id: odbc.c,v 1.3 2001/07/25 01:55:43 brianb Exp $";
|
||||
static char software_version[] = "$Id: odbc.c,v 1.4 2002/01/24 12:34:13 brianb Exp $";
|
||||
static void *no_unused_var_warn[] = {software_version,
|
||||
no_unused_var_warn};
|
||||
|
||||
@ -47,10 +47,13 @@ static SQLRETURN SQL_API _SQLFreeConnect(SQLHDBC hdbc);
|
||||
static SQLRETURN SQL_API _SQLFreeEnv(SQLHENV henv);
|
||||
static SQLRETURN SQL_API _SQLFreeStmt(SQLHSTMT hstmt, SQLUSMALLINT fOption);
|
||||
|
||||
#define MIN(a,b) (a>b ? b : a)
|
||||
#define _MAX_ERROR_LEN 255
|
||||
static char lastError[_MAX_ERROR_LEN+1];
|
||||
|
||||
extern MdbSQL *g_sql;
|
||||
/* The SQL engine is presently non-reenterrant and non-thread safe.
|
||||
See _SQLExecute for details.
|
||||
*/
|
||||
|
||||
static void LogError (const char* error)
|
||||
{
|
||||
@ -467,12 +470,49 @@ SQLRETURN SQL_API SQLDescribeCol(
|
||||
SQLSMALLINT cbColNameMax,
|
||||
SQLSMALLINT FAR *pcbColName,
|
||||
SQLSMALLINT FAR *pfSqlType,
|
||||
SQLUINTEGER FAR *pcbColDef,
|
||||
SQLUINTEGER FAR *pcbColDef, /* precision */
|
||||
SQLSMALLINT FAR *pibScale,
|
||||
SQLSMALLINT FAR *pfNullable)
|
||||
{
|
||||
int cplen, namelen, i;
|
||||
struct _hstmt *stmt = (struct _hstmt *) hstmt;
|
||||
struct _hdbc *dbc = (struct _hdbc *) stmt->hdbc;
|
||||
struct _henv *env = (struct _henv *) dbc->henv;
|
||||
MdbSQL *sql = env->sql;
|
||||
MdbSQLColumn *sqlcol;
|
||||
MdbColumn *col;
|
||||
MdbTableDef *table;
|
||||
|
||||
if (icol<1 || icol>sql->num_columns) {
|
||||
return SQL_ERROR;
|
||||
}
|
||||
sqlcol = g_ptr_array_index(sql->columns,icol - 1);
|
||||
table = sql->cur_table;
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
col=g_ptr_array_index(table->columns,i);
|
||||
if (!strcasecmp(sqlcol->name, col->name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (szColName) {
|
||||
namelen = MIN(cbColNameMax,strlen(sqlcol->name));
|
||||
strncpy(szColName, sqlcol->name, namelen);
|
||||
szColName[namelen]='\0';
|
||||
}
|
||||
if (pfSqlType) {
|
||||
*pfSqlType = _odbc_get_client_type(col->col_type);
|
||||
}
|
||||
if (pcbColDef) {
|
||||
*pcbColDef = col->col_size;
|
||||
}
|
||||
if (pibScale) {
|
||||
/* FIX ME */
|
||||
*pibScale = 0;
|
||||
}
|
||||
if (pfNullable) {
|
||||
*pfNullable = !col->is_fixed;
|
||||
}
|
||||
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
@ -573,11 +613,13 @@ int ret;
|
||||
fprintf(stderr,"query = %s\n",stmt->query);
|
||||
_odbc_fix_literals(stmt);
|
||||
|
||||
mdb_sql_reset(env->sql);
|
||||
|
||||
/* calls to yyparse would need to be serialized for thread safety */
|
||||
|
||||
/* begin unsafe */
|
||||
g_input_ptr = stmt->query;
|
||||
g_sql = env->sql;
|
||||
_mdb_sql(env->sql);
|
||||
if (yyparse()) {
|
||||
/* end unsafe */
|
||||
LogError("Couldn't parse SQL\n");
|
||||
@ -710,9 +752,11 @@ SQLRETURN SQL_API SQLNumResultCols(
|
||||
SQLHSTMT hstmt,
|
||||
SQLSMALLINT FAR *pccol)
|
||||
{
|
||||
struct _hstmt *stmt;
|
||||
struct _hstmt *stmt = (struct _hstmt *) hstmt;
|
||||
struct _hdbc *dbc = (struct _hdbc *) stmt->hdbc;
|
||||
struct _henv *env = (struct _henv *) dbc->henv;
|
||||
|
||||
stmt=(struct _hstmt *)hstmt;
|
||||
*pccol = env->sql->num_columns;
|
||||
return SQL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -1056,6 +1100,20 @@ static int _odbc_get_server_type(int clt_type)
|
||||
static SQLSMALLINT _odbc_get_client_type(int srv_type)
|
||||
{
|
||||
switch (srv_type) {
|
||||
MDB_BOOL:
|
||||
return SQL_BIT;
|
||||
MDB_BYTE:
|
||||
return SQL_TINYINT;
|
||||
MDB_INT:
|
||||
return SQL_SMALLINT;
|
||||
MDB_LONGINT:
|
||||
return SQL_INTEGER;
|
||||
MDB_FLOAT:
|
||||
return SQL_FLOAT;
|
||||
MDB_DOUBLE:
|
||||
return SQL_DOUBLE;
|
||||
MDB_TEXT:
|
||||
return SQL_VARCHAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
*/
|
||||
|
||||
/* #include <windows.h> */
|
||||
#include <isql.h>
|
||||
#include <isqlext.h>
|
||||
#include <sql.h>
|
||||
#include <sqlext.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static char software_version[] = "$Id: unittest.c,v 1.4 2001/09/29 00:16:16 brianb Exp $";
|
||||
static char software_version[] = "$Id: unittest.c,v 1.5 2002/01/24 12:34:13 brianb Exp $";
|
||||
static void *no_unused_var_warn[] = {software_version,
|
||||
no_unused_var_warn};
|
||||
|
||||
@ -48,7 +48,7 @@ static void printStatementError(HSTMT hstmt, char *msg)
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
||||
@ -70,7 +70,7 @@ int i;
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(henv, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
||||
@ -88,7 +88,7 @@ int i;
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||
@ -105,7 +105,7 @@ int i;
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||
@ -126,7 +126,7 @@ int i;
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||
@ -143,7 +143,7 @@ int i;
|
||||
{
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||
@ -174,7 +174,7 @@ int i;
|
||||
if (retcode != SQL_SUCCESS) {
|
||||
UCHAR szSqlState[6];
|
||||
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||
SDWORD dwNativeError;
|
||||
SQLINTEGER dwNativeError;
|
||||
SWORD wErrorMsg;
|
||||
|
||||
SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
||||
@ -185,8 +185,8 @@ int i;
|
||||
szSqlState, szErrorMsg);
|
||||
exit(1);
|
||||
}
|
||||
//SQLBindCol(hstmt, 2, SQL_CHAR, szCol1, 60, NULL);
|
||||
SQLBindCol(hstmt, 1, SQL_CHAR, szCol1, 60, NULL);
|
||||
SQLBindCol(hstmt, 3, SQL_CHAR, szCol1, 60, NULL);
|
||||
//SQLBindCol(hstmt, 1, SQL_CHAR, szCol1, 60, NULL);
|
||||
|
||||
/* Execute statement with first row. */
|
||||
|
||||
|
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
@ -79,7 +79,7 @@ VERSION = 0.3
|
||||
YACC = bison -y
|
||||
|
||||
lib_LTLIBRARIES = libmdbsql.la
|
||||
libmdbsql_la_SOURCES = mdbsql.c parser.y lexer.l
|
||||
libmdbsql_la_SOURCES = mdbsql.c parser.y lexer.l
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LIBS = `glib-config --libs`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
@ -96,7 +96,7 @@ libmdbsql_la_LIBADD =
|
||||
libmdbsql_la_OBJECTS = mdbsql.lo parser.lo lexer.lo
|
||||
LEX_OUTPUT_ROOT = lex.yy
|
||||
LEXLIB = -lfl
|
||||
CFLAGS = -g -O2 -DSQL
|
||||
CFLAGS = -g -O2 -DUNIXODBC -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)
|
||||
|
@ -1,5 +1,5 @@
|
||||
lib_LTLIBRARIES = libmdbsql.la
|
||||
libmdbsql_la_SOURCES= mdbsql.c parser.y lexer.l
|
||||
libmdbsql_la_SOURCES= mdbsql.c parser.y lexer.l
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LIBS = `glib-config --libs`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
|
@ -79,7 +79,7 @@ VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
lib_LTLIBRARIES = libmdbsql.la
|
||||
libmdbsql_la_SOURCES = mdbsql.c parser.y lexer.l
|
||||
libmdbsql_la_SOURCES = mdbsql.c parser.y lexer.l
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LIBS = `glib-config --libs`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
/* Scanner skeleton version:
|
||||
* $Header: /Users/brian/cvs/mdbtools/mdbtools/src/sql/Attic/lexer.c,v 1.3 2001/05/16 00:21:17 brianb Exp $
|
||||
* $Header: /Users/brian/cvs/mdbtools/mdbtools/src/sql/Attic/lexer.c,v 1.4 2002/01/24 12:34:13 brianb Exp $
|
||||
*/
|
||||
|
||||
#define FLEX_SCANNER
|
||||
@ -9,6 +9,7 @@
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
||||
@ -22,7 +23,6 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Use prototypes in function declarations. */
|
||||
#define YY_USE_PROTOS
|
||||
@ -477,8 +477,7 @@ char *yytext;
|
||||
#include "mdbsql.h"
|
||||
#include "parser.h"
|
||||
|
||||
extern MdbSQL *g_sql;
|
||||
#line 482 "lex.yy.c"
|
||||
#line 481 "lex.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
@ -629,9 +628,9 @@ YY_DECL
|
||||
register char *yy_cp = NULL, *yy_bp = NULL;
|
||||
register int yy_act;
|
||||
|
||||
#line 27 "lexer.l"
|
||||
#line 26 "lexer.l"
|
||||
|
||||
#line 635 "lex.yy.c"
|
||||
#line 634 "lex.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
@ -716,112 +715,112 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 28 "lexer.l"
|
||||
#line 27 "lexer.l"
|
||||
{ return SELECT; }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 29 "lexer.l"
|
||||
#line 28 "lexer.l"
|
||||
{ return FROM; }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 30 "lexer.l"
|
||||
#line 29 "lexer.l"
|
||||
{ return CONNECT; }
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 31 "lexer.l"
|
||||
#line 30 "lexer.l"
|
||||
{ return DISCONNECT; }
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 32 "lexer.l"
|
||||
#line 31 "lexer.l"
|
||||
{ return TO; }
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 33 "lexer.l"
|
||||
#line 32 "lexer.l"
|
||||
{ return LIST; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 34 "lexer.l"
|
||||
#line 33 "lexer.l"
|
||||
{ return WHERE; }
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 35 "lexer.l"
|
||||
#line 34 "lexer.l"
|
||||
{ return AND; }
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 36 "lexer.l"
|
||||
#line 35 "lexer.l"
|
||||
{ return TABLES; }
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 37 "lexer.l"
|
||||
#line 36 "lexer.l"
|
||||
{ return TABLE; }
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 38 "lexer.l"
|
||||
#line 37 "lexer.l"
|
||||
{ return DESCRIBE; }
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 39 "lexer.l"
|
||||
#line 38 "lexer.l"
|
||||
{ return LTEQ; }
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 40 "lexer.l"
|
||||
#line 39 "lexer.l"
|
||||
{ return GTEQ; }
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 41 "lexer.l"
|
||||
#line 40 "lexer.l"
|
||||
{ return LIKE; }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 42 "lexer.l"
|
||||
#line 41 "lexer.l"
|
||||
;
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 43 "lexer.l"
|
||||
#line 42 "lexer.l"
|
||||
{ yylval.name = strdup(yytext); return NAME; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 44 "lexer.l"
|
||||
#line 43 "lexer.l"
|
||||
{ yylval.name = strdup(yytext); return STRING; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 45 "lexer.l"
|
||||
#line 44 "lexer.l"
|
||||
{
|
||||
yylval.name = strdup(yytext); return NUMBER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 48 "lexer.l"
|
||||
#line 47 "lexer.l"
|
||||
{ yylval.name = strdup(yytext); return PATH; }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 49 "lexer.l"
|
||||
#line 48 "lexer.l"
|
||||
{ return yytext[0]; }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 50 "lexer.l"
|
||||
#line 49 "lexer.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 825 "lex.yy.c"
|
||||
#line 824 "lex.yy.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -1385,11 +1384,6 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifndef YY_ALWAYS_INTERACTIVE
|
||||
#ifndef YY_NEVER_INTERACTIVE
|
||||
extern int isatty YY_PROTO(( int ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
@ -1707,9 +1701,13 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 50 "lexer.l"
|
||||
#line 49 "lexer.l"
|
||||
|
||||
|
||||
int yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
void yyerror(char *s)
|
||||
{
|
||||
fprintf(stderr,"Error at Line : %s near %s\n", s, yytext);
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "mdbsql.h"
|
||||
#include "parser.h"
|
||||
|
||||
extern MdbSQL *g_sql;
|
||||
%}
|
||||
|
||||
%%
|
||||
@ -49,6 +48,10 @@ like { return LIKE; }
|
||||
. { return yytext[0]; }
|
||||
%%
|
||||
|
||||
int yywrap()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
void yyerror(char *s)
|
||||
{
|
||||
fprintf(stderr,"Error at Line : %s near %s\n", s, yytext);
|
||||
|
@ -45,9 +45,20 @@
|
||||
*/
|
||||
#include "mdbsql.h"
|
||||
|
||||
MdbSQL *g_sql;
|
||||
|
||||
#line 25 "parser.y"
|
||||
MdbSQL *_mdb_sql(MdbSQL *sql)
|
||||
{
|
||||
static MdbSQL *g_sql;
|
||||
|
||||
if (sql) {
|
||||
g_sql = sql;
|
||||
} else {
|
||||
return g_sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#line 36 "parser.y"
|
||||
typedef union {
|
||||
char *name;
|
||||
double dval;
|
||||
@ -121,9 +132,9 @@ static const short yyrhs[] = { 7,
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short yyrline[] = { 0,
|
||||
44, 48, 51, 54, 57, 62, 64, 67, 69, 72,
|
||||
78, 85, 87, 88, 89, 90, 91, 93, 95, 98,
|
||||
100, 102, 106, 108, 109, 112
|
||||
55, 59, 62, 65, 68, 73, 75, 78, 80, 83,
|
||||
89, 96, 98, 99, 100, 101, 102, 104, 106, 109,
|
||||
111, 113, 117, 119, 120, 123
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -735,94 +746,94 @@ yyreduce:
|
||||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 45 "parser.y"
|
||||
#line 56 "parser.y"
|
||||
{
|
||||
mdb_sql_select(g_sql);
|
||||
mdb_sql_select(_mdb_sql(NULL));
|
||||
;
|
||||
break;}
|
||||
case 2:
|
||||
#line 48 "parser.y"
|
||||
#line 59 "parser.y"
|
||||
{
|
||||
mdb_sql_open(g_sql, yyvsp[0].name); free(yyvsp[0].name);
|
||||
mdb_sql_open(_mdb_sql(NULL), yyvsp[0].name); free(yyvsp[0].name);
|
||||
;
|
||||
break;}
|
||||
case 3:
|
||||
#line 51 "parser.y"
|
||||
#line 62 "parser.y"
|
||||
{
|
||||
mdb_sql_close(g_sql);
|
||||
mdb_sql_close(_mdb_sql(NULL));
|
||||
;
|
||||
break;}
|
||||
case 4:
|
||||
#line 54 "parser.y"
|
||||
#line 65 "parser.y"
|
||||
{
|
||||
mdb_sql_describe_table(g_sql);
|
||||
mdb_sql_describe_table(_mdb_sql(NULL));
|
||||
;
|
||||
break;}
|
||||
case 5:
|
||||
#line 57 "parser.y"
|
||||
#line 68 "parser.y"
|
||||
{
|
||||
mdb_sql_listtables(g_sql);
|
||||
mdb_sql_listtables(_mdb_sql(NULL));
|
||||
;
|
||||
break;}
|
||||
case 10:
|
||||
#line 73 "parser.y"
|
||||
#line 84 "parser.y"
|
||||
{
|
||||
mdb_sql_add_sarg(g_sql, yyvsp[-2].name, yyvsp[-1].ival, yyvsp[0].name);
|
||||
mdb_sql_add_sarg(_mdb_sql(NULL), yyvsp[-2].name, yyvsp[-1].ival, yyvsp[0].name);
|
||||
free(yyvsp[-2].name);
|
||||
free(yyvsp[0].name);
|
||||
;
|
||||
break;}
|
||||
case 11:
|
||||
#line 78 "parser.y"
|
||||
#line 89 "parser.y"
|
||||
{
|
||||
mdb_sql_add_sarg(g_sql, yyvsp[0].name, yyvsp[-1].ival, yyvsp[-2].name);
|
||||
mdb_sql_add_sarg(_mdb_sql(NULL), yyvsp[0].name, yyvsp[-1].ival, yyvsp[-2].name);
|
||||
free(yyvsp[-2].name);
|
||||
free(yyvsp[0].name);
|
||||
;
|
||||
break;}
|
||||
case 12:
|
||||
#line 86 "parser.y"
|
||||
#line 97 "parser.y"
|
||||
{ yyval.ival = MDB_EQUAL; ;
|
||||
break;}
|
||||
case 13:
|
||||
#line 87 "parser.y"
|
||||
#line 98 "parser.y"
|
||||
{ yyval.ival = MDB_GT; ;
|
||||
break;}
|
||||
case 14:
|
||||
#line 88 "parser.y"
|
||||
#line 99 "parser.y"
|
||||
{ yyval.ival = MDB_LT; ;
|
||||
break;}
|
||||
case 15:
|
||||
#line 89 "parser.y"
|
||||
#line 100 "parser.y"
|
||||
{ yyval.ival = MDB_LTEQ; ;
|
||||
break;}
|
||||
case 16:
|
||||
#line 90 "parser.y"
|
||||
#line 101 "parser.y"
|
||||
{ yyval.ival = MDB_GTEQ; ;
|
||||
break;}
|
||||
case 17:
|
||||
#line 91 "parser.y"
|
||||
#line 102 "parser.y"
|
||||
{ yyval.ival = MDB_LIKE; ;
|
||||
break;}
|
||||
case 18:
|
||||
#line 94 "parser.y"
|
||||
#line 105 "parser.y"
|
||||
{ yyval.name = yyvsp[0].name; ;
|
||||
break;}
|
||||
case 19:
|
||||
#line 95 "parser.y"
|
||||
#line 106 "parser.y"
|
||||
{ yyval.name = yyvsp[0].name; ;
|
||||
break;}
|
||||
case 22:
|
||||
#line 103 "parser.y"
|
||||
{ mdb_sql_add_table(g_sql, yyvsp[0].name); free(yyvsp[0].name); ;
|
||||
#line 114 "parser.y"
|
||||
{ mdb_sql_add_table(_mdb_sql(NULL), yyvsp[0].name); free(yyvsp[0].name); ;
|
||||
break;}
|
||||
case 23:
|
||||
#line 107 "parser.y"
|
||||
{ mdb_sql_all_columns(g_sql); ;
|
||||
#line 118 "parser.y"
|
||||
{ mdb_sql_all_columns(_mdb_sql(NULL)); ;
|
||||
break;}
|
||||
case 26:
|
||||
#line 113 "parser.y"
|
||||
{ mdb_sql_add_column(g_sql, yyvsp[0].name); free(yyvsp[0].name); ;
|
||||
#line 124 "parser.y"
|
||||
{ mdb_sql_add_column(_mdb_sql(NULL), yyvsp[0].name); free(yyvsp[0].name); ;
|
||||
break;}
|
||||
}
|
||||
/* the action file gets copied in in place of this dollarsign */
|
||||
@ -1046,5 +1057,5 @@ yyerrhandle:
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 116 "parser.y"
|
||||
#line 127 "parser.y"
|
||||
|
||||
|
@ -19,7 +19,18 @@
|
||||
*/
|
||||
#include "mdbsql.h"
|
||||
|
||||
MdbSQL *g_sql;
|
||||
|
||||
MdbSQL *_mdb_sql(MdbSQL *sql)
|
||||
{
|
||||
static MdbSQL *g_sql;
|
||||
|
||||
if (sql) {
|
||||
g_sql = sql;
|
||||
} else {
|
||||
return g_sql;
|
||||
}
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
@ -43,19 +54,19 @@ MdbSQL *g_sql;
|
||||
|
||||
query:
|
||||
SELECT column_list FROM table where_clause {
|
||||
mdb_sql_select(g_sql);
|
||||
mdb_sql_select(_mdb_sql(NULL));
|
||||
}
|
||||
| CONNECT TO database {
|
||||
mdb_sql_open(g_sql, $3); free($3);
|
||||
mdb_sql_open(_mdb_sql(NULL), $3); free($3);
|
||||
}
|
||||
| DISCONNECT {
|
||||
mdb_sql_close(g_sql);
|
||||
mdb_sql_close(_mdb_sql(NULL));
|
||||
}
|
||||
| DESCRIBE TABLE table {
|
||||
mdb_sql_describe_table(g_sql);
|
||||
mdb_sql_describe_table(_mdb_sql(NULL));
|
||||
}
|
||||
| LIST TABLES {
|
||||
mdb_sql_listtables(g_sql);
|
||||
mdb_sql_listtables(_mdb_sql(NULL));
|
||||
}
|
||||
;
|
||||
|
||||
@ -71,12 +82,12 @@ sarg_list:
|
||||
|
||||
sarg:
|
||||
NAME operator constant {
|
||||
mdb_sql_add_sarg(g_sql, $1, $2, $3);
|
||||
mdb_sql_add_sarg(_mdb_sql(NULL), $1, $2, $3);
|
||||
free($1);
|
||||
free($3);
|
||||
}
|
||||
| constant operator NAME {
|
||||
mdb_sql_add_sarg(g_sql, $3, $2, $1);
|
||||
mdb_sql_add_sarg(_mdb_sql(NULL), $3, $2, $1);
|
||||
free($1);
|
||||
free($3);
|
||||
}
|
||||
@ -100,17 +111,17 @@ database:
|
||||
| NAME
|
||||
|
||||
table:
|
||||
NAME { mdb_sql_add_table(g_sql, $1); free($1); }
|
||||
NAME { mdb_sql_add_table(_mdb_sql(NULL), $1); free($1); }
|
||||
;
|
||||
|
||||
column_list:
|
||||
'*' { mdb_sql_all_columns(g_sql); }
|
||||
'*' { mdb_sql_all_columns(_mdb_sql(NULL)); }
|
||||
| column
|
||||
| column ',' column_list
|
||||
;
|
||||
|
||||
column:
|
||||
NAME { mdb_sql_add_column(g_sql, $1); free($1); }
|
||||
NAME { mdb_sql_add_column(_mdb_sql(NULL), $1); free($1); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated automatically from Makefile.in by configure.
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -70,7 +70,7 @@ MAKEINFO = makeinfo
|
||||
NM = /usr/bin/nm -B
|
||||
OBJDUMP = @OBJDUMP@
|
||||
ODBC =
|
||||
ODBC_INC =
|
||||
ODBC_INC = /usrl/local/include
|
||||
PACKAGE = mdbtools
|
||||
RANLIB = ranlib
|
||||
READLINE_LIBS = -lncurses -lreadline
|
||||
@ -78,7 +78,7 @@ SQL =
|
||||
VERSION = 0.3
|
||||
YACC = bison -y
|
||||
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump msysobjects
|
||||
LIBS = `glib-config --libs` $(READLINE_LIBS) -lfl
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
@ -150,7 +150,12 @@ prdump_OBJECTS = prdump.o
|
||||
prdump_LDADD = $(LDADD)
|
||||
prdump_DEPENDENCIES = ../libmdb/libmdb.la
|
||||
prdump_LDFLAGS =
|
||||
CFLAGS = -g -O2 -DSQL
|
||||
msysobjects_SOURCES = msysobjects.c
|
||||
msysobjects_OBJECTS = msysobjects.o
|
||||
msysobjects_LDADD = $(LDADD)
|
||||
msysobjects_DEPENDENCIES = ../libmdb/libmdb.la
|
||||
msysobjects_LDFLAGS =
|
||||
CFLAGS = -g -O2 -DUNIXODBC -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)
|
||||
@ -164,10 +169,10 @@ TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/mdb-array.P .deps/mdb-export.P .deps/mdb-header.P \
|
||||
.deps/mdb-parsecsv.P .deps/mdb-schema.P .deps/mdb-sql.P \
|
||||
.deps/mdb-tables.P .deps/prcat.P .deps/prdata.P .deps/prdump.P \
|
||||
.deps/prkkd.P .deps/prtable.P
|
||||
SOURCES = mdb-export.c mdb-array.c mdb-schema.c mdb-tables.c mdb-parsecsv.c mdb-header.c mdb-sql.c prtable.c prcat.c prdata.c prkkd.c prdump.c
|
||||
OBJECTS = mdb-export.o mdb-array.o mdb-schema.o mdb-tables.o mdb-parsecsv.o mdb-header.o mdb-sql.o prtable.o prcat.o prdata.o prkkd.o prdump.o
|
||||
.deps/mdb-tables.P .deps/msysobjects.P .deps/prcat.P .deps/prdata.P \
|
||||
.deps/prdump.P .deps/prkkd.P .deps/prtable.P
|
||||
SOURCES = mdb-export.c mdb-array.c mdb-schema.c mdb-tables.c mdb-parsecsv.c mdb-header.c mdb-sql.c prtable.c prcat.c prdata.c prkkd.c prdump.c msysobjects.c
|
||||
OBJECTS = mdb-export.o mdb-array.o mdb-schema.o mdb-tables.o mdb-parsecsv.o mdb-header.o mdb-sql.o prtable.o prcat.o prdata.o prkkd.o prdump.o msysobjects.o
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
@ -285,6 +290,10 @@ prdump: $(prdump_OBJECTS) $(prdump_DEPENDENCIES)
|
||||
@rm -f prdump
|
||||
$(LINK) $(prdump_LDFLAGS) $(prdump_OBJECTS) $(prdump_LDADD) $(LIBS)
|
||||
|
||||
msysobjects: $(msysobjects_OBJECTS) $(msysobjects_DEPENDENCIES)
|
||||
@rm -f msysobjects
|
||||
$(LINK) $(msysobjects_LDFLAGS) $(msysobjects_OBJECTS) $(msysobjects_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
|
@ -1,4 +1,4 @@
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump msysobjects
|
||||
LIBS = `glib-config --libs` $(READLINE_LIBS) @LEXLIB@
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -78,7 +78,7 @@ SQL = @SQL@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump
|
||||
bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql prtable prcat prdata prkkd prdump msysobjects
|
||||
LIBS = `glib-config --libs` $(READLINE_LIBS) @LEXLIB@
|
||||
INCLUDES = -I$(top_srcdir)/include `glib-config --cflags`
|
||||
LDADD = ../libmdb/libmdb.la
|
||||
@ -150,6 +150,11 @@ prdump_OBJECTS = prdump.o
|
||||
prdump_LDADD = $(LDADD)
|
||||
prdump_DEPENDENCIES = ../libmdb/libmdb.la
|
||||
prdump_LDFLAGS =
|
||||
msysobjects_SOURCES = msysobjects.c
|
||||
msysobjects_OBJECTS = msysobjects.o
|
||||
msysobjects_LDADD = $(LDADD)
|
||||
msysobjects_DEPENDENCIES = ../libmdb/libmdb.la
|
||||
msysobjects_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
@ -164,10 +169,10 @@ TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/mdb-array.P .deps/mdb-export.P .deps/mdb-header.P \
|
||||
.deps/mdb-parsecsv.P .deps/mdb-schema.P .deps/mdb-sql.P \
|
||||
.deps/mdb-tables.P .deps/prcat.P .deps/prdata.P .deps/prdump.P \
|
||||
.deps/prkkd.P .deps/prtable.P
|
||||
SOURCES = mdb-export.c mdb-array.c mdb-schema.c mdb-tables.c mdb-parsecsv.c mdb-header.c mdb-sql.c prtable.c prcat.c prdata.c prkkd.c prdump.c
|
||||
OBJECTS = mdb-export.o mdb-array.o mdb-schema.o mdb-tables.o mdb-parsecsv.o mdb-header.o mdb-sql.o prtable.o prcat.o prdata.o prkkd.o prdump.o
|
||||
.deps/mdb-tables.P .deps/msysobjects.P .deps/prcat.P .deps/prdata.P \
|
||||
.deps/prdump.P .deps/prkkd.P .deps/prtable.P
|
||||
SOURCES = mdb-export.c mdb-array.c mdb-schema.c mdb-tables.c mdb-parsecsv.c mdb-header.c mdb-sql.c prtable.c prcat.c prdata.c prkkd.c prdump.c msysobjects.c
|
||||
OBJECTS = mdb-export.o mdb-array.o mdb-schema.o mdb-tables.o mdb-parsecsv.o mdb-header.o mdb-sql.o prtable.o prcat.o prdata.o prkkd.o prdump.o msysobjects.o
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
@ -285,6 +290,10 @@ prdump: $(prdump_OBJECTS) $(prdump_DEPENDENCIES)
|
||||
@rm -f prdump
|
||||
$(LINK) $(prdump_LDFLAGS) $(prdump_OBJECTS) $(prdump_LDADD) $(LIBS)
|
||||
|
||||
msysobjects: $(msysobjects_OBJECTS) $(msysobjects_DEPENDENCIES)
|
||||
@rm -f msysobjects
|
||||
$(LINK) $(msysobjects_LDFLAGS) $(msysobjects_OBJECTS) $(msysobjects_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
|
Loading…
Reference in New Issue
Block a user