mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
odbc stuff
This commit is contained in:
parent
5c5aca53f3
commit
d7575ae2b5
387
src/odbc/Makefile
Normal file
387
src/odbc/Makefile
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
# Generated automatically from Makefile.in by configure.
|
||||||
|
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995-8, 1999 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.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
top_srcdir = ../..
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
bindir = ${exec_prefix}/bin
|
||||||
|
sbindir = ${exec_prefix}/sbin
|
||||||
|
libexecdir = ${exec_prefix}/libexec
|
||||||
|
datadir = ${prefix}/share
|
||||||
|
sysconfdir = ${prefix}/etc
|
||||||
|
sharedstatedir = ${prefix}/com
|
||||||
|
localstatedir = ${prefix}/var
|
||||||
|
libdir = ${exec_prefix}/lib
|
||||||
|
infodir = ${prefix}/info
|
||||||
|
mandir = ${prefix}/man
|
||||||
|
includedir = ${prefix}/include
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/mdbtools
|
||||||
|
pkglibdir = $(libdir)/mdbtools
|
||||||
|
pkgincludedir = $(includedir)/mdbtools
|
||||||
|
|
||||||
|
top_builddir = ../..
|
||||||
|
|
||||||
|
ACLOCAL = aclocal
|
||||||
|
AUTOCONF = autoconf
|
||||||
|
AUTOMAKE = automake
|
||||||
|
AUTOHEADER = autoheader
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
|
INSTALL_DATA = ${INSTALL} -m 644
|
||||||
|
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||||
|
transform = s,x,x,
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = i686-pc-linux-gnu
|
||||||
|
host_triplet = i686-pc-linux-gnu
|
||||||
|
AS = @AS@
|
||||||
|
CC = gcc
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
LD = /usr/bin/ld
|
||||||
|
LEX = flex
|
||||||
|
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||||
|
LN_S = ln -s
|
||||||
|
MAKEINFO = makeinfo
|
||||||
|
NM = /usr/bin/nm -B
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
PACKAGE = mdbtools
|
||||||
|
RANLIB = ranlib
|
||||||
|
READLINE_LIBS = -lncurses -lreadline
|
||||||
|
VERSION = 0.3
|
||||||
|
YACC = bison -y
|
||||||
|
|
||||||
|
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
|
||||||
|
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
|
||||||
|
DEFS = -DPACKAGE=\"mdbtools\" -DVERSION=\"0.3\" -DYYTEXT_POINTER=1 -DHAVE_FCNTL_H=1 -DHAVE_LIMITS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_WORDEXP_H=1 -DHAVE_READLINE=1 -I. -I$(srcdir)
|
||||||
|
CPPFLAGS =
|
||||||
|
LDFLAGS =
|
||||||
|
libmdbodbc_la_LDFLAGS =
|
||||||
|
libmdbodbc_la_LIBADD =
|
||||||
|
libmdbodbc_la_OBJECTS = odbc.lo connectparams.lo
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
unittest_SOURCES = unittest.c
|
||||||
|
unittest_OBJECTS = unittest.o
|
||||||
|
unittest_DEPENDENCIES = libmdbodbc.la ../libmdb/libmdb.la \
|
||||||
|
../sql/libmdbsql.la
|
||||||
|
unittest_LDFLAGS =
|
||||||
|
CFLAGS = -g -O2
|
||||||
|
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 $@
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
TAR = gtar
|
||||||
|
GZIP_ENV = --best
|
||||||
|
DEP_FILES = .deps/connectparams.P .deps/odbc.P .deps/unittest.P
|
||||||
|
SOURCES = $(libmdbodbc_la_SOURCES) unittest.c
|
||||||
|
OBJECTS = $(libmdbodbc_la_OBJECTS) unittest.o
|
||||||
|
|
||||||
|
all: all-redirect
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .S .c .lo .o .s
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/odbc/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
clean-libLTLIBRARIES:
|
||||||
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
distclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
maintainer-clean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-libLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.s.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.o core *.core
|
||||||
|
|
||||||
|
clean-compile:
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
.s.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
|
||||||
|
maintainer-clean-libtool:
|
||||||
|
|
||||||
|
libmdbodbc.la: $(libmdbodbc_la_OBJECTS) $(libmdbodbc_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(libdir) $(libmdbodbc_la_LDFLAGS) $(libmdbodbc_la_OBJECTS) $(libmdbodbc_la_LIBADD) $(LIBS)
|
||||||
|
|
||||||
|
mostlyclean-binPROGRAMS:
|
||||||
|
|
||||||
|
clean-binPROGRAMS:
|
||||||
|
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
distclean-binPROGRAMS:
|
||||||
|
|
||||||
|
maintainer-clean-binPROGRAMS:
|
||||||
|
|
||||||
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-binPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||||
|
done
|
||||||
|
|
||||||
|
unittest: $(unittest_OBJECTS) $(unittest_DEPENDENCIES)
|
||||||
|
@rm -f unittest
|
||||||
|
$(LINK) $(unittest_LDFLAGS) $(unittest_OBJECTS) $(unittest_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
here=`pwd` && cd $(srcdir) \
|
||||||
|
&& mkid -f$$here/ID $$unique $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||||
|
|
||||||
|
mostlyclean-tags:
|
||||||
|
|
||||||
|
clean-tags:
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID
|
||||||
|
|
||||||
|
maintainer-clean-tags:
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = src/odbc
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/odbc/Makefile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||||
|
|
||||||
|
-include $(DEP_FILES)
|
||||||
|
|
||||||
|
mostlyclean-depend:
|
||||||
|
|
||||||
|
clean-depend:
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
-rm -rf .deps
|
||||||
|
|
||||||
|
maintainer-clean-depend:
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo '$(COMPILE) -c $<'; \
|
||||||
|
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm .deps/$(*F).pp
|
||||||
|
|
||||||
|
%.lo: %.c
|
||||||
|
@echo '$(LTCOMPILE) -c $<'; \
|
||||||
|
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||||
|
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm -f .deps/$(*F).pp
|
||||||
|
info-am:
|
||||||
|
info: info-am
|
||||||
|
dvi-am:
|
||||||
|
dvi: dvi-am
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
installcheck-am:
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
|
||||||
|
install-exec: install-exec-am
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
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: uninstall-am
|
||||||
|
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
|
||||||
|
all-redirect: all-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
mostlyclean-libtool mostlyclean-binPROGRAMS \
|
||||||
|
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \
|
||||||
|
clean-binPROGRAMS clean-tags clean-depend clean-generic \
|
||||||
|
mostlyclean-am
|
||||||
|
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||||
|
distclean-libtool distclean-binPROGRAMS distclean-tags \
|
||||||
|
distclean-depend distclean-generic clean-am
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||||
|
maintainer-clean-compile maintainer-clean-libtool \
|
||||||
|
maintainer-clean-binPROGRAMS maintainer-clean-tags \
|
||||||
|
maintainer-clean-depend maintainer-clean-generic \
|
||||||
|
distclean-am
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||||
|
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||||
|
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
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-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 \
|
||||||
|
mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
odbc: $(EXTRA_LTLIBRARIES)
|
||||||
|
@echo ''
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
12
src/odbc/Makefile.am
Normal file
12
src/odbc/Makefile.am
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
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@
|
||||||
|
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||||
|
|
||||||
|
## Need blank statement to avoid compiling odbc.c
|
||||||
|
odbc: $(EXTRA_LTLIBRARIES)
|
||||||
|
@echo ''
|
||||||
|
|
387
src/odbc/Makefile.in
Normal file
387
src/odbc/Makefile.in
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995-8, 1999 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.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = @SHELL@
|
||||||
|
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
prefix = @prefix@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
|
||||||
|
bindir = @bindir@
|
||||||
|
sbindir = @sbindir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
datadir = @datadir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
sharedstatedir = @sharedstatedir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
libdir = @libdir@
|
||||||
|
infodir = @infodir@
|
||||||
|
mandir = @mandir@
|
||||||
|
includedir = @includedir@
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DESTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
|
|
||||||
|
top_builddir = ../..
|
||||||
|
|
||||||
|
ACLOCAL = @ACLOCAL@
|
||||||
|
AUTOCONF = @AUTOCONF@
|
||||||
|
AUTOMAKE = @AUTOMAKE@
|
||||||
|
AUTOHEADER = @AUTOHEADER@
|
||||||
|
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||||
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
|
transform = @program_transform_name@
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = @host_alias@
|
||||||
|
host_triplet = @host@
|
||||||
|
AS = @AS@
|
||||||
|
CC = @CC@
|
||||||
|
DLLTOOL = @DLLTOOL@
|
||||||
|
LD = @LD@
|
||||||
|
LEX = @LEX@
|
||||||
|
LIBTOOL = @LIBTOOL@
|
||||||
|
LN_S = @LN_S@
|
||||||
|
MAKEINFO = @MAKEINFO@
|
||||||
|
NM = @NM@
|
||||||
|
OBJDUMP = @OBJDUMP@
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
RANLIB = @RANLIB@
|
||||||
|
READLINE_LIBS = @READLINE_LIBS@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
YACC = @YACC@
|
||||||
|
|
||||||
|
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@
|
||||||
|
unittest_LDADD = libmdbodbc.la ../libmdb/libmdb.la ../sql/libmdbsql.la
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
|
||||||
|
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
libmdbodbc_la_LDFLAGS =
|
||||||
|
libmdbodbc_la_LIBADD =
|
||||||
|
libmdbodbc_la_OBJECTS = odbc.lo connectparams.lo
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
unittest_SOURCES = unittest.c
|
||||||
|
unittest_OBJECTS = unittest.o
|
||||||
|
unittest_DEPENDENCIES = libmdbodbc.la ../libmdb/libmdb.la \
|
||||||
|
../sql/libmdbsql.la
|
||||||
|
unittest_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)
|
||||||
|
CCLD = $(CC)
|
||||||
|
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
DIST_COMMON = Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
TAR = gtar
|
||||||
|
GZIP_ENV = --best
|
||||||
|
DEP_FILES = .deps/connectparams.P .deps/odbc.P .deps/unittest.P
|
||||||
|
SOURCES = $(libmdbodbc_la_SOURCES) unittest.c
|
||||||
|
OBJECTS = $(libmdbodbc_la_OBJECTS) unittest.o
|
||||||
|
|
||||||
|
all: all-redirect
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .S .c .lo .o .s
|
||||||
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu src/odbc/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
clean-libLTLIBRARIES:
|
||||||
|
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||||
|
|
||||||
|
distclean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
maintainer-clean-libLTLIBRARIES:
|
||||||
|
|
||||||
|
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||||
|
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-libLTLIBRARIES:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||||
|
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.s.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.o core *.core
|
||||||
|
|
||||||
|
clean-compile:
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
.s.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
|
||||||
|
maintainer-clean-libtool:
|
||||||
|
|
||||||
|
libmdbodbc.la: $(libmdbodbc_la_OBJECTS) $(libmdbodbc_la_DEPENDENCIES)
|
||||||
|
$(LINK) -rpath $(libdir) $(libmdbodbc_la_LDFLAGS) $(libmdbodbc_la_OBJECTS) $(libmdbodbc_la_LIBADD) $(LIBS)
|
||||||
|
|
||||||
|
mostlyclean-binPROGRAMS:
|
||||||
|
|
||||||
|
clean-binPROGRAMS:
|
||||||
|
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
distclean-binPROGRAMS:
|
||||||
|
|
||||||
|
maintainer-clean-binPROGRAMS:
|
||||||
|
|
||||||
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-binPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
|
||||||
|
done
|
||||||
|
|
||||||
|
unittest: $(unittest_OBJECTS) $(unittest_DEPENDENCIES)
|
||||||
|
@rm -f unittest
|
||||||
|
$(LINK) $(unittest_LDFLAGS) $(unittest_OBJECTS) $(unittest_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
here=`pwd` && cd $(srcdir) \
|
||||||
|
&& mkid -f$$here/ID $$unique $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||||
|
|
||||||
|
mostlyclean-tags:
|
||||||
|
|
||||||
|
clean-tags:
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID
|
||||||
|
|
||||||
|
maintainer-clean-tags:
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = src/odbc
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/odbc/Makefile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
if test -d $$d/$$file; then \
|
||||||
|
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||||
|
else \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||||
|
|
||||||
|
-include $(DEP_FILES)
|
||||||
|
|
||||||
|
mostlyclean-depend:
|
||||||
|
|
||||||
|
clean-depend:
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
-rm -rf .deps
|
||||||
|
|
||||||
|
maintainer-clean-depend:
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo '$(COMPILE) -c $<'; \
|
||||||
|
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm .deps/$(*F).pp
|
||||||
|
|
||||||
|
%.lo: %.c
|
||||||
|
@echo '$(LTCOMPILE) -c $<'; \
|
||||||
|
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||||
|
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||||
|
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||||
|
tr ' ' '\012' < .deps/$(*F).pp \
|
||||||
|
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||||
|
>> .deps/$(*F).P; \
|
||||||
|
rm -f .deps/$(*F).pp
|
||||||
|
info-am:
|
||||||
|
info: info-am
|
||||||
|
dvi-am:
|
||||||
|
dvi: dvi-am
|
||||||
|
check-am: all-am
|
||||||
|
check: check-am
|
||||||
|
installcheck-am:
|
||||||
|
installcheck: installcheck-am
|
||||||
|
install-exec-am: install-libLTLIBRARIES install-binPROGRAMS
|
||||||
|
install-exec: install-exec-am
|
||||||
|
|
||||||
|
install-data-am:
|
||||||
|
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: uninstall-am
|
||||||
|
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS)
|
||||||
|
all-redirect: all-am
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
mostlyclean-libtool mostlyclean-binPROGRAMS \
|
||||||
|
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||||
|
|
||||||
|
mostlyclean: mostlyclean-am
|
||||||
|
|
||||||
|
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \
|
||||||
|
clean-binPROGRAMS clean-tags clean-depend clean-generic \
|
||||||
|
mostlyclean-am
|
||||||
|
|
||||||
|
clean: clean-am
|
||||||
|
|
||||||
|
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||||
|
distclean-libtool distclean-binPROGRAMS distclean-tags \
|
||||||
|
distclean-depend distclean-generic clean-am
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
distclean: distclean-am
|
||||||
|
|
||||||
|
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||||
|
maintainer-clean-compile maintainer-clean-libtool \
|
||||||
|
maintainer-clean-binPROGRAMS maintainer-clean-tags \
|
||||||
|
maintainer-clean-depend maintainer-clean-generic \
|
||||||
|
distclean-am
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-am
|
||||||
|
|
||||||
|
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||||
|
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||||
|
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||||
|
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-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 \
|
||||||
|
mostlyclean distclean maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
odbc: $(EXTRA_LTLIBRARIES)
|
||||||
|
@echo ''
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
447
src/odbc/connectparams.c
Normal file
447
src/odbc/connectparams.c
Normal file
@ -0,0 +1,447 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "connectparams.h"
|
||||||
|
|
||||||
|
#ifndef SYS_ODBC_INI
|
||||||
|
#define SYS_ODBC_INI "/etc/odbc.ini"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define max_line 256
|
||||||
|
static char line[max_line];
|
||||||
|
|
||||||
|
static guint HashFunction (gconstpointer key);
|
||||||
|
static GString* GetIniFileName ();
|
||||||
|
static int FileExists (const gchar* name);
|
||||||
|
static int FindSection (FILE* stream, const char* section);
|
||||||
|
static int GetNextItem (FILE* stream, char** name, char** value);
|
||||||
|
|
||||||
|
static void visit (gpointer key, gpointer value, gpointer user_data);
|
||||||
|
static gboolean cleanup (gpointer key, gpointer value, gpointer user_data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Allocate create a ConnectParams object
|
||||||
|
*/
|
||||||
|
|
||||||
|
ConnectParams* NewConnectParams ()
|
||||||
|
{
|
||||||
|
ConnectParams* params = malloc (sizeof (ConnectParams));
|
||||||
|
if (!params)
|
||||||
|
return params;
|
||||||
|
|
||||||
|
params->dsnName = g_string_new ("");
|
||||||
|
params->iniFileName = NULL;
|
||||||
|
params->table = g_hash_table_new (HashFunction, g_str_equal);
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Destroy a ConnectParams object
|
||||||
|
*/
|
||||||
|
|
||||||
|
void FreeConnectParams (ConnectParams* params)
|
||||||
|
{
|
||||||
|
if (params)
|
||||||
|
{
|
||||||
|
if (params->dsnName)
|
||||||
|
g_string_free (params->dsnName, TRUE);
|
||||||
|
if (params->iniFileName)
|
||||||
|
g_string_free (params->iniFileName, TRUE);
|
||||||
|
if (params->table)
|
||||||
|
{
|
||||||
|
g_hash_table_foreach_remove (params->table, cleanup, NULL);
|
||||||
|
g_hash_table_destroy (params->table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find the settings for the specified ODBC DSN
|
||||||
|
*/
|
||||||
|
|
||||||
|
gboolean LookupDSN (ConnectParams* params, const gchar* dsnName)
|
||||||
|
{
|
||||||
|
if (!params) {
|
||||||
|
fprintf(stderr,"LookupDSN: no parameters, returning FALSE");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Set the DSN name property
|
||||||
|
*/
|
||||||
|
/* params->dsnName = g_string_assign (params->dsnName, dsnName); */
|
||||||
|
/*
|
||||||
|
* Search for the ODBC ini file
|
||||||
|
*/
|
||||||
|
if (!(params->iniFileName = GetIniFileName ())) {
|
||||||
|
fprintf(stderr,"LookupDSN: GetIniFileName returned FALSE");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LoadDSN (params->iniFileName->str, dsnName, params->table)) {
|
||||||
|
fprintf(stderr,"LookupDSN: LoadDSN returned FALSE");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get the value of a given ODBC Connection Parameter
|
||||||
|
*/
|
||||||
|
|
||||||
|
gchar* GetConnectParam (ConnectParams* params, const gchar* paramName)
|
||||||
|
{
|
||||||
|
if (!params || !params->table)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return g_hash_table_lookup (params->table, paramName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Apply a connection string to the ODBC Parameter Settings
|
||||||
|
*/
|
||||||
|
|
||||||
|
void SetConnectString (ConnectParams* params, const gchar* connectString)
|
||||||
|
{
|
||||||
|
int end;
|
||||||
|
char *cs, *s, *p, *name, *value;
|
||||||
|
gpointer key;
|
||||||
|
gpointer oldvalue;
|
||||||
|
|
||||||
|
if (!params)
|
||||||
|
return;
|
||||||
|
/*
|
||||||
|
* Make a copy of the connection string so we can modify it
|
||||||
|
*/
|
||||||
|
cs = strdup (connectString);
|
||||||
|
s = cs;
|
||||||
|
/*
|
||||||
|
* Loop over ';' seperated name=value pairs
|
||||||
|
*/
|
||||||
|
p = strchr (s, '=');
|
||||||
|
while (p)
|
||||||
|
{
|
||||||
|
if (p) *p = '\0';
|
||||||
|
/*
|
||||||
|
* Extract name
|
||||||
|
*/
|
||||||
|
name = s;
|
||||||
|
if (p) s = p + 1;
|
||||||
|
/*
|
||||||
|
* Extract value
|
||||||
|
*/
|
||||||
|
p = strchr (s, ';');
|
||||||
|
if (p) *p = '\0';
|
||||||
|
value = s;
|
||||||
|
if (p) s = p + 1;
|
||||||
|
/*
|
||||||
|
* remove trailing spaces from name
|
||||||
|
*/
|
||||||
|
end = strlen (name) - 1;
|
||||||
|
while (end > 0 && name[end] == ' ')
|
||||||
|
name[end--] = '\0';
|
||||||
|
/*
|
||||||
|
* remove leading spaces from value
|
||||||
|
*/
|
||||||
|
while (*value == ' ')
|
||||||
|
value++;
|
||||||
|
|
||||||
|
if (g_hash_table_lookup_extended (params->table, name, &key, &oldvalue))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* remove previous value
|
||||||
|
*/
|
||||||
|
g_hash_table_remove (params->table, key);
|
||||||
|
/*
|
||||||
|
* cleanup strings
|
||||||
|
*/
|
||||||
|
free (key);
|
||||||
|
free (oldvalue);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Insert the name/value pair into the hash table.
|
||||||
|
*
|
||||||
|
* Note that these strdup allocations are freed in cleanup,
|
||||||
|
* which is called by FreeConnectParams.
|
||||||
|
*/
|
||||||
|
g_hash_table_insert (params->table, strdup (name), strdup (value));
|
||||||
|
|
||||||
|
p = strchr (s, '=');
|
||||||
|
}
|
||||||
|
|
||||||
|
free (cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Dump all the ODBC Connection Paramters to a file (e.g. stdout)
|
||||||
|
*/
|
||||||
|
|
||||||
|
void DumpParams (ConnectParams* params, FILE* output)
|
||||||
|
{
|
||||||
|
if (!params)
|
||||||
|
{
|
||||||
|
g_printerr ("NULL ConnectionParams pointer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params->dsnName)
|
||||||
|
g_printerr ("Parameter values for DSN: %s\n", params->dsnName->str);
|
||||||
|
|
||||||
|
if (params->iniFileName)
|
||||||
|
g_printerr ("Ini File is %s\n", params->iniFileName->str);
|
||||||
|
|
||||||
|
g_hash_table_foreach (params->table, visit, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the value of the DSN from the conneciton string
|
||||||
|
*/
|
||||||
|
|
||||||
|
gchar* ExtractDSN (ConnectParams* params, const gchar* connectString)
|
||||||
|
{
|
||||||
|
char *p, *q, *s;
|
||||||
|
|
||||||
|
if (!params)
|
||||||
|
return NULL;
|
||||||
|
/*
|
||||||
|
* Position ourselves to the beginning of "DSN"
|
||||||
|
*/
|
||||||
|
p = strstr (connectString, "DSN");
|
||||||
|
if (!p) return NULL;
|
||||||
|
/*
|
||||||
|
* Position ourselves to the "="
|
||||||
|
*/
|
||||||
|
q = strchr (p, '=');
|
||||||
|
if (!q) return NULL;
|
||||||
|
/*
|
||||||
|
* Skip over any leading spaces
|
||||||
|
*/
|
||||||
|
q++;
|
||||||
|
while (*q == ' ')
|
||||||
|
q++;
|
||||||
|
/*
|
||||||
|
* Copy the DSN value to a buffer
|
||||||
|
*/
|
||||||
|
s = line;
|
||||||
|
while (*q && *q != ';')
|
||||||
|
*s++ = *q++;
|
||||||
|
*s = '\0';
|
||||||
|
/*
|
||||||
|
* Save it as a string in the params object
|
||||||
|
*/
|
||||||
|
params->dsnName = g_string_assign (params->dsnName, line);
|
||||||
|
|
||||||
|
return params->dsnName->str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Begin local function definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
static GString* GetIniFileName ()
|
||||||
|
{
|
||||||
|
char* setting;
|
||||||
|
GString* iniFileName = g_string_new ("");
|
||||||
|
/*
|
||||||
|
* First, try the ODBCINI environment variable
|
||||||
|
*/
|
||||||
|
if ((setting = getenv ("ODBCINI")) != NULL)
|
||||||
|
{
|
||||||
|
g_string_assign (iniFileName, getenv ("ODBCINI"));
|
||||||
|
|
||||||
|
if (FileExists (iniFileName->str))
|
||||||
|
return iniFileName;
|
||||||
|
|
||||||
|
g_string_assign (iniFileName, "");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Second, try the HOME environment variable
|
||||||
|
*/
|
||||||
|
if ((setting = getenv ("HOME")) != NULL)
|
||||||
|
{
|
||||||
|
g_string_assign (iniFileName, setting);
|
||||||
|
iniFileName = g_string_append (iniFileName, "/.odbc.ini");
|
||||||
|
|
||||||
|
if (FileExists (iniFileName->str))
|
||||||
|
return iniFileName;
|
||||||
|
|
||||||
|
g_string_assign (iniFileName, "");
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* As a last resort, try SYS_ODBC_INI
|
||||||
|
*/
|
||||||
|
g_string_assign (iniFileName, SYS_ODBC_INI);
|
||||||
|
if (FileExists (iniFileName->str))
|
||||||
|
return iniFileName;
|
||||||
|
|
||||||
|
g_string_assign (iniFileName, "");
|
||||||
|
|
||||||
|
return iniFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FileExists (const gchar* name)
|
||||||
|
{
|
||||||
|
struct stat fileStat;
|
||||||
|
|
||||||
|
return (stat (name, &fileStat) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int FindSection (FILE* stream, const char* section)
|
||||||
|
{
|
||||||
|
char* s;
|
||||||
|
char sectionPattern[max_line];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
strcpy (sectionPattern, "[");
|
||||||
|
strcat (sectionPattern, section);
|
||||||
|
strcat (sectionPattern, "]");
|
||||||
|
|
||||||
|
s = fgets (line, max_line, stream);
|
||||||
|
while (s != NULL)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Get rid of the newline character
|
||||||
|
*/
|
||||||
|
len = strlen (line);
|
||||||
|
if (len > 0) line[strlen (line) - 1] = '\0';
|
||||||
|
/*
|
||||||
|
* look for the section header
|
||||||
|
*/
|
||||||
|
if (strcmp (line, sectionPattern) == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
s = fgets (line, max_line, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LoadDSN (
|
||||||
|
const gchar* iniFileName, const gchar* dsnName, GHashTable* table)
|
||||||
|
{
|
||||||
|
FILE* stream;
|
||||||
|
gchar* name;
|
||||||
|
gchar* value;
|
||||||
|
|
||||||
|
if ((stream = fopen (iniFileName, "r" )) != NULL )
|
||||||
|
{
|
||||||
|
if (!FindSection (stream, dsnName))
|
||||||
|
{
|
||||||
|
g_printerr ("Couldn't find DSN %s in %s\n", iniFileName, dsnName);
|
||||||
|
fclose (stream);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (GetNextItem (stream, &name, &value))
|
||||||
|
{
|
||||||
|
g_hash_table_insert (table, strdup (name), strdup (value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose( stream );
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make a hash from all the characters
|
||||||
|
*/
|
||||||
|
static guint HashFunction (gconstpointer key)
|
||||||
|
{
|
||||||
|
guint value = 0;
|
||||||
|
const char* s = key;
|
||||||
|
|
||||||
|
while (*s) value += *s++;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GetNextItem (FILE* stream, char** name, char** value)
|
||||||
|
{
|
||||||
|
char* s;
|
||||||
|
int len;
|
||||||
|
char equals[] = "="; /* used for seperator for strtok */
|
||||||
|
char* token;
|
||||||
|
|
||||||
|
if (name == NULL || value == NULL)
|
||||||
|
{
|
||||||
|
g_printerr ("GetNextItem, invalid parameters");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = fgets (line, max_line, stream);
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
perror ("fgets");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Get rid of the newline character
|
||||||
|
*/
|
||||||
|
len = strlen (line);
|
||||||
|
if (len > 0) line[strlen (line) - 1] = '\0';
|
||||||
|
/*
|
||||||
|
* Extract name from name = value
|
||||||
|
*/
|
||||||
|
if ((token = strtok (line, equals)) == NULL) return 0;
|
||||||
|
|
||||||
|
len = strlen (token);
|
||||||
|
while (len > 0 && token[len-1] == ' ')
|
||||||
|
{
|
||||||
|
len--;
|
||||||
|
token[len] = '\0';
|
||||||
|
}
|
||||||
|
*name = token;
|
||||||
|
/*
|
||||||
|
* extract value from name = value
|
||||||
|
*/
|
||||||
|
token = strtok (NULL, equals);
|
||||||
|
if (token == NULL) return 0;
|
||||||
|
while (*token && token[0] == ' ')
|
||||||
|
token++;
|
||||||
|
|
||||||
|
*value = token;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void visit (gpointer key, gpointer value, gpointer user_data)
|
||||||
|
{
|
||||||
|
FILE* output = (FILE*) user_data;
|
||||||
|
|
||||||
|
g_printerr ("Parameter: %s, Value: %s\n", key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean cleanup (gpointer key, gpointer value, gpointer user_data)
|
||||||
|
{
|
||||||
|
free (key);
|
||||||
|
free (value);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
42
src/odbc/connectparams.h
Normal file
42
src/odbc/connectparams.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/* 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 _ODBC_INI_LOAD_
|
||||||
|
#define _ODBC_INI_LOAD_
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GString* dsnName;
|
||||||
|
GString* iniFileName;
|
||||||
|
GHashTable* table;
|
||||||
|
} ConnectParams;
|
||||||
|
|
||||||
|
ConnectParams* NewConnectParams ();
|
||||||
|
void FreeConnectParams (ConnectParams* params);
|
||||||
|
|
||||||
|
gboolean LookupDSN (ConnectParams* params, const gchar* dsnName);
|
||||||
|
gchar* GetConnectParam (ConnectParams* params, const gchar* paramName);
|
||||||
|
void SetConnectString (ConnectParams* params, const gchar* connectString);
|
||||||
|
void DumpParams (ConnectParams* params, FILE* output);
|
||||||
|
|
||||||
|
gchar* ExtractDSN (ConnectParams* params, const gchar* connectString);
|
||||||
|
|
||||||
|
#endif
|
1042
src/odbc/odbc.c
Normal file
1042
src/odbc/odbc.c
Normal file
File diff suppressed because it is too large
Load Diff
243
src/odbc/unittest.c
Normal file
243
src/odbc/unittest.c
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
|
||||||
|
* Copyright (C) 1998-1999 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* #include <windows.h> */
|
||||||
|
#include <isql.h>
|
||||||
|
#include <isqlext.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static char software_version[] = "$Id: unittest.c,v 1.1 2001/07/10 22:36:20 brianb Exp $";
|
||||||
|
static void *no_unused_var_warn[] = {software_version,
|
||||||
|
no_unused_var_warn};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SALES_PERSON_LEN 2
|
||||||
|
#define STATUS_LEN 6
|
||||||
|
|
||||||
|
SQLSMALLINT sOrderID;
|
||||||
|
SQLSMALLINT sCustID;
|
||||||
|
DATE_STRUCT dsOpenDate;
|
||||||
|
SQLCHAR szSalesPerson[SALES_PERSON_LEN] = "D";
|
||||||
|
SQLCHAR szStatus[STATUS_LEN];
|
||||||
|
SQLINTEGER cbOrderID = 0, cbCustID = 0, cbOpenDate = 0, cbSalesPerson = SQL_NTS,
|
||||||
|
cbStatus = SQL_NTS;
|
||||||
|
SQLRETURN retcode;
|
||||||
|
HENV henv;
|
||||||
|
HDBC hdbc;
|
||||||
|
SQLHSTMT hstmt;
|
||||||
|
|
||||||
|
|
||||||
|
static void printStatementError(HSTMT hstmt, char *msg)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"%s\n%s\n%s\n",msg,
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
retcode = SQLAllocEnv(&henv);
|
||||||
|
|
||||||
|
if (SQLAllocConnect(henv, &hdbc) != SQL_SUCCESS)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(henv, SQL_NULL_HDBC, SQL_NULL_HSTMT,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLAllocConnect\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
retcode = SQLSetConnectOption(hdbc, SQL_ACCESS_MODE, SQL_MODE_READ_ONLY);
|
||||||
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLSetConnectOption\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
retcode = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON);
|
||||||
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLSetConnectOption\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
retcode = SQLConnect(hdbc,
|
||||||
|
/*
|
||||||
|
(UCHAR *)"SYBASE", SQL_NTS,
|
||||||
|
(UCHAR *)"ken", SQL_NTS,
|
||||||
|
(UCHAR *)"asdfasdf", SQL_NTS);
|
||||||
|
*/
|
||||||
|
(UCHAR *)"Northwind", SQL_NTS,
|
||||||
|
(UCHAR *)"", SQL_NTS,
|
||||||
|
(UCHAR *)"", SQL_NTS);
|
||||||
|
/* sleep(600); */
|
||||||
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLConnect\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (SQLAllocStmt(hdbc, &hstmt)!= SQL_SUCCESS)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, hdbc, SQL_NULL_HSTMT,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLAllocStmt\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
retcode = SQLTables(hstmt,
|
||||||
|
(unsigned char *) NULL, 0,
|
||||||
|
(unsigned char *) "%", 1,
|
||||||
|
(unsigned char *) "%", 1,
|
||||||
|
(unsigned char *) "VIEW,TABLE", 10);
|
||||||
|
if (! (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO))
|
||||||
|
{
|
||||||
|
printf("got table stuff\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printStatementError(hstmt, "SQLTable");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
/* Prepare the SQL statement with parameter markers. */
|
||||||
|
|
||||||
|
retcode = SQLPrepare(hstmt,
|
||||||
|
(unsigned char *)"select ShipName from Orders where OrderID > 11000",
|
||||||
|
SQL_NTS);
|
||||||
|
|
||||||
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
|
{
|
||||||
|
long p1;
|
||||||
|
// char p2[256];
|
||||||
|
long p1Len = sizeof(p1);
|
||||||
|
// long p2Len;
|
||||||
|
long sAge = 1023;
|
||||||
|
long cbAge = sizeof(long);
|
||||||
|
UCHAR szCol1[60];
|
||||||
|
|
||||||
|
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER,
|
||||||
|
0, 0, szCol1, 0, &p1Len);
|
||||||
|
|
||||||
|
// p1Len = SQL_NULL_DATA;
|
||||||
|
/* Execute statement with first row. */
|
||||||
|
|
||||||
|
p1 = 8192;
|
||||||
|
// p1[0] = '%';
|
||||||
|
// p1Len = 1;
|
||||||
|
// p2[0] = '%';
|
||||||
|
// p2Len = 1;
|
||||||
|
printf("excecuting first statement\n");
|
||||||
|
retcode = SQLExecute(hstmt);
|
||||||
|
if (retcode != SQL_SUCCESS)
|
||||||
|
{
|
||||||
|
UCHAR szSqlState[6];
|
||||||
|
UCHAR szErrorMsg[SQL_MAX_MESSAGE_LENGTH];
|
||||||
|
SDWORD dwNativeError;
|
||||||
|
SWORD wErrorMsg;
|
||||||
|
|
||||||
|
SQLError(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
||||||
|
szSqlState, &dwNativeError, szErrorMsg,
|
||||||
|
SQL_MAX_MESSAGE_LENGTH-1, &wErrorMsg);
|
||||||
|
|
||||||
|
fprintf(stderr,"problem with SQLExecute\n%s\n%s\n",
|
||||||
|
szSqlState, szErrorMsg);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
|
||||||
|
{
|
||||||
|
// nop
|
||||||
|
printf("szCol1 = %s\n",szCol1);
|
||||||
|
}
|
||||||
|
if (retcode != SQL_NO_DATA_FOUND)
|
||||||
|
{
|
||||||
|
printStatementError(hstmt, "problem with SQLFetch");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
SQLCloseCursor(hstmt);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
printf("Done\n");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user