Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
225929e650 |
162 changed files with 18591 additions and 26495 deletions
149
.clang-tidy
149
.clang-tidy
|
@ -1,149 +0,0 @@
|
||||||
# Generated from CLion Inspection settings
|
|
||||||
#bugprone-reserved-identifier,
|
|
||||||
---
|
|
||||||
Checks: '-*,
|
|
||||||
-deprecated-non-prototype
|
|
||||||
bugprone-argument-comment,
|
|
||||||
bugprone-assert-side-effect,
|
|
||||||
bugprone-bad-signal-to-kill-thread,
|
|
||||||
bugprone-branch-clone,
|
|
||||||
bugprone-copy-constructor-init,
|
|
||||||
bugprone-dangling-handle,
|
|
||||||
bugprone-dynamic-static-initializers,
|
|
||||||
bugprone-fold-init-type,
|
|
||||||
bugprone-forward-declaration-namespace,
|
|
||||||
bugprone-forwarding-reference-overload,
|
|
||||||
bugprone-inaccurate-erase,
|
|
||||||
bugprone-incorrect-roundings,
|
|
||||||
bugprone-integer-division,
|
|
||||||
bugprone-lambda-function-name,
|
|
||||||
bugprone-macro-parentheses,
|
|
||||||
bugprone-macro-repeated-side-effects,
|
|
||||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
|
||||||
bugprone-misplaced-pointer-arithmetic-in-alloc,
|
|
||||||
bugprone-misplaced-widening-cast,
|
|
||||||
bugprone-move-forwarding-reference,
|
|
||||||
bugprone-multiple-statement-macro,
|
|
||||||
bugprone-no-escape,
|
|
||||||
bugprone-not-null-terminated-result,
|
|
||||||
bugprone-parent-virtual-call,
|
|
||||||
bugprone-posix-return,
|
|
||||||
bugprone-sizeof-container,
|
|
||||||
bugprone-sizeof-expression,
|
|
||||||
bugprone-spuriously-wake-up-functions,
|
|
||||||
bugprone-string-constructor,
|
|
||||||
bugprone-string-integer-assignment,
|
|
||||||
bugprone-string-literal-with-embedded-nul,
|
|
||||||
bugprone-suspicious-enum-usage,
|
|
||||||
bugprone-suspicious-include,
|
|
||||||
bugprone-suspicious-memset-usage,
|
|
||||||
bugprone-suspicious-missing-comma,
|
|
||||||
bugprone-suspicious-semicolon,
|
|
||||||
bugprone-suspicious-string-compare,
|
|
||||||
bugprone-suspicious-memory-comparison,
|
|
||||||
bugprone-suspicious-realloc-usage,
|
|
||||||
bugprone-swapped-arguments,
|
|
||||||
bugprone-terminating-continue,
|
|
||||||
bugprone-throw-keyword-missing,
|
|
||||||
bugprone-too-small-loop-variable,
|
|
||||||
bugprone-undefined-memory-manipulation,
|
|
||||||
bugprone-undelegated-constructor,
|
|
||||||
bugprone-unhandled-self-assignment,
|
|
||||||
bugprone-unused-raii,
|
|
||||||
bugprone-unused-return-value,
|
|
||||||
bugprone-use-after-move,
|
|
||||||
bugprone-virtual-near-miss,
|
|
||||||
cert-dcl21-cpp,
|
|
||||||
cert-dcl58-cpp,
|
|
||||||
cert-err34-c,
|
|
||||||
cert-err52-cpp,
|
|
||||||
cert-err60-cpp,
|
|
||||||
cert-flp30-c,
|
|
||||||
cert-msc50-cpp,
|
|
||||||
cert-msc51-cpp,
|
|
||||||
cert-str34-c,
|
|
||||||
cppcoreguidelines-interfaces-global-init,
|
|
||||||
cppcoreguidelines-narrowing-conversions,
|
|
||||||
cppcoreguidelines-pro-type-member-init,
|
|
||||||
cppcoreguidelines-pro-type-static-cast-downcast,
|
|
||||||
cppcoreguidelines-slicing,
|
|
||||||
google-default-arguments,
|
|
||||||
google-explicit-constructor,
|
|
||||||
google-runtime-operator,
|
|
||||||
hicpp-exception-baseclass,
|
|
||||||
hicpp-multiway-paths-covered,
|
|
||||||
misc-misplaced-const,
|
|
||||||
misc-new-delete-overloads,
|
|
||||||
misc-no-recursion,
|
|
||||||
misc-non-copyable-objects,
|
|
||||||
misc-throw-by-value-catch-by-reference,
|
|
||||||
misc-unconventional-assign-operator,
|
|
||||||
misc-uniqueptr-reset-release,
|
|
||||||
modernize-avoid-bind,
|
|
||||||
modernize-concat-nested-namespaces,
|
|
||||||
modernize-deprecated-headers,
|
|
||||||
modernize-deprecated-ios-base-aliases,
|
|
||||||
modernize-loop-convert,
|
|
||||||
modernize-make-shared,
|
|
||||||
modernize-make-unique,
|
|
||||||
modernize-pass-by-value,
|
|
||||||
modernize-raw-string-literal,
|
|
||||||
modernize-redundant-void-arg,
|
|
||||||
modernize-replace-auto-ptr,
|
|
||||||
modernize-replace-disallow-copy-and-assign-macro,
|
|
||||||
modernize-replace-random-shuffle,
|
|
||||||
modernize-return-braced-init-list,
|
|
||||||
modernize-shrink-to-fit,
|
|
||||||
modernize-unary-static-assert,
|
|
||||||
modernize-use-auto,
|
|
||||||
modernize-use-bool-literals,
|
|
||||||
modernize-use-emplace,
|
|
||||||
modernize-use-equals-default,
|
|
||||||
modernize-use-equals-delete,
|
|
||||||
modernize-use-nodiscard,
|
|
||||||
modernize-use-noexcept,
|
|
||||||
modernize-use-nullptr,
|
|
||||||
modernize-use-override,
|
|
||||||
modernize-use-transparent-functors,
|
|
||||||
modernize-use-uncaught-exceptions,
|
|
||||||
mpi-buffer-deref,
|
|
||||||
mpi-type-mismatch,
|
|
||||||
openmp-use-default-none,
|
|
||||||
performance-faster-string-find,
|
|
||||||
performance-for-range-copy,
|
|
||||||
performance-implicit-conversion-in-loop,
|
|
||||||
performance-inefficient-algorithm,
|
|
||||||
performance-inefficient-string-concatenation,
|
|
||||||
performance-inefficient-vector-operation,
|
|
||||||
performance-move-const-arg,
|
|
||||||
performance-move-constructor-init,
|
|
||||||
performance-no-automatic-move,
|
|
||||||
performance-noexcept-move-constructor,
|
|
||||||
performance-trivially-destructible,
|
|
||||||
performance-type-promotion-in-math-fn,
|
|
||||||
performance-unnecessary-copy-initialization,
|
|
||||||
performance-unnecessary-value-param,
|
|
||||||
portability-simd-intrinsics,
|
|
||||||
readability-avoid-const-params-in-decls,
|
|
||||||
readability-const-return-type,
|
|
||||||
readability-container-size-empty,
|
|
||||||
readability-convert-member-functions-to-static,
|
|
||||||
readability-delete-null-pointer,
|
|
||||||
readability-deleted-default,
|
|
||||||
readability-inconsistent-declaration-parameter-name,
|
|
||||||
readability-make-member-function-const,
|
|
||||||
readability-misleading-indentation,
|
|
||||||
readability-misplaced-array-index,
|
|
||||||
readability-non-const-parameter,
|
|
||||||
readability-redundant-control-flow,
|
|
||||||
readability-redundant-declaration,
|
|
||||||
readability-redundant-function-ptr-dereference,
|
|
||||||
readability-redundant-smartptr-get,
|
|
||||||
readability-redundant-string-cstr,
|
|
||||||
readability-redundant-string-init,
|
|
||||||
readability-simplify-subscript-expr,
|
|
||||||
readability-static-accessed-through-instance,
|
|
||||||
readability-static-definition-in-anonymous-namespace,
|
|
||||||
readability-string-compare,
|
|
||||||
readability-uniqueptr-delete-release,
|
|
||||||
readability-use-anyofallof'
|
|
|
@ -1,30 +0,0 @@
|
||||||
# Editor configuration, see http://editorconfig.org
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
# Ignore diffs/patches
|
|
||||||
[*.{diff,patch}]
|
|
||||||
end_of_line = unset
|
|
||||||
insert_final_newline = unset
|
|
||||||
trim_trailing_whitespace = unset
|
|
||||||
indent_size = unset
|
|
||||||
|
|
||||||
[*.c]
|
|
||||||
ident_style = tab
|
|
||||||
ident_size = 8
|
|
||||||
|
|
||||||
[{Makefile,**.mk}]
|
|
||||||
# Use tabs for indentation (Makefiles require tabs)
|
|
||||||
indent_style = tab
|
|
||||||
ident_size = 4
|
|
||||||
|
|
||||||
[*.md]
|
|
||||||
max_line_length = off
|
|
||||||
trim_trailing_whitespace = false
|
|
6
.envrc
6
.envrc
|
@ -1,6 +0,0 @@
|
||||||
export DBSQL_VERSION="$(sh -c '. ./dist/RELEASE; echo $DBSQL_VERSION')"
|
|
||||||
export DBSQL_VERSION_STRING="$(sh -c '. ./dist/RELEASE; echo $DBSQL_VERSION_STRING')"
|
|
||||||
|
|
||||||
#dotenv
|
|
||||||
watch_file devShell.nix shell.nix flake.nix
|
|
||||||
use flake || use nix
|
|
13
.gitignore
vendored
13
.gitignore
vendored
|
@ -1,13 +0,0 @@
|
||||||
build_unix/**
|
|
||||||
*~
|
|
||||||
TAGS
|
|
||||||
tags
|
|
||||||
.direnv/
|
|
||||||
.idea/
|
|
||||||
dist/autom4te.cache/
|
|
||||||
dist/config.hin
|
|
||||||
dist/configure
|
|
||||||
dist/config.log
|
|
||||||
src/py/setup.py
|
|
||||||
test/scr050/Makefile
|
|
||||||
result-bin
|
|
46
README
46
README
|
@ -1,46 +0,0 @@
|
||||||
DBSQL 0.4.0: (May 8, 2024)
|
|
||||||
|
|
||||||
This is version 0.4.0 of DBSQL.
|
|
||||||
|
|
||||||
To view the release and installation documentation, load the distribution
|
|
||||||
file docs/index.html into your web browser.
|
|
||||||
|
|
||||||
This work started from the SQLite project (found on the web at
|
|
||||||
http://www.sqlite.org/). SQLite and all contributions to the SQLite
|
|
||||||
project have been placed in the public domain by its author, Dr. Richard Hipp.
|
|
||||||
There was no assertion of copyright at all on the code I used as a starting
|
|
||||||
point for my work. In fact there are statements that explicitly disclaim
|
|
||||||
copyright. I am asserting copyright on this work, DBSQL. I believe
|
|
||||||
that if you examine the extent to which I've changed, updated, and
|
|
||||||
modified the SQLite code you'll respect my copyright assertion. This
|
|
||||||
is a new product, heavily inspired by another.
|
|
||||||
|
|
||||||
The goal for DBSQL is to provide a small SQL92 relational database layer
|
|
||||||
on top of the Berkeley DB database. Berkeley DB is copyright Oracle
|
|
||||||
Corporation (formerly Sleepycat Software, acquired in Feb 2006) and
|
|
||||||
licensed under the Sleepycat Public License. That license is compatible
|
|
||||||
with the GPL for open source use. Recognize that you, as someone using
|
|
||||||
DBSQL, will need to review the Sleepycat License and the GPL before you
|
|
||||||
use and redistribute your incorporating work. It is your responsibility
|
|
||||||
to comply with those licenses as I am in my work on DBSQL itself. My
|
|
||||||
motivation on a personal level is quite simple, I am in product management
|
|
||||||
these days and not in the code itself. I believe that product managers
|
|
||||||
should be engineers at heart with an ability to understand business,
|
|
||||||
politics, and software sales and support. This is my playground to keep
|
|
||||||
my engineering skills sharp enough to speak fluent geek. As a former
|
|
||||||
engineer at Sleepycat I understand and value the Berkeley DB programming
|
|
||||||
infrasture, design, and methodologies and I have liberally copied and
|
|
||||||
reused them in this project to improve SQLite in ways that I hope will
|
|
||||||
be of value to open source users out there. I did this because I see the
|
|
||||||
value of SQLite to its userbase, it is a perfect example of the 80/20
|
|
||||||
rule and the KISS method and I admire those qualities in software. My
|
|
||||||
hope is that the Berkeley DB database engine will provide some significant
|
|
||||||
features that SQLite cannot such as replication for high availability
|
|
||||||
while remaining small enough to live comfortably inside applications,
|
|
||||||
services, and devices.
|
|
||||||
|
|
||||||
Information and resources pertaining to DBSQL can be found at dbsql.org.
|
|
||||||
|
|
||||||
Commercial licenses without the restrictions found in the GPL can be
|
|
||||||
purchased for this product. See http://dbsql.org/wiki/CommercialUse
|
|
||||||
|
|
78
TODO
78
TODO
|
@ -1,78 +0,0 @@
|
||||||
|
|
||||||
* Rename dbsql_strerror to dbsql_strerr
|
|
||||||
|
|
||||||
* Fix logic issue in query processing
|
|
||||||
tests/smoke2.sql produces incorrect joins
|
|
||||||
|
|
||||||
* Check all DB API calls
|
|
||||||
Make sure a) we check return codes for for all calls into DB and
|
|
||||||
that b) when there is an error we output it only when configured
|
|
||||||
to be verbose and c) then return the proper DBSQL error indicating
|
|
||||||
what went wrong at a higher level.
|
|
||||||
|
|
||||||
* Review all reused DB code
|
|
||||||
Make sure that we're up to date with the latest in DB. Things such
|
|
||||||
as hashing, etc.
|
|
||||||
|
|
||||||
* Find printf/fprintf calls which print error messages
|
|
||||||
The library should never print messages unless configured to be
|
|
||||||
verbose.
|
|
||||||
|
|
||||||
* tests/
|
|
||||||
Fix testing infrastructure.
|
|
||||||
- api.c/__os_sleep()
|
|
||||||
This is now static in DB's code, so to hack the compile I
|
|
||||||
commented out the use of __os_sleep() in api.c
|
|
||||||
- test/scr026
|
|
||||||
This test has not been updated to check for DBSQL API calls
|
|
||||||
rather than DB API calls. Review and fix it.
|
|
||||||
- test/scr030
|
|
||||||
Update this test to match the configure script. Augment it so
|
|
||||||
that as the configure script changes the script reports options
|
|
||||||
not tested.
|
|
||||||
- A few scr??? < 050
|
|
||||||
Some of these tests examine source code but do not include the
|
|
||||||
TCL testing code and so produce false positive FAILures.
|
|
||||||
- Add test/scr0?? to highlight code notes
|
|
||||||
FIXME, TODO, and other source source markers
|
|
||||||
|
|
||||||
* Code quality and build tools
|
|
||||||
- valgrind
|
|
||||||
Fix all memory related bugs.
|
|
||||||
- splint
|
|
||||||
Clean up all items pointed out by splint.
|
|
||||||
- makedepend
|
|
||||||
Finish integrating this into the dist/Makefile
|
|
||||||
|
|
||||||
* Review code for trailing spaces, tab characters, lines > 79 col
|
|
||||||
|
|
||||||
* review dbsql/dbsql.c
|
|
||||||
General clean-up including changing calls to malloc, free, etc to
|
|
||||||
__os_malloc, __os_free, etc.
|
|
||||||
|
|
||||||
* Review SQLite's latest lemon.c and lempar.c code
|
|
||||||
Consider updating to the newest versions of the parser generator.
|
|
||||||
|
|
||||||
* Use LIST/QUEUE macros for linked lists, queues, etc.
|
|
||||||
Find/replace all custom code implementing these simple data
|
|
||||||
structures.
|
|
||||||
|
|
||||||
* Review memory allocation code in general
|
|
||||||
|
|
||||||
* Consider using MPOOL to manage some of DBSQL state across processes
|
|
||||||
Function pools and other aspects of the DBSQL runtime need not be
|
|
||||||
re-created in-memory across multiple processes. When doing this
|
|
||||||
revisit data structures using the LIST/QUEUE macros and shift them
|
|
||||||
to the SH_ equivalents.
|
|
||||||
|
|
||||||
* Random number generator
|
|
||||||
SQLite implements its own suggesting that rand32_r() (and other
|
|
||||||
random number generators) are both truely random and bug free.
|
|
||||||
Some portion of the VDBE requires random numbers to be,
|
|
||||||
well... random, or as close as possible.
|
|
||||||
|
|
||||||
* Review src/vdbe, finish converting to DBSQL-style
|
|
||||||
|
|
||||||
* Investigate the TCL Extension Architecture
|
|
||||||
http://www.tcl.tk/doc/tea/
|
|
||||||
|
|
31
dist/Makefile.in
vendored
31
dist/Makefile.in
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: Makefile.in 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
srcdir= @srcdir@/../src
|
srcdir= @srcdir@/../src
|
||||||
tstdir= @srcdir@/../test
|
tstdir= @srcdir@/../test
|
||||||
|
@ -121,12 +123,12 @@ C_FILES=\
|
||||||
$(srcdir)/lemon/lempar.c $(srcdir)/os/os.c $(srcdir)/clib/random.c \
|
$(srcdir)/lemon/lempar.c $(srcdir)/os/os.c $(srcdir)/clib/random.c \
|
||||||
$(srcdir)/sql_fns.c $(srcdir)/sql_tokenize.c \
|
$(srcdir)/sql_fns.c $(srcdir)/sql_tokenize.c \
|
||||||
$(srcdir)/cg_vacuum.c $(srcdir)/vdbe.c $(srcdir)/vdbe_method.c \
|
$(srcdir)/cg_vacuum.c $(srcdir)/vdbe.c $(srcdir)/vdbe_method.c \
|
||||||
$(srcdir)/common/dbsql_err.c (srcdir)/clib/snprintf.c \
|
$(srcdir)/common/dbsql_err.c $(srcdir)/clib/snprintf.c \
|
||||||
$(srcdir)/os/os_jtime.c $(srcdir)/os/os_sleep.c $(srcdir)/clib/memcmp.c \
|
$(srcdir)/os/os_jtime.c $(srcdir)/clib/memcmp.c \
|
||||||
$(srcdir)/clib/strcasecmp.c $(srcdir)/os/dbsql_alloc.c \
|
$(srcdir)/clib/strcasecmp.c $(srcdir)/os/dbsql_alloc.c \
|
||||||
$(srcdir)/common/str.c $(srcdir)/common/dbsql_atoi.c \
|
$(srcdir)/common/str.c $(srcdir)/common/dbsql_atoi.c \
|
||||||
$(srcdir)/common/dbsql_atof.c $(srcdir)/common/dbsql_fop.c \
|
$(srcdir)/common/dbsql_atof.c $(srcdir)/safety.c \
|
||||||
$(srcdir)/safety.c $(srcdir)/clib/strdup.c
|
$(srcdir)/clib/strdup.c
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Object and utility lists.
|
# Object and utility lists.
|
||||||
|
@ -137,10 +139,9 @@ C_OBJS= cg_attach@o@ cg_insert@o@ sql_tokenize@o@ cg_auth@o@ \
|
||||||
cg_pragma@o@ cg_where@o@ cg_trigger@o@ cg_build@o@ \
|
cg_pragma@o@ cg_where@o@ cg_trigger@o@ cg_build@o@ \
|
||||||
sql_fns@o@ random@o@ cg_update@o@ cg_delete@o@ hash@o@ \
|
sql_fns@o@ random@o@ cg_update@o@ cg_delete@o@ hash@o@ \
|
||||||
cg_expr@o@ opcodes@o@ sql_parser@o@ cg_vacuum@o@ \
|
cg_expr@o@ opcodes@o@ sql_parser@o@ cg_vacuum@o@ \
|
||||||
vdbe@o@ vdbe_method@o@ sm@o@ snprintf@o@ dbsql_err@o@ \
|
vdbe@o@ vdbe_method@o@ sm@o@ snprintf@o@ dbsql_err@o@ cg_select@o@ \
|
||||||
dbsql_fop@o@ cg_select@o@ os_sleep@o@ os_jtime@o@ memcmp@o@ \
|
os_jtime@o@ memcmp@o@ dbsql_atof@o@ safety@o@ dbsql_atoi@o@ \
|
||||||
dbsql_atof@o@ safety@o@ dbsql_atoi@o@ strcasecmp@o@ \
|
strcasecmp@o@ strdup@o@ dbsql_alloc@o@ str@o@
|
||||||
strdup@o@ dbsql_alloc@o@ str@o@
|
|
||||||
|
|
||||||
LEMON_OBJS=\
|
LEMON_OBJS=\
|
||||||
lemon@o@
|
lemon@o@
|
||||||
|
@ -188,12 +189,12 @@ $(libdbsql): $(DEF_LIB)
|
||||||
$(ln) -s $(libdbsql_version) $@)
|
$(ln) -s $(libdbsql_version) $@)
|
||||||
|
|
||||||
# Real static C library.
|
# Real static C library.
|
||||||
$(libdbsql_version): dbsql_int.h db_int.h sql_parser.h opcodes.h $(C_OBJS)
|
$(libdbsql_version): dbsql_int.h sql_parser.h opcodes.h $(C_OBJS)
|
||||||
$(ar) cr $@ $(C_OBJS)
|
$(ar) cr $@ $(C_OBJS)
|
||||||
test ! -f $(ranlib) || $(ranlib) $@
|
test ! -f $(ranlib) || $(ranlib) $@
|
||||||
|
|
||||||
# Shared C library.
|
# Shared C library.
|
||||||
$(libso_target): dbsql_int.h db_int.h sql_parser.h opcodes.h $(C_OBJS)
|
$(libso_target): dbsql_int.h sql_parser.h opcodes.h $(C_OBJS)
|
||||||
$(SOLINK) $(SOFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(LIBSO_LIBS)
|
$(SOLINK) $(SOFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) $(LIBSO_LIBS)
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
|
@ -323,10 +324,6 @@ distclean maintainer-clean realclean: clean
|
||||||
$(rm) -rf $(REALCLEAN_LIST)
|
$(rm) -rf $(REALCLEAN_LIST)
|
||||||
$(rm) -rf libtool
|
$(rm) -rf libtool
|
||||||
|
|
||||||
LIBTOOL_DEPS = @LIBTOOL_DEPS@
|
|
||||||
libtool: $(LIBTOOL_DEPS)
|
|
||||||
$(SHELL) ./deps/config.status $(builddir)/libtool
|
|
||||||
|
|
||||||
check dvi info obj TAGS:
|
check dvi info obj TAGS:
|
||||||
@echo "$@: make target not supported" && true
|
@echo "$@: make target not supported" && true
|
||||||
|
|
||||||
|
@ -397,8 +394,6 @@ dbsql_atoi@o@: $(srcdir)/common/dbsql_atoi.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
dbsql_err@o@: $(srcdir)/common/dbsql_err.c
|
dbsql_err@o@: $(srcdir)/common/dbsql_err.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
dbsql_fop@o@: $(srcdir)/common/dbsql_fop.c
|
|
||||||
$(CC) $(CFLAGS) $?
|
|
||||||
str@o@: $(srcdir)/common/str.c
|
str@o@: $(srcdir)/common/str.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
hash@o@: $(srcdir)/common/hash.c
|
hash@o@: $(srcdir)/common/hash.c
|
||||||
|
@ -410,8 +405,6 @@ dbsql_alloc@o@: $(srcdir)/common/dbsql_alloc.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
os_jtime@o@: $(srcdir)/os/os_jtime.c
|
os_jtime@o@: $(srcdir)/os/os_jtime.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
os_sleep@o@: $(srcdir)/os/os_sleep.c
|
|
||||||
$(CC) $(CFLAGS) $?
|
|
||||||
lemon@o@: $(srcdir)/lemon/lemon.c
|
lemon@o@: $(srcdir)/lemon/lemon.c
|
||||||
$(CC) $(CFLAGS) $?
|
$(CC) $(CFLAGS) $?
|
||||||
memcmp@o@: $(srcdir)/clib/memcmp.c
|
memcmp@o@: $(srcdir)/clib/memcmp.c
|
||||||
|
|
8
dist/RELEASE
vendored
8
dist/RELEASE
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,10 +15,12 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: RELEASE 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
DBSQL_VERSION_MAJOR=0
|
DBSQL_VERSION_MAJOR=0
|
||||||
DBSQL_VERSION_MINOR=4
|
DBSQL_VERSION_MINOR=2
|
||||||
DBSQL_VERSION_PATCH=0
|
DBSQL_VERSION_PATCH=3
|
||||||
DBSQL_VERSION="$DBSQL_VERSION_MAJOR.$DBSQL_VERSION_MINOR.$DBSQL_VERSION_PATCH"
|
DBSQL_VERSION="$DBSQL_VERSION_MAJOR.$DBSQL_VERSION_MINOR.$DBSQL_VERSION_PATCH"
|
||||||
|
|
||||||
DBSQL_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DBSQL_VERSION_MAJOR $DBSQL_VERSION_MINOR`
|
DBSQL_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DBSQL_VERSION_MAJOR $DBSQL_VERSION_MINOR`
|
||||||
|
|
17
dist/aclocal/cxx.ac
vendored
Normal file
17
dist/aclocal/cxx.ac
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# C++ checks to determine what style of headers to use and
|
||||||
|
# whether to use "using" clauses.
|
||||||
|
|
||||||
|
AC_DEFUN(AC_CXX_HAVE_STDHEADERS, [
|
||||||
|
AC_SUBST(cxx_have_stdheaders)
|
||||||
|
AC_CACHE_CHECK([whether C++ supports the ISO C++ standard includes],
|
||||||
|
db_cv_cxx_have_stdheaders,
|
||||||
|
[AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
AC_TRY_COMPILE([#include <iostream>
|
||||||
|
],[std::ostream *o; return 0;],
|
||||||
|
db_cv_cxx_have_stdheaders=yes, db_cv_cxx_have_stdheaders=no)
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
])
|
||||||
|
if test "$db_cv_cxx_have_stdheaders" = yes; then
|
||||||
|
cxx_have_stdheaders="#define HAVE_CXX_STDHEADERS 1"
|
||||||
|
fi])
|
313
dist/aclocal/cxx.m4
vendored
313
dist/aclocal/cxx.m4
vendored
|
@ -1,313 +0,0 @@
|
||||||
# C++ language checks
|
|
||||||
|
|
||||||
AC_DEFUN(AC_CXX_STDHEADERS, [
|
|
||||||
AC_SUBST(cxx_have_stdheaders)
|
|
||||||
AC_MSG_CHECKING(whether C++ supports the ISO C++ standard includes)
|
|
||||||
AC_LANG_SAVE
|
|
||||||
AC_LANG([C++])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
|
||||||
[[#include <iostream>]],
|
|
||||||
[[std::ostream *o; return 0;]])],
|
|
||||||
db_cv_cxx_have_stdheaders=yes, db_cv_cxx_have_stdheaders=no)
|
|
||||||
AC_LANG_RESTORE
|
|
||||||
AC_MSG_RESULT($db_cv_cxx_have_stdheaders)
|
|
||||||
if test "$db_cv_cxx_have_stdheaders" = yes; then
|
|
||||||
cxx_have_stdheaders="#define HAVE_CXX_STDHEADERS 1"
|
|
||||||
fi])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_CXX_WSTRING, [
|
|
||||||
AC_MSG_CHECKING(whether C++ supports the wstring class)
|
|
||||||
AC_SUBST(WSTRING_decl)
|
|
||||||
AC_LANG_SAVE
|
|
||||||
AC_LANG([C++])
|
|
||||||
AC_LINK_IFELSE(AC_LANG_SOURCE(
|
|
||||||
[[#include <string>]],
|
|
||||||
[[using std::wstring;
|
|
||||||
wstring ws; ws.find_first_of(ws);]]),
|
|
||||||
[WSTRING_decl="#define HAVE_WSTRING 1" ;
|
|
||||||
AC_MSG_RESULT(yes)],
|
|
||||||
[WSTRING_decl="#undef HAVE_WSTRING" ;
|
|
||||||
AC_MSG_RESULT(no)])
|
|
||||||
AC_LANG_RESTORE
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN(AC_CXX_SUPPORTS_TEMPLATES, [
|
|
||||||
AC_MSG_CHECKING(whether the C++ compiler supports templates for STL)
|
|
||||||
AC_LANG_SAVE
|
|
||||||
AC_LANG([C++])
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
]], [[
|
|
||||||
using std::string;
|
|
||||||
using std::vector;
|
|
||||||
namespace dbstl_configure_test {
|
|
||||||
|
|
||||||
template<typename T1, typename T2 = int>
|
|
||||||
class MyClass
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit MyClass(int i) { imem = i;}
|
|
||||||
|
|
||||||
MyClass(const T1& t1, const T2& t2, int i)
|
|
||||||
{
|
|
||||||
mem1 = t1;
|
|
||||||
mem2 = t2;
|
|
||||||
imem = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T3>
|
|
||||||
T2 templ_mem_func(T1 t1, T3 t3)
|
|
||||||
{
|
|
||||||
mem2 = t1;
|
|
||||||
T3 t32 = t3;
|
|
||||||
T2 t2;
|
|
||||||
return t2;
|
|
||||||
}
|
|
||||||
|
|
||||||
double templ_mem_func(T1 t1, double t3)
|
|
||||||
{
|
|
||||||
mem1 = t1;
|
|
||||||
double t32 = t3;
|
|
||||||
return t3;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ReturnType, typename T7, typename T8>
|
|
||||||
ReturnType templ_mem_func(T7, T8);
|
|
||||||
|
|
||||||
operator T1() const {return mem1;}
|
|
||||||
private:
|
|
||||||
T1 mem1;
|
|
||||||
T2 mem2;
|
|
||||||
int imem;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
|
||||||
template <typename ReturnType, typename T7, typename T8>
|
|
||||||
ReturnType MyClass<T1, T2>::templ_mem_func(T7, T8)
|
|
||||||
{
|
|
||||||
ReturnType rt;
|
|
||||||
return rt;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
|
||||||
class MyClass<double, float>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit MyClass(int i) { imem = i;}
|
|
||||||
|
|
||||||
MyClass(const double& t1, const float& t2, int i)
|
|
||||||
{
|
|
||||||
mem1 = t1;
|
|
||||||
mem2 = t2;
|
|
||||||
imem = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T3>
|
|
||||||
float templ_mem_func(double t1, T3 t3)
|
|
||||||
{
|
|
||||||
mem2 = t1;
|
|
||||||
T3 t32 = t3;
|
|
||||||
float t2;
|
|
||||||
return t2;
|
|
||||||
}
|
|
||||||
|
|
||||||
double templ_mem_func(double t1, double t3)
|
|
||||||
{
|
|
||||||
mem1 = t1;
|
|
||||||
double t32 = t3;
|
|
||||||
return t3;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ReturnType, typename T7, typename T8>
|
|
||||||
ReturnType templ_mem_func(T7, T8);
|
|
||||||
|
|
||||||
operator double() const {return mem1;}
|
|
||||||
private:
|
|
||||||
double mem1;
|
|
||||||
float mem2;
|
|
||||||
int imem;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename ReturnType, typename T7, typename T8>
|
|
||||||
ReturnType MyClass<double, float>::templ_mem_func(T7, T8)
|
|
||||||
{
|
|
||||||
ReturnType rt;
|
|
||||||
return rt;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
|
||||||
class MyClass2 {
|
|
||||||
public:
|
|
||||||
MyClass2(const T1& t1, const T2&t2){}
|
|
||||||
};
|
|
||||||
|
|
||||||
// partial specialization: both template parameters have same type
|
|
||||||
template <typename T>
|
|
||||||
class MyClass2<T,T> {
|
|
||||||
public:
|
|
||||||
MyClass2(const T& t1, const T&t2){}
|
|
||||||
};
|
|
||||||
|
|
||||||
// partial specialization: second type is int
|
|
||||||
template <typename T>
|
|
||||||
class MyClass2<T,int> {
|
|
||||||
public:
|
|
||||||
MyClass2(const T& t1, const int&t2){}
|
|
||||||
};
|
|
||||||
|
|
||||||
// partial specialization: both template parameters are pointer types
|
|
||||||
template <typename T1, typename T2>
|
|
||||||
class MyClass2<T1*,T2*> {
|
|
||||||
public:
|
|
||||||
MyClass2(const T1* t1, const T2*t2){}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class MyClass2<T*,T*> {
|
|
||||||
public:
|
|
||||||
MyClass2(const T* t1, const T*t2){}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T4, typename T5>
|
|
||||||
int part_spec_func(T4 t4, T5 t5)
|
|
||||||
{
|
|
||||||
// Zero Initialization should work.
|
|
||||||
T4 t44 = T4();
|
|
||||||
T5 t55 = T5();
|
|
||||||
|
|
||||||
t44 = t4;
|
|
||||||
t55 = t5;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T4>
|
|
||||||
int part_spec_func(T4 t4, std::vector<T4> t55)
|
|
||||||
{
|
|
||||||
T4 t44 = t4;
|
|
||||||
std::vector<T4> abc = t55;
|
|
||||||
}
|
|
||||||
|
|
||||||
// maximum of two int values
|
|
||||||
inline int const& max (int const& a, int const& b)
|
|
||||||
{
|
|
||||||
return a<b?b:a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// maximum of two values of any type
|
|
||||||
template <typename T1, typename T2>
|
|
||||||
inline T2 const max (T1 const& a, T2 const& b)
|
|
||||||
{
|
|
||||||
return a<b?b:a;
|
|
||||||
}
|
|
||||||
// maximum of two values of any type
|
|
||||||
template <typename T>
|
|
||||||
inline T const& max (T const& a, T const& b)
|
|
||||||
{
|
|
||||||
return a<b?b:a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// maximum of three values of any type
|
|
||||||
template <typename T>
|
|
||||||
inline T const& max (T const& a, T const& b, T const& c)
|
|
||||||
{
|
|
||||||
return max (max(a,b), c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Base {
|
|
||||||
public:
|
|
||||||
void exit2(){}
|
|
||||||
Base(){}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
class Derived : public Base<T> {
|
|
||||||
public:
|
|
||||||
// Call Base<T>() explicitly here, otherwise can't access it.
|
|
||||||
// Kind of like this->.
|
|
||||||
Derived() : Base<T>(){}
|
|
||||||
|
|
||||||
void foo() {
|
|
||||||
this->exit2();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // dbstl_configure_test
|
|
||||||
|
|
||||||
using namespace dbstl_configure_test;], [
|
|
||||||
char cc = 'a';
|
|
||||||
int i = 4;
|
|
||||||
double pi = 3.14;
|
|
||||||
float gold = 0.618;
|
|
||||||
|
|
||||||
MyClass2<int,float> mif(i, gold); // uses MyClass2<T1,T2>
|
|
||||||
MyClass2<float,float> mff(gold, gold); // uses MyClass2<T,T>
|
|
||||||
MyClass2<float,int> mfi(gold, i); // uses MyClass2<T,int>
|
|
||||||
MyClass2<int*,float*> mp(&i, &gold); // uses MyClass2<T1*,T2*>
|
|
||||||
MyClass2<int*,int*> m(&i, &i); // uses MyClass2<T*, T*>
|
|
||||||
|
|
||||||
MyClass<char> obj1(i);
|
|
||||||
obj1.templ_mem_func(cc, pi);
|
|
||||||
obj1.templ_mem_func(cc, gold);
|
|
||||||
obj1.templ_mem_func(i, pi);
|
|
||||||
obj1.templ_mem_func(cc, cc);
|
|
||||||
char ch = (char)obj1;
|
|
||||||
|
|
||||||
string str1("abc"), str2("def");
|
|
||||||
MyClass<const char*, std::string> obj2(str1.c_str(), str2, i);
|
|
||||||
obj2.templ_mem_func("klm", str2);
|
|
||||||
obj2.templ_mem_func("hij", pi);
|
|
||||||
|
|
||||||
// Use j to help distinguish, otherwise unable to use the one defined
|
|
||||||
// outside of class body.
|
|
||||||
int j = obj2.templ_mem_func<int, char, char>(cc, cc);
|
|
||||||
// Call explicitly.
|
|
||||||
obj2.templ_mem_func<int, float, double>(gold, pi);
|
|
||||||
const char *pch = (const char*)obj2;
|
|
||||||
|
|
||||||
MyClass<double, float> obj3(pi, gold, i);
|
|
||||||
obj3.templ_mem_func(pi, i);
|
|
||||||
obj3.templ_mem_func(pi, str1);
|
|
||||||
obj3.templ_mem_func(pi, pi);
|
|
||||||
obj3.templ_mem_func(cc, pi);
|
|
||||||
obj3.templ_mem_func(cc, cc);
|
|
||||||
double tmpd = (double)obj3;
|
|
||||||
|
|
||||||
MyClass<double, float> obj4(i);
|
|
||||||
obj4.templ_mem_func(pi, i);
|
|
||||||
obj4.templ_mem_func(pi, str1);
|
|
||||||
obj4.templ_mem_func(pi, pi);
|
|
||||||
obj4.templ_mem_func(gold, pi);
|
|
||||||
tmpd = (double)obj4;
|
|
||||||
|
|
||||||
// Function template partial specialization.
|
|
||||||
part_spec_func(pi, gold);
|
|
||||||
part_spec_func(gold, i);
|
|
||||||
part_spec_func(str1, str2);
|
|
||||||
std::vector<std::string> strv;
|
|
||||||
part_spec_func(str1, strv);
|
|
||||||
std::vector<double> dblv;
|
|
||||||
part_spec_func(pi, dblv);
|
|
||||||
|
|
||||||
// Function template overloads and explicit call and deduction.
|
|
||||||
dbstl_configure_test::max(7, 42, 68); // calls the template for three arguments
|
|
||||||
dbstl_configure_test::max(7.0, 42.0); // calls max<double> (by argument deduction)
|
|
||||||
dbstl_configure_test::max('a', 'b'); // calls max<char> (by argument deduction)
|
|
||||||
dbstl_configure_test::max(7, 42.0);
|
|
||||||
dbstl_configure_test::max<double>(4,4.2); // instantiate T as double
|
|
||||||
dbstl_configure_test::max(7, 42); // calls the nontemplate for two ints
|
|
||||||
dbstl_configure_test::max<>(7, 42); // calls max<int> (by argument deduction)
|
|
||||||
dbstl_configure_test::max<double, double>(7, 42); // calls max<double> (no argument deduction)
|
|
||||||
dbstl_configure_test::max('a', 42.7); // calls the nontemplate for two ints
|
|
||||||
|
|
||||||
Base<double> bobj;
|
|
||||||
bobj.exit2();
|
|
||||||
// Using this-> to access base class members.
|
|
||||||
Derived<double> dobj;
|
|
||||||
dobj.foo();
|
|
||||||
dobj.exit2();
|
|
||||||
]])], AC_MSG_RESULT(yes), AC_MSG_ERROR(no))
|
|
||||||
|
|
||||||
AC_LANG_RESTORE
|
|
||||||
])
|
|
17
dist/aclocal/gcc.m4 → dist/aclocal/gcc.ac
vendored
17
dist/aclocal/gcc.m4 → dist/aclocal/gcc.ac
vendored
|
@ -17,3 +17,20 @@ if test "$db_cv_gcc_2_96" = "yes"; then
|
||||||
AC_MSG_WARN([INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE.])
|
AC_MSG_WARN([INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE.])
|
||||||
AC_MSG_WARN([GCC OPTIMIZATION LEVEL SET TO -O.])
|
AC_MSG_WARN([GCC OPTIMIZATION LEVEL SET TO -O.])
|
||||||
fi])
|
fi])
|
||||||
|
|
||||||
|
# Versions of g++ up to 2.8.0 required -fhandle-exceptions, but it is
|
||||||
|
# renamed as -fexceptions and is the default in versions 2.8.0 and after.
|
||||||
|
AC_DEFUN(AC_GCC_CONFIG2, [
|
||||||
|
AC_CACHE_CHECK([whether g++ requires -fhandle-exceptions],
|
||||||
|
db_cv_gxx_except, [
|
||||||
|
db_cv_gxx_except=no;
|
||||||
|
if test "$GXX" = "yes"; then
|
||||||
|
GXX_VERSION=`${MAKEFILE_CXX} --version`
|
||||||
|
case ${GXX_VERSION} in
|
||||||
|
1.*|2.[[01234567]].*|*-1.*|*-2.[[01234567]].*)
|
||||||
|
db_cv_gxx_except=yes;;
|
||||||
|
esac
|
||||||
|
fi])
|
||||||
|
if test "$db_cv_gxx_except" = "yes"; then
|
||||||
|
CXXFLAGS="$CXXFLAGS -fhandle-exceptions"
|
||||||
|
fi])
|
5867
dist/aclocal/libtool.ac
vendored
Normal file
5867
dist/aclocal/libtool.ac
vendored
Normal file
File diff suppressed because it is too large
Load diff
8400
dist/aclocal/libtool.m4
vendored
8400
dist/aclocal/libtool.m4
vendored
File diff suppressed because it is too large
Load diff
437
dist/aclocal/ltoptions.m4
vendored
437
dist/aclocal/ltoptions.m4
vendored
|
@ -1,437 +0,0 @@
|
||||||
# Helper functions for option handling. -*- Autoconf -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2004-2005, 2007-2009, 2011-2019, 2021-2022 Free
|
|
||||||
# Software Foundation, Inc.
|
|
||||||
# Written by Gary V. Vaughan, 2004
|
|
||||||
#
|
|
||||||
# This file 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.
|
|
||||||
|
|
||||||
# serial 8 ltoptions.m4
|
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
|
||||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
|
|
||||||
# ------------------------------------------
|
|
||||||
m4_define([_LT_MANGLE_OPTION],
|
|
||||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
|
|
||||||
# ---------------------------------------
|
|
||||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
|
|
||||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are
|
|
||||||
# saved as a flag.
|
|
||||||
m4_define([_LT_SET_OPTION],
|
|
||||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
|
|
||||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
|
|
||||||
_LT_MANGLE_DEFUN([$1], [$2]),
|
|
||||||
[m4_warning([Unknown $1 option '$2'])])[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
|
||||||
m4_define([_LT_IF_OPTION],
|
|
||||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
|
|
||||||
# -------------------------------------------------------
|
|
||||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
|
|
||||||
# are set.
|
|
||||||
m4_define([_LT_UNLESS_OPTIONS],
|
|
||||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
|
||||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
|
|
||||||
[m4_define([$0_found])])])[]dnl
|
|
||||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
|
|
||||||
])[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
|
|
||||||
# ----------------------------------------
|
|
||||||
# OPTION-LIST is a space-separated list of Libtool options associated
|
|
||||||
# with MACRO-NAME. If any OPTION has a matching handler declared with
|
|
||||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
|
|
||||||
# the unknown option and exit.
|
|
||||||
m4_defun([_LT_SET_OPTIONS],
|
|
||||||
[# Set options
|
|
||||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
|
|
||||||
[_LT_SET_OPTION([$1], _LT_Option)])
|
|
||||||
|
|
||||||
m4_if([$1],[LT_INIT],[
|
|
||||||
dnl
|
|
||||||
dnl Simply set some default values (i.e off) if boolean options were not
|
|
||||||
dnl specified:
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
|
|
||||||
])
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
|
|
||||||
])
|
|
||||||
dnl
|
|
||||||
dnl If no reference was made to various pairs of opposing options, then
|
|
||||||
dnl we run the default mode handler for the pair. For example, if neither
|
|
||||||
dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
|
|
||||||
dnl archives by default:
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
|
|
||||||
[_LT_ENABLE_FAST_INSTALL])
|
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
|
|
||||||
[_LT_WITH_AIX_SONAME([aix])])
|
|
||||||
])
|
|
||||||
])# _LT_SET_OPTIONS
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------- ##
|
|
||||||
## Macros to handle LT_INIT options. ##
|
|
||||||
## --------------------------------- ##
|
|
||||||
|
|
||||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
|
|
||||||
# -----------------------------------------
|
|
||||||
m4_define([_LT_MANGLE_DEFUN],
|
|
||||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
|
|
||||||
|
|
||||||
|
|
||||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
|
|
||||||
# -----------------------------------------------
|
|
||||||
m4_define([LT_OPTION_DEFINE],
|
|
||||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
|
|
||||||
])# LT_OPTION_DEFINE
|
|
||||||
|
|
||||||
|
|
||||||
# dlopen
|
|
||||||
# ------
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
|
|
||||||
])
|
|
||||||
|
|
||||||
AU_DEFUN([AC_LIBTOOL_DLOPEN],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], [dlopen])
|
|
||||||
AC_DIAGNOSE([obsolete],
|
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
|
||||||
put the 'dlopen' option into LT_INIT's first parameter.])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
|
|
||||||
|
|
||||||
|
|
||||||
# win32-dll
|
|
||||||
# ---------
|
|
||||||
# Declare package support for building win32 dll's.
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll],
|
|
||||||
[enable_win32_dll=yes
|
|
||||||
|
|
||||||
case $host in
|
|
||||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
|
|
||||||
AC_CHECK_TOOL(AS, as, false)
|
|
||||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
|
||||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
test -z "$AS" && AS=as
|
|
||||||
_LT_DECL([], [AS], [1], [Assembler program])dnl
|
|
||||||
|
|
||||||
test -z "$DLLTOOL" && DLLTOOL=dlltool
|
|
||||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
|
|
||||||
|
|
||||||
test -z "$OBJDUMP" && OBJDUMP=objdump
|
|
||||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
|
|
||||||
])# win32-dll
|
|
||||||
|
|
||||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
|
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
|
||||||
_LT_SET_OPTION([LT_INIT], [win32-dll])
|
|
||||||
AC_DIAGNOSE([obsolete],
|
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
|
||||||
put the 'win32-dll' option into LT_INIT's first parameter.])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_SHARED([DEFAULT])
|
|
||||||
# ----------------------------
|
|
||||||
# implement the --enable-shared flag, and supports the 'shared' and
|
|
||||||
# 'disable-shared' LT_INIT options.
|
|
||||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
|
||||||
m4_define([_LT_ENABLE_SHARED],
|
|
||||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
|
||||||
AC_ARG_ENABLE([shared],
|
|
||||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
|
|
||||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case $enableval in
|
|
||||||
yes) enable_shared=yes ;;
|
|
||||||
no) enable_shared=no ;;
|
|
||||||
*)
|
|
||||||
enable_shared=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
|
||||||
for pkg in $enableval; do
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_shared=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
|
|
||||||
|
|
||||||
_LT_DECL([build_libtool_libs], [enable_shared], [0],
|
|
||||||
[Whether or not to build shared libraries])
|
|
||||||
])# _LT_ENABLE_SHARED
|
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
|
|
||||||
|
|
||||||
# Old names:
|
|
||||||
AC_DEFUN([AC_ENABLE_SHARED],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AC_DISABLE_SHARED],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-shared])
|
|
||||||
])
|
|
||||||
|
|
||||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
|
|
||||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AM_ENABLE_SHARED], [])
|
|
||||||
dnl AC_DEFUN([AM_DISABLE_SHARED], [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_STATIC([DEFAULT])
|
|
||||||
# ----------------------------
|
|
||||||
# implement the --enable-static flag, and support the 'static' and
|
|
||||||
# 'disable-static' LT_INIT options.
|
|
||||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
|
||||||
m4_define([_LT_ENABLE_STATIC],
|
|
||||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
|
||||||
AC_ARG_ENABLE([static],
|
|
||||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
|
|
||||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case $enableval in
|
|
||||||
yes) enable_static=yes ;;
|
|
||||||
no) enable_static=no ;;
|
|
||||||
*)
|
|
||||||
enable_static=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
|
||||||
for pkg in $enableval; do
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_static=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT)
|
|
||||||
|
|
||||||
_LT_DECL([build_old_libs], [enable_static], [0],
|
|
||||||
[Whether or not to build static libraries])
|
|
||||||
])# _LT_ENABLE_STATIC
|
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
|
|
||||||
|
|
||||||
# Old names:
|
|
||||||
AC_DEFUN([AC_ENABLE_STATIC],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_DEFUN([AC_DISABLE_STATIC],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-static])
|
|
||||||
])
|
|
||||||
|
|
||||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
|
|
||||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AM_ENABLE_STATIC], [])
|
|
||||||
dnl AC_DEFUN([AM_DISABLE_STATIC], [])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT])
|
|
||||||
# ----------------------------------
|
|
||||||
# implement the --enable-fast-install flag, and support the 'fast-install'
|
|
||||||
# and 'disable-fast-install' LT_INIT options.
|
|
||||||
# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'.
|
|
||||||
m4_define([_LT_ENABLE_FAST_INSTALL],
|
|
||||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
|
|
||||||
AC_ARG_ENABLE([fast-install],
|
|
||||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
|
|
||||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
|
|
||||||
[p=${PACKAGE-default}
|
|
||||||
case $enableval in
|
|
||||||
yes) enable_fast_install=yes ;;
|
|
||||||
no) enable_fast_install=no ;;
|
|
||||||
*)
|
|
||||||
enable_fast_install=no
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
|
||||||
for pkg in $enableval; do
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
if test "X$pkg" = "X$p"; then
|
|
||||||
enable_fast_install=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
|
|
||||||
|
|
||||||
_LT_DECL([fast_install], [enable_fast_install], [0],
|
|
||||||
[Whether or not to optimize for fast installation])dnl
|
|
||||||
])# _LT_ENABLE_FAST_INSTALL
|
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
|
|
||||||
|
|
||||||
# Old names:
|
|
||||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
|
|
||||||
AC_DIAGNOSE([obsolete],
|
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
|
||||||
the 'fast-install' option into LT_INIT's first parameter.])
|
|
||||||
])
|
|
||||||
|
|
||||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
|
|
||||||
AC_DIAGNOSE([obsolete],
|
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put
|
|
||||||
the 'disable-fast-install' option into LT_INIT's first parameter.])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
|
|
||||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_WITH_AIX_SONAME([DEFAULT])
|
|
||||||
# ----------------------------------
|
|
||||||
# implement the --with-aix-soname flag, and support the `aix-soname=aix'
|
|
||||||
# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
|
|
||||||
# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'.
|
|
||||||
m4_define([_LT_WITH_AIX_SONAME],
|
|
||||||
[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
|
|
||||||
shared_archive_member_spec=
|
|
||||||
case $host,$enable_shared in
|
|
||||||
power*-*-aix[[5-9]]*,yes)
|
|
||||||
AC_MSG_CHECKING([which variant of shared library versioning to provide])
|
|
||||||
AC_ARG_WITH([aix-soname],
|
|
||||||
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
|
|
||||||
[shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
|
|
||||||
[case $withval in
|
|
||||||
aix|svr4|both)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AC_MSG_ERROR([Unknown argument to --with-aix-soname])
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
lt_cv_with_aix_soname=$with_aix_soname],
|
|
||||||
[AC_CACHE_VAL([lt_cv_with_aix_soname],
|
|
||||||
[lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
|
|
||||||
with_aix_soname=$lt_cv_with_aix_soname])
|
|
||||||
AC_MSG_RESULT([$with_aix_soname])
|
|
||||||
if test aix != "$with_aix_soname"; then
|
|
||||||
# For the AIX way of multilib, we name the shared archive member
|
|
||||||
# based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
|
|
||||||
# and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
|
|
||||||
# Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
|
|
||||||
# the AIX toolchain works better with OBJECT_MODE set (default 32).
|
|
||||||
if test 64 = "${OBJECT_MODE-32}"; then
|
|
||||||
shared_archive_member_spec=shr_64
|
|
||||||
else
|
|
||||||
shared_archive_member_spec=shr
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
with_aix_soname=aix
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
_LT_DECL([], [shared_archive_member_spec], [0],
|
|
||||||
[Shared archive member basename, for filename based shared library versioning on AIX])dnl
|
|
||||||
])# _LT_WITH_AIX_SONAME
|
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_WITH_PIC([MODE])
|
|
||||||
# --------------------
|
|
||||||
# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
|
|
||||||
# LT_INIT options.
|
|
||||||
# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'.
|
|
||||||
m4_define([_LT_WITH_PIC],
|
|
||||||
[AC_ARG_WITH([pic],
|
|
||||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
|
|
||||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
|
|
||||||
[lt_p=${PACKAGE-default}
|
|
||||||
case $withval in
|
|
||||||
yes|no) pic_mode=$withval ;;
|
|
||||||
*)
|
|
||||||
pic_mode=default
|
|
||||||
# Look at the argument we got. We use all the common list separators.
|
|
||||||
lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
|
|
||||||
for lt_pkg in $withval; do
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
if test "X$lt_pkg" = "X$lt_p"; then
|
|
||||||
pic_mode=yes
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$lt_save_ifs
|
|
||||||
;;
|
|
||||||
esac],
|
|
||||||
[pic_mode=m4_default([$1], [default])])
|
|
||||||
|
|
||||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
|
|
||||||
])# _LT_WITH_PIC
|
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
|
|
||||||
|
|
||||||
# Old name:
|
|
||||||
AU_DEFUN([AC_LIBTOOL_PICMODE],
|
|
||||||
[_LT_SET_OPTION([LT_INIT], [pic-only])
|
|
||||||
AC_DIAGNOSE([obsolete],
|
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you
|
|
||||||
put the 'pic-only' option into LT_INIT's first parameter.])
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility:
|
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
|
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## LTDL_INIT Options ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
m4_define([_LTDL_MODE], [])
|
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
|
|
||||||
[m4_define([_LTDL_MODE], [nonrecursive])])
|
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive],
|
|
||||||
[m4_define([_LTDL_MODE], [recursive])])
|
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject],
|
|
||||||
[m4_define([_LTDL_MODE], [subproject])])
|
|
||||||
|
|
||||||
m4_define([_LTDL_TYPE], [])
|
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [installable],
|
|
||||||
[m4_define([_LTDL_TYPE], [installable])])
|
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience],
|
|
||||||
[m4_define([_LTDL_TYPE], [convenience])])
|
|
123
dist/aclocal/ltsugar.m4
vendored
123
dist/aclocal/ltsugar.m4
vendored
|
@ -1,123 +0,0 @@
|
||||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
|
||||||
# Written by Gary V. Vaughan, 2004
|
|
||||||
#
|
|
||||||
# This file 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.
|
|
||||||
|
|
||||||
# serial 6 ltsugar.m4
|
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
|
||||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_join(SEP, ARG1, [ARG2...])
|
|
||||||
# -----------------------------
|
|
||||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
|
|
||||||
# associated separator.
|
|
||||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
|
|
||||||
# versions in m4sugar had bugs.
|
|
||||||
m4_define([lt_join],
|
|
||||||
[m4_if([$#], [1], [],
|
|
||||||
[$#], [2], [[$2]],
|
|
||||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
|
|
||||||
m4_define([_lt_join],
|
|
||||||
[m4_if([$#$2], [2], [],
|
|
||||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_car(LIST)
|
|
||||||
# lt_cdr(LIST)
|
|
||||||
# ------------
|
|
||||||
# Manipulate m4 lists.
|
|
||||||
# These macros are necessary as long as will still need to support
|
|
||||||
# Autoconf-2.59 which quotes differently.
|
|
||||||
m4_define([lt_car], [[$1]])
|
|
||||||
m4_define([lt_cdr],
|
|
||||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
|
|
||||||
[$#], 1, [],
|
|
||||||
[m4_dquote(m4_shift($@))])])
|
|
||||||
m4_define([lt_unquote], $1)
|
|
||||||
|
|
||||||
|
|
||||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR])
|
|
||||||
# ------------------------------------------
|
|
||||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
|
|
||||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended
|
|
||||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
|
|
||||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different
|
|
||||||
# than defined and empty).
|
|
||||||
#
|
|
||||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier
|
|
||||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
|
|
||||||
m4_define([lt_append],
|
|
||||||
[m4_define([$1],
|
|
||||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
|
|
||||||
# ----------------------------------------------------------
|
|
||||||
# Produce a SEP delimited list of all paired combinations of elements of
|
|
||||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
|
|
||||||
# has the form PREFIXmINFIXSUFFIXn.
|
|
||||||
# Needed until we can rely on m4_combine added in Autoconf 2.62.
|
|
||||||
m4_define([lt_combine],
|
|
||||||
[m4_if(m4_eval([$# > 3]), [1],
|
|
||||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
|
|
||||||
[[m4_foreach([_Lt_prefix], [$2],
|
|
||||||
[m4_foreach([_Lt_suffix],
|
|
||||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
|
|
||||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
|
|
||||||
# -----------------------------------------------------------------------
|
|
||||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
|
|
||||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
|
|
||||||
m4_define([lt_if_append_uniq],
|
|
||||||
[m4_ifdef([$1],
|
|
||||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
|
|
||||||
[lt_append([$1], [$2], [$3])$4],
|
|
||||||
[$5])],
|
|
||||||
[lt_append([$1], [$2], [$3])$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_add(DICT, KEY, VALUE)
|
|
||||||
# -----------------------------
|
|
||||||
m4_define([lt_dict_add],
|
|
||||||
[m4_define([$1($2)], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
|
|
||||||
# --------------------------------------------
|
|
||||||
m4_define([lt_dict_add_subkey],
|
|
||||||
[m4_define([$1($2:$3)], [$4])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_fetch(DICT, KEY, [SUBKEY])
|
|
||||||
# ----------------------------------
|
|
||||||
m4_define([lt_dict_fetch],
|
|
||||||
[m4_ifval([$3],
|
|
||||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
|
|
||||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
|
|
||||||
# -----------------------------------------------------------------
|
|
||||||
m4_define([lt_if_dict_fetch],
|
|
||||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
|
|
||||||
[$5],
|
|
||||||
[$6])])
|
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
|
|
||||||
# --------------------------------------------------------------
|
|
||||||
m4_define([lt_dict_filter],
|
|
||||||
[m4_if([$5], [], [],
|
|
||||||
[lt_join(m4_quote(m4_default([$4], [[, ]])),
|
|
||||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
|
|
||||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
|
|
||||||
])
|
|
24
dist/aclocal/ltversion.m4
vendored
24
dist/aclocal/ltversion.m4
vendored
|
@ -1,24 +0,0 @@
|
||||||
# ltversion.m4 -- version numbers -*- Autoconf -*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2004, 2011-2019, 2021-2022 Free Software Foundation,
|
|
||||||
# Inc.
|
|
||||||
# Written by Scott James Remnant, 2004
|
|
||||||
#
|
|
||||||
# This file 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.
|
|
||||||
|
|
||||||
# @configure_input@
|
|
||||||
|
|
||||||
# serial 4245 ltversion.m4
|
|
||||||
# This file is part of GNU Libtool
|
|
||||||
|
|
||||||
m4_define([LT_PACKAGE_VERSION], [2.4.7])
|
|
||||||
m4_define([LT_PACKAGE_REVISION], [2.4.7])
|
|
||||||
|
|
||||||
AC_DEFUN([LTVERSION_VERSION],
|
|
||||||
[macro_version='2.4.7'
|
|
||||||
macro_revision='2.4.7'
|
|
||||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
|
||||||
_LT_DECL(, macro_revision, 0)
|
|
||||||
])
|
|
99
dist/aclocal/lt~obsolete.m4
vendored
99
dist/aclocal/lt~obsolete.m4
vendored
|
@ -1,99 +0,0 @@
|
||||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
|
||||||
#
|
|
||||||
# Copyright (C) 2004-2005, 2007, 2009, 2011-2019, 2021-2022 Free
|
|
||||||
# Software Foundation, Inc.
|
|
||||||
# Written by Scott James Remnant, 2004.
|
|
||||||
#
|
|
||||||
# This file 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.
|
|
||||||
|
|
||||||
# serial 5 lt~obsolete.m4
|
|
||||||
|
|
||||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
|
||||||
#
|
|
||||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
|
|
||||||
# which have later been changed to m4_define as they aren't part of the
|
|
||||||
# exported API, or moved to Autoconf or Automake where they belong.
|
|
||||||
#
|
|
||||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
|
||||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
|
||||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
|
||||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
|
||||||
# and doesn't know about Autoconf macros at all.)
|
|
||||||
#
|
|
||||||
# So we provide this file, which has a silly filename so it's always
|
|
||||||
# included after everything else. This provides aclocal with the
|
|
||||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
|
||||||
# because those macros already exist, or will be overwritten later.
|
|
||||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
|
||||||
#
|
|
||||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
|
||||||
# Yes, that means every name once taken will need to remain here until
|
|
||||||
# we give up compatibility with versions before 1.7, at which point
|
|
||||||
# we need to keep only those names which we still refer to.
|
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
|
||||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
|
||||||
|
|
||||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
|
||||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
|
||||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
|
||||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
|
||||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
|
||||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
|
||||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
|
||||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
|
||||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
|
||||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
|
||||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
|
||||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
|
||||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
|
||||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
|
||||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
|
||||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
|
||||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
|
||||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
|
||||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
|
||||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
|
||||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
|
||||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
|
||||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
|
||||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
|
||||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
|
||||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
|
||||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
|
||||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
|
||||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
|
||||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
|
||||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
|
||||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
|
||||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
|
||||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
|
||||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
|
|
@ -5,7 +5,7 @@ AC_DEFUN(AM_OPTIONS_SET, [
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-utf8-encoding option specified)
|
AC_MSG_CHECKING(if --enable-utf8-encoding option specified)
|
||||||
AC_ARG_ENABLE(utf8-encoding,
|
AC_ARG_ENABLE(utf8-encoding,
|
||||||
AS_HELP_STRING([--enable-utf8-encoding],
|
AC_HELP_STRING([--enable-utf8-encoding],
|
||||||
[Encode strings as UTF-8 or ISO-8859.]),, enableval="yes")
|
[Encode strings as UTF-8 or ISO-8859.]),, enableval="yes")
|
||||||
db_cv_utf8_strings="$enableval"
|
db_cv_utf8_strings="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -27,7 +27,7 @@ AH_TEMPLATE(DBSQL_UTF8_ENCODING,
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-incore-databases option specified)
|
AC_MSG_CHECKING(if --enable-incore-databases option specified)
|
||||||
AC_ARG_ENABLE(incore-databases,
|
AC_ARG_ENABLE(incore-databases,
|
||||||
AS_HELP_STRING([--enable-incore-databases],
|
AC_HELP_STRING([--enable-incore-databases],
|
||||||
[Enable incore databases for ATTACH and OPEN.]),, enableval="yes")
|
[Enable incore databases for ATTACH and OPEN.]),, enableval="yes")
|
||||||
db_cv_incore_databases="$enableval"
|
db_cv_incore_databases="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -45,7 +45,7 @@ AH_TEMPLATE(INMEMORYDB,
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-authentication option specified)
|
AC_MSG_CHECKING(if --enable-authentication option specified)
|
||||||
AC_ARG_ENABLE(authentication,
|
AC_ARG_ENABLE(authentication,
|
||||||
AS_HELP_STRING([--enable-authentication],
|
AC_HELP_STRING([--enable-authentication],
|
||||||
[Include authorization validation code.]),, enableval="yes")
|
[Include authorization validation code.]),, enableval="yes")
|
||||||
db_cv_auth="$enableval"
|
db_cv_auth="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -61,7 +61,7 @@ AH_TEMPLATE(DBSQL_OMIT_AUTHORIZATION,
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-vacuum option specified)
|
AC_MSG_CHECKING(if --enable-vacuum option specified)
|
||||||
AC_ARG_ENABLE(vacuum,
|
AC_ARG_ENABLE(vacuum,
|
||||||
AS_HELP_STRING([--enable-vacuum],
|
AC_HELP_STRING([--enable-vacuum],
|
||||||
[Include the VACUUM command.]),, enableval="yes")
|
[Include the VACUUM command.]),, enableval="yes")
|
||||||
db_cv_auth="$enableval"
|
db_cv_auth="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -76,7 +76,7 @@ AH_TEMPLATE(DBSQL_OMIT_VACUUM,
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-datetime option specified)
|
AC_MSG_CHECKING(if --enable-datetime option specified)
|
||||||
AC_ARG_ENABLE(enable-datetime,
|
AC_ARG_ENABLE(enable-datetime,
|
||||||
AS_HELP_STRING([--enable-datetime],
|
AC_HELP_STRING([--enable-datetime],
|
||||||
[Include datetime functions.]),, enableval="yes")
|
[Include datetime functions.]),, enableval="yes")
|
||||||
db_cv_datetime="$enableval"
|
db_cv_datetime="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -93,7 +93,7 @@ AH_TEMPLATE(DBSQL_OMIT_DATETIME_FUNCS,
|
||||||
|
|
||||||
AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified])
|
AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified])
|
||||||
AC_ARG_WITH(berkeleydb,
|
AC_ARG_WITH(berkeleydb,
|
||||||
[AS_HELP_STRING([--with-berkeleydb=DIR],
|
[AC_HELP_STRING([--with-berkeleydb=DIR],
|
||||||
[Path of Berkeley DB. [DIR="/usr/local/BerkeleyDB.4.5"]])],
|
[Path of Berkeley DB. [DIR="/usr/local/BerkeleyDB.4.5"]])],
|
||||||
[with_berkeleydb="$withval"], [with_berkeleydb="no"])
|
[with_berkeleydb="$withval"], [with_berkeleydb="no"])
|
||||||
AC_MSG_RESULT($with_berkeleydb)
|
AC_MSG_RESULT($with_berkeleydb)
|
||||||
|
@ -129,7 +129,7 @@ fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([if --with-db-uniquename=NAME option specified])
|
AC_MSG_CHECKING([if --with-db-uniquename=NAME option specified])
|
||||||
AC_ARG_WITH(db-uniquename,
|
AC_ARG_WITH(db-uniquename,
|
||||||
[AS_HELP_STRING([--with-db-uniquename=NAME],
|
[AC_HELP_STRING([--with-db-uniquename=NAME],
|
||||||
[Unique name used when building DB library.])],
|
[Unique name used when building DB library.])],
|
||||||
[with_db_uniquename="$withval"], [with_db_uniquename="no"])
|
[with_db_uniquename="$withval"], [with_db_uniquename="no"])
|
||||||
if test "$with_db_uniquename" = "no"; then
|
if test "$with_db_uniquename" = "no"; then
|
||||||
|
@ -148,7 +148,7 @@ fi
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-incore-temp-databases option specified)
|
AC_MSG_CHECKING(if --enable-incore-temp-databases option specified)
|
||||||
AC_ARG_ENABLE(incore-temp-databases,
|
AC_ARG_ENABLE(incore-temp-databases,
|
||||||
AS_HELP_STRING([--enable-incore-temp-databases],
|
AC_HELP_STRING([--enable-incore-temp-databases],
|
||||||
[Enable incore databases for temporary tables.]),, enableval="no")
|
[Enable incore databases for temporary tables.]),, enableval="no")
|
||||||
db_cv_incore_temp_databases="$enableval"
|
db_cv_incore_temp_databases="$enableval"
|
||||||
case "$db_cv_incore_temp_databases" in
|
case "$db_cv_incore_temp_databases" in
|
||||||
|
@ -181,7 +181,7 @@ AH_TEMPLATE(TEMP_STORE,
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --disable-statistics option specified)
|
AC_MSG_CHECKING(if --disable-statistics option specified)
|
||||||
AC_ARG_ENABLE(statistics,
|
AC_ARG_ENABLE(statistics,
|
||||||
AS_HELP_STRING([--disable-statistics],
|
AC_HELP_STRING([--disable-statistics],
|
||||||
[Do not build statistics support.]),, enableval="yes")
|
[Do not build statistics support.]),, enableval="yes")
|
||||||
db_cv_build_statistics="$enableval"
|
db_cv_build_statistics="$enableval"
|
||||||
case "$enableval" in
|
case "$enableval" in
|
||||||
|
@ -191,7 +191,7 @@ esac
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-sqlite-compat option specified)
|
AC_MSG_CHECKING(if --enable-sqlite-compat option specified)
|
||||||
AC_ARG_ENABLE(sqlite-compat,
|
AC_ARG_ENABLE(sqlite-compat,
|
||||||
[AS_HELP_STRING([--enable-sqlite-compat],
|
[AC_HELP_STRING([--enable-sqlite-compat],
|
||||||
[Build SQLite compatibility API.])],
|
[Build SQLite compatibility API.])],
|
||||||
[db_cv_sqlite_compat="$enable_sqlite_compat"],
|
[db_cv_sqlite_compat="$enable_sqlite_compat"],
|
||||||
[db_cv_sqlite_compat="no"])
|
[db_cv_sqlite_compat="no"])
|
||||||
|
@ -199,7 +199,7 @@ AC_MSG_RESULT($db_cv_sqlite_compat)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-soundex-sqlfn option specified)
|
AC_MSG_CHECKING(if --enable-soundex-sqlfn option specified)
|
||||||
AC_ARG_ENABLE(soundex-sqlfn,
|
AC_ARG_ENABLE(soundex-sqlfn,
|
||||||
[AS_HELP_STRING([--enable-soundex-sqlfn],
|
[AC_HELP_STRING([--enable-soundex-sqlfn],
|
||||||
[Include soundex() sql function support.])],
|
[Include soundex() sql function support.])],
|
||||||
[db_cv_sqlite_compat="$enable_soundex_sqlfn"],
|
[db_cv_sqlite_compat="$enable_soundex_sqlfn"],
|
||||||
[db_cv_sqlite_compat="no"])
|
[db_cv_sqlite_compat="no"])
|
||||||
|
@ -207,42 +207,42 @@ AC_MSG_RESULT($db_cv_soundex_sqlfn)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-posixmutexes option specified)
|
AC_MSG_CHECKING(if --enable-posixmutexes option specified)
|
||||||
AC_ARG_ENABLE(posixmutexes,
|
AC_ARG_ENABLE(posixmutexes,
|
||||||
[AS_HELP_STRING([--enable-posixmutexes],
|
[AC_HELP_STRING([--enable-posixmutexes],
|
||||||
[Force use of POSIX standard mutexes.])],
|
[Force use of POSIX standard mutexes.])],
|
||||||
[db_cv_posixmutexes="$enable_posixmutexes"], [db_cv_posixmutexes="no"])
|
[db_cv_posixmutexes="$enable_posixmutexes"], [db_cv_posixmutexes="no"])
|
||||||
AC_MSG_RESULT($db_cv_posixmutexes)
|
AC_MSG_RESULT($db_cv_posixmutexes)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-debug option specified)
|
AC_MSG_CHECKING(if --enable-debug option specified)
|
||||||
AC_ARG_ENABLE(debug,
|
AC_ARG_ENABLE(debug,
|
||||||
[AS_HELP_STRING([--enable-debug],
|
[AC_HELP_STRING([--enable-debug],
|
||||||
[Build a debugging version.])],
|
[Build a debugging version.])],
|
||||||
[db_cv_debug="$enable_debug"], [db_cv_debug="no"])
|
[db_cv_debug="$enable_debug"], [db_cv_debug="no"])
|
||||||
AC_MSG_RESULT($db_cv_debug)
|
AC_MSG_RESULT($db_cv_debug)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-diagnostic option specified)
|
AC_MSG_CHECKING(if --enable-diagnostic option specified)
|
||||||
AC_ARG_ENABLE(diagnostic,
|
AC_ARG_ENABLE(diagnostic,
|
||||||
[AS_HELP_STRING([--enable-diagnostic],
|
[AC_HELP_STRING([--enable-diagnostic],
|
||||||
[Build a version with run-time diagnostics.])],
|
[Build a version with run-time diagnostics.])],
|
||||||
[db_cv_diagnostic="$enable_diagnostic"], [db_cv_diagnostic="no"])
|
[db_cv_diagnostic="$enable_diagnostic"], [db_cv_diagnostic="no"])
|
||||||
AC_MSG_RESULT($db_cv_diagnostic)
|
AC_MSG_RESULT($db_cv_diagnostic)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-tcl option specified)
|
AC_MSG_CHECKING(if --enable-tcl option specified)
|
||||||
AC_ARG_ENABLE(tcl,
|
AC_ARG_ENABLE(tcl,
|
||||||
[AS_HELP_STRING([--enable-tcl],
|
[AC_HELP_STRING([--enable-tcl],
|
||||||
[Build Tcl API.])],
|
[Build Tcl API.])],
|
||||||
[db_cv_tcl="$enable_tcl"], [db_cv_tcl="no"])
|
[db_cv_tcl="$enable_tcl"], [db_cv_tcl="no"])
|
||||||
AC_MSG_RESULT($db_cv_tcl)
|
AC_MSG_RESULT($db_cv_tcl)
|
||||||
|
|
||||||
AC_MSG_CHECKING([if --with-tcl=DIR option specified])
|
AC_MSG_CHECKING([if --with-tcl=DIR option specified])
|
||||||
AC_ARG_WITH(tcl,
|
AC_ARG_WITH(tcl,
|
||||||
[AS_HELP_STRING([--with-tcl=DIR],
|
[AC_HELP_STRING([--with-tcl=DIR],
|
||||||
[Directory location of tclConfig.sh.])],
|
[Directory location of tclConfig.sh.])],
|
||||||
[with_tclconfig="$withval"], [with_tclconfig="no"])
|
[with_tclconfig="$withval"], [with_tclconfig="no"])
|
||||||
AC_MSG_RESULT($with_tclconfig)
|
AC_MSG_RESULT($with_tclconfig)
|
||||||
|
|
||||||
AC_MSG_CHECKING(if --enable-test option specified)
|
AC_MSG_CHECKING(if --enable-test option specified)
|
||||||
AC_ARG_ENABLE(test,
|
AC_ARG_ENABLE(test,
|
||||||
[AS_HELP_STRING([--enable-test],
|
[AC_HELP_STRING([--enable-test],
|
||||||
[Configure to run the test suite.])],
|
[Configure to run the test suite.])],
|
||||||
[db_cv_test="$enable_test"], [db_cv_test="no"])
|
[db_cv_test="$enable_test"], [db_cv_test="no"])
|
||||||
AC_MSG_RESULT($db_cv_test)
|
AC_MSG_RESULT($db_cv_test)
|
|
@ -1,15 +1,16 @@
|
||||||
# $Id$
|
# $Id: sosuffix.ac 7 2007-02-03 13:34:17Z gburd $
|
||||||
# Determine shared object suffixes.
|
# Determine shared object suffixes.
|
||||||
#
|
#
|
||||||
# Our method is to use the libtool variable $library_names_spec,
|
# Our method is to use the libtool variable $library_names_spec,
|
||||||
# set by using LT_INIT. This variable is a snippet of shell
|
# set by using AC_PROG_LIBTOOL. This variable is a snippet of shell
|
||||||
# defined in terms of $versuffix, $release, $libname and $module
|
# defined in terms of $versuffix, $release, $libname and $module
|
||||||
# We want to eval it and grab the suffix used for shared objects.
|
# We want to eval it and grab the suffix used for shared objects.
|
||||||
# By setting $module to yes/no, we obtain the suffixes
|
# By setting $module to yes/no, we obtain the suffixes
|
||||||
# used to create dlloadable, or java loadable modules.
|
# used to create dlloadable, or java loadable modules.
|
||||||
# On many (*nix) systems, these all evaluate to .so, but there
|
# On many (*nix) systems, these all evaluate to .so, but there
|
||||||
# are some notable exceptions.
|
# are some notable exceptions.
|
||||||
# Before calling this macro, libtool must have been configured.
|
# Before calling this macro, $LIBTOOL_PROG must be set to
|
||||||
|
# the correct method of invoking libtool (e.g. $SHELL ./libtool)
|
||||||
|
|
||||||
# This macro is used internally to discover the suffix for the current
|
# This macro is used internally to discover the suffix for the current
|
||||||
# settings of $module. The result is stored in $_SOSUFFIX.
|
# settings of $module. The result is stored in $_SOSUFFIX.
|
||||||
|
@ -17,14 +18,14 @@ AC_DEFUN(_SOSUFFIX_INTERNAL, [
|
||||||
versuffix=""
|
versuffix=""
|
||||||
release=""
|
release=""
|
||||||
libname=libfoo
|
libname=libfoo
|
||||||
eval _SOSUFFIX=\"$shrext_cmds\"
|
eval _SOSUFFIX=\"$shrext\"
|
||||||
if test "$_SOSUFFIX" = "" ; then
|
if test "X$_SOSUFFIX" = "" ; then
|
||||||
_SOSUFFIX=".so"
|
_SOSUFFIX=".so"
|
||||||
if test "$enable_shared" != "yes"; then
|
if test `$LIBTOOL_PROG --config | grep build_libtool_libs | grep no` 2>/dev/null; then
|
||||||
if test "$_SOSUFFIX_MESSAGE" = ""; then
|
if test "X$_SOSUFFIX_MESSAGE" = "X"; then
|
||||||
_SOSUFFIX_MESSAGE=yes
|
_SOSUFFIX_MESSAGE=yes
|
||||||
AC_MSG_WARN([libtool may not know about this architecture.])
|
AC_MSG_WARN([libtool may not know about this architecture.])
|
||||||
AC_MSG_WARN([assuming $_SOSUFFIX suffix for dynamic libraries.])
|
AC_MSG_WARN([assuming $_SUFFIX suffix for dynamic libraries.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
0
dist/aclocal/tcl.m4 → dist/aclocal/tcl.ac
vendored
0
dist/aclocal/tcl.m4 → dist/aclocal/tcl.ac
vendored
130
dist/aclocal/types.ac
vendored
Normal file
130
dist/aclocal/types.ac
vendored
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
# $Id: types.ac 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
|
# Check the sizes we know about, and see if any of them match what's needed.
|
||||||
|
#
|
||||||
|
# Prefer ints to anything else, because read, write and others historically
|
||||||
|
# returned an int.
|
||||||
|
AC_DEFUN(AM_SEARCH_USIZES, [
|
||||||
|
case "$3" in
|
||||||
|
"$ac_cv_sizeof_unsigned_int")
|
||||||
|
$1="typedef unsigned int $2;";;
|
||||||
|
"$ac_cv_sizeof_unsigned_char")
|
||||||
|
$1="typedef unsigned char $2;";;
|
||||||
|
"$ac_cv_sizeof_unsigned_short")
|
||||||
|
$1="typedef unsigned short $2;";;
|
||||||
|
"$ac_cv_sizeof_unsigned_long")
|
||||||
|
$1="typedef unsigned long $2;";;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([No unsigned $3-byte integral type]);;
|
||||||
|
esac])
|
||||||
|
AC_DEFUN(AM_SEARCH_SSIZES, [
|
||||||
|
case "$3" in
|
||||||
|
"$ac_cv_sizeof_int")
|
||||||
|
$1="typedef int $2;";;
|
||||||
|
"$ac_cv_sizeof_char")
|
||||||
|
$1="typedef char $2;";;
|
||||||
|
"$ac_cv_sizeof_short")
|
||||||
|
$1="typedef short $2;";;
|
||||||
|
"$ac_cv_sizeof_long")
|
||||||
|
$1="typedef long $2;";;
|
||||||
|
*)
|
||||||
|
AC_MSG_ERROR([No signed $3-byte integral type]);;
|
||||||
|
esac])
|
||||||
|
|
||||||
|
# Check for the standard system types.
|
||||||
|
AC_DEFUN(AM_TYPES, [
|
||||||
|
|
||||||
|
# db.h includes <sys/types.h> and <stdio.h>, not the other default includes
|
||||||
|
# autoconf usually includes. For that reason, we specify a set of includes
|
||||||
|
# for all type checking tests. [#5060]
|
||||||
|
#
|
||||||
|
# IBM's OS/390 and z/OS releases have types in <inttypes.h> not also found
|
||||||
|
# in <sys/types.h>. Include <inttypes.h> as well, if it exists.
|
||||||
|
AC_SUBST(inttypes_decl)
|
||||||
|
db_includes="#include <sys/types.h>"
|
||||||
|
AC_CHECK_HEADER(inttypes.h, [
|
||||||
|
inttypes_decl="#include <inttypes.h>"
|
||||||
|
db_includes="$db_includes
|
||||||
|
#include <inttypes.h>"])
|
||||||
|
db_includes="$db_includes
|
||||||
|
#include <stdio.h>"
|
||||||
|
|
||||||
|
# We need to know the sizes of various objects on this system.
|
||||||
|
# We don't use the SIZEOF_XXX values created by autoconf.
|
||||||
|
AC_CHECK_SIZEOF(char,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(unsigned char,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(short,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(unsigned short,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(int,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(unsigned int,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(long,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(unsigned long,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(size_t,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(char *,, $db_includes)
|
||||||
|
AC_CHECK_SIZEOF(long double,, $db_includes)
|
||||||
|
|
||||||
|
# We require off_t and size_t, and we don't try to substitute our own
|
||||||
|
# if we can't find them.
|
||||||
|
AC_CHECK_TYPE(off_t,, AC_MSG_ERROR([No off_t type.]), $db_includes)
|
||||||
|
AC_CHECK_TYPE(size_t,, AC_MSG_ERROR([No size_t type.]), $db_includes)
|
||||||
|
|
||||||
|
# We look for u_char, u_short, u_int, u_long -- if we can't find them,
|
||||||
|
# we create our own.
|
||||||
|
AC_SUBST(u_char_decl)
|
||||||
|
AC_CHECK_TYPE(u_char,,
|
||||||
|
[u_char_decl="typedef unsigned char u_char;"], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_short_decl)
|
||||||
|
AC_CHECK_TYPE(u_short,,
|
||||||
|
[u_short_decl="typedef unsigned short u_short;"], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_int_decl)
|
||||||
|
AC_CHECK_TYPE(u_int,,
|
||||||
|
[u_int_decl="typedef unsigned int u_int;"], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_long_decl)
|
||||||
|
AC_CHECK_TYPE(u_long,,
|
||||||
|
[u_long_decl="typedef unsigned long u_long;"], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_int8_decl)
|
||||||
|
AC_CHECK_TYPE(u_int8_t,,
|
||||||
|
[AM_SEARCH_USIZES(u_int8_decl, u_int8_t, 1)], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_int16_decl)
|
||||||
|
AC_CHECK_TYPE(u_int16_t,,
|
||||||
|
[AM_SEARCH_USIZES(u_int16_decl, u_int16_t, 2)], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(int16_decl)
|
||||||
|
AC_CHECK_TYPE(int16_t,,
|
||||||
|
[AM_SEARCH_SSIZES(int16_decl, int16_t, 2)], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(u_int32_decl)
|
||||||
|
AC_CHECK_TYPE(u_int32_t,,
|
||||||
|
[AM_SEARCH_USIZES(u_int32_decl, u_int32_t, 4)], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(int32_decl)
|
||||||
|
AC_CHECK_TYPE(int32_t,,
|
||||||
|
[AM_SEARCH_SSIZES(int32_decl, int32_t, 4)], $db_includes)
|
||||||
|
|
||||||
|
AC_SUBST(long_double_decl)
|
||||||
|
AC_CHECK_TYPE(long double,
|
||||||
|
[long_double_decl="typedef long double long_double_t;"],
|
||||||
|
[long_double_decl="typedef long double long_double_t;"], $db_includes)
|
||||||
|
|
||||||
|
# Check for ssize_t -- if none exists, find a signed integral type that's
|
||||||
|
# the same size as a size_t.
|
||||||
|
AC_SUBST(ssize_t_decl)
|
||||||
|
AC_CHECK_TYPE(ssize_t,,
|
||||||
|
[AM_SEARCH_SSIZES(ssize_t_decl, ssize_t, $ac_cv_sizeof_size_t)],
|
||||||
|
$db_includes)
|
||||||
|
|
||||||
|
# Find the largest integral type.
|
||||||
|
AC_SUBST(db_align_t_decl)
|
||||||
|
AC_CHECK_TYPE(unsigned long long,
|
||||||
|
[db_align_t_decl="typedef unsigned long long db_align_t;"],
|
||||||
|
[db_align_t_decl="typedef unsigned long db_align_t;"], $db_includes)
|
||||||
|
|
||||||
|
# Find an integral type which is the same size as a pointer.
|
||||||
|
AC_SUBST(db_alignp_t_decl)
|
||||||
|
AM_SEARCH_USIZES(db_alignp_t_decl, db_alignp_t, $ac_cv_sizeof_char_p)
|
||||||
|
])
|
218
dist/aclocal/types.m4
vendored
218
dist/aclocal/types.m4
vendored
|
@ -1,218 +0,0 @@
|
||||||
# $Id$
|
|
||||||
|
|
||||||
# Check the sizes we know about, and see if any of them match what's needed.
|
|
||||||
#
|
|
||||||
# Prefer ints to anything else, because read, write and others historically
|
|
||||||
# returned an int.
|
|
||||||
AC_DEFUN(AM_SEARCH_USIZES, [
|
|
||||||
case "$3" in
|
|
||||||
"$ac_cv_sizeof_unsigned_int")
|
|
||||||
$1="typedef unsigned int $2;";;
|
|
||||||
"$ac_cv_sizeof_unsigned_char")
|
|
||||||
$1="typedef unsigned char $2;";;
|
|
||||||
"$ac_cv_sizeof_unsigned_short")
|
|
||||||
$1="typedef unsigned short $2;";;
|
|
||||||
"$ac_cv_sizeof_unsigned_long")
|
|
||||||
$1="typedef unsigned long $2;";;
|
|
||||||
"$ac_cv_sizeof_unsigned_long_long")
|
|
||||||
$1="typedef unsigned long long $2;";;
|
|
||||||
*)
|
|
||||||
if test "$4" != "notfatal"; then
|
|
||||||
AC_MSG_ERROR([No unsigned $3-byte integral type])
|
|
||||||
fi;;
|
|
||||||
esac])
|
|
||||||
AC_DEFUN(AM_SEARCH_SSIZES, [
|
|
||||||
case "$3" in
|
|
||||||
"$ac_cv_sizeof_int")
|
|
||||||
$1="typedef int $2;";;
|
|
||||||
"$ac_cv_sizeof_char")
|
|
||||||
$1="typedef char $2;";;
|
|
||||||
"$ac_cv_sizeof_short")
|
|
||||||
$1="typedef short $2;";;
|
|
||||||
"$ac_cv_sizeof_long")
|
|
||||||
$1="typedef long $2;";;
|
|
||||||
"$ac_cv_sizeof_long_long")
|
|
||||||
$1="typedef long long $2;";;
|
|
||||||
*)
|
|
||||||
if test "$4" != "notfatal"; then
|
|
||||||
AC_MSG_ERROR([No signed $3-byte integral type])
|
|
||||||
fi;;
|
|
||||||
esac])
|
|
||||||
|
|
||||||
# Check for the standard system types.
|
|
||||||
AC_DEFUN(AM_TYPES, [
|
|
||||||
|
|
||||||
# db.h includes <sys/types.h> and <stdio.h>, not the other default includes
|
|
||||||
# autoconf usually includes. For that reason, we specify a set of includes
|
|
||||||
# for all type checking tests. [#5060]
|
|
||||||
#
|
|
||||||
# C99 says types should be in <stdint.h>; include <stdint.h> if it exists.
|
|
||||||
#
|
|
||||||
# Some systems have types in <stddef.h>; include <stddef.h> if it exists.
|
|
||||||
#
|
|
||||||
# IBM's OS/390 and z/OS releases have types in <inttypes.h> not also found
|
|
||||||
# in <sys/types.h>; include <inttypes.h> if it exists.
|
|
||||||
db_includes="#include <sys/types.h>"
|
|
||||||
AC_SUBST(inttypes_h_decl)
|
|
||||||
AC_CHECK_HEADER(inttypes.h, [
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <inttypes.h>"
|
|
||||||
inttypes_h_decl="#include <inttypes.h>"])
|
|
||||||
|
|
||||||
# IRIX has stdint.h that is only available when using c99 (i.e. __c99
|
|
||||||
# is defined). Problem with having it in a public header is that a c++
|
|
||||||
# compiler cannot #include <db.h> if db.h #includes stdint.h, so we
|
|
||||||
# need to check that stdint.h is available for all cases. Also the
|
|
||||||
# IRIX compiler does not exit with a non-zero exit code when it sees
|
|
||||||
# #error, so we actually need to use the header for the compiler to fail.
|
|
||||||
AC_SUBST(stdint_h_decl)
|
|
||||||
AC_MSG_CHECKING(for stdint.h)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
#include <stdint.h>
|
|
||||||
int main() {
|
|
||||||
uint_least8_t x=0;
|
|
||||||
return x;
|
|
||||||
}]])],[AC_MSG_RESULT(yes)
|
|
||||||
if test "$db_cv_cxx" = "yes"; then
|
|
||||||
AC_MSG_CHECKING([if stdint.h can be used by C++])
|
|
||||||
AC_LANG_PUSH(C++)
|
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|
||||||
#include <stdint.h>
|
|
||||||
int main() {
|
|
||||||
uint_least8_t x=0;
|
|
||||||
return x;
|
|
||||||
}]])],[AC_MSG_RESULT(yes)
|
|
||||||
stdint_h_decl="#include <stdint.h>"
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <stdint.h>"
|
|
||||||
],[AC_MSG_RESULT(no)
|
|
||||||
stdint_h_decl="#ifndef __cplusplus
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif"
|
|
||||||
db_includes="$db_includes
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#include <stdint.h>
|
|
||||||
#endif"
|
|
||||||
])
|
|
||||||
AC_LANG_POP
|
|
||||||
else
|
|
||||||
stdint_h_decl="#include <stdint.h>"
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <stdint.h>"
|
|
||||||
fi],[AC_MSG_RESULT(no)])
|
|
||||||
|
|
||||||
AC_SUBST(stddef_h_decl)
|
|
||||||
AC_CHECK_HEADER(stddef.h, [
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <stddef.h>"
|
|
||||||
stddef_h_decl="#include <stddef.h>"])
|
|
||||||
AC_SUBST(unistd_h_decl)
|
|
||||||
AC_CHECK_HEADER(unistd.h, [
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <unistd.h>"
|
|
||||||
unistd_h_decl="#include <unistd.h>"])
|
|
||||||
db_includes="$db_includes
|
|
||||||
#include <stdio.h>"
|
|
||||||
|
|
||||||
# We need to know the sizes of various objects on this system.
|
|
||||||
AC_CHECK_SIZEOF(char,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(unsigned char,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(short,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(unsigned short,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(int,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(unsigned int,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(long,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(unsigned long,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(long long,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(unsigned long long,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(char *,, $db_includes)
|
|
||||||
AC_CHECK_SIZEOF(long double,, $db_includes)
|
|
||||||
|
|
||||||
# We look for u_char, u_short, u_int, u_long -- if we can't find them,
|
|
||||||
# we create our own.
|
|
||||||
AC_SUBST(u_char_decl)
|
|
||||||
AC_CHECK_TYPE(u_char,,
|
|
||||||
[u_char_decl="typedef unsigned char u_char;"], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_short_decl)
|
|
||||||
AC_CHECK_TYPE(u_short,,
|
|
||||||
[u_short_decl="typedef unsigned short u_short;"], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_int_decl)
|
|
||||||
AC_CHECK_TYPE(u_int,,
|
|
||||||
[u_int_decl="typedef unsigned int u_int;"], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_long_decl)
|
|
||||||
AC_CHECK_TYPE(u_long,,
|
|
||||||
[u_long_decl="typedef unsigned long u_long;"], $db_includes)
|
|
||||||
|
|
||||||
# We look for fixed-size variants of u_char, u_short, u_int, u_long as well.
|
|
||||||
AC_SUBST(u_int8_decl)
|
|
||||||
AC_CHECK_TYPE(u_int8_t,,
|
|
||||||
[AM_SEARCH_USIZES(u_int8_decl, u_int8_t, 1)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_int16_decl)
|
|
||||||
AC_CHECK_TYPE(u_int16_t,,
|
|
||||||
[AM_SEARCH_USIZES(u_int16_decl, u_int16_t, 2)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(int16_decl)
|
|
||||||
AC_CHECK_TYPE(int16_t,,
|
|
||||||
[AM_SEARCH_SSIZES(int16_decl, int16_t, 2)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_int32_decl)
|
|
||||||
AC_CHECK_TYPE(u_int32_t,,
|
|
||||||
[AM_SEARCH_USIZES(u_int32_decl, u_int32_t, 4)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(int32_decl)
|
|
||||||
AC_CHECK_TYPE(int32_t,,
|
|
||||||
[AM_SEARCH_SSIZES(int32_decl, int32_t, 4)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(u_int64_decl)
|
|
||||||
AC_CHECK_TYPE(u_int64_t,,
|
|
||||||
[AM_SEARCH_USIZES(u_int64_decl, u_int64_t, 8, notfatal)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(int64_decl)
|
|
||||||
AC_CHECK_TYPE(int64_t,,
|
|
||||||
[AM_SEARCH_SSIZES(int64_decl, int64_t, 8, notfatal)], $db_includes)
|
|
||||||
|
|
||||||
AC_SUBST(long_double_decl)
|
|
||||||
AC_CHECK_TYPE(long double,
|
|
||||||
[long_double_decl="typedef long double long_double_t;"],
|
|
||||||
[long_double_decl="typedef long double long_double_t;"], $db_includes)
|
|
||||||
|
|
||||||
# No currently autoconf'd systems lack FILE, off_t pid_t, size_t, time_t.
|
|
||||||
#
|
|
||||||
# We require them, we don't try to substitute our own if we can't find them.
|
|
||||||
AC_SUBST(FILE_t_decl)
|
|
||||||
AC_CHECK_TYPE(FILE *,, AC_MSG_ERROR([No FILE type.]), $db_includes)
|
|
||||||
AC_SUBST(off_t_decl)
|
|
||||||
AC_CHECK_TYPE(off_t,, AC_MSG_ERROR([No off_t type.]), $db_includes)
|
|
||||||
AC_SUBST(pid_t_decl)
|
|
||||||
AC_CHECK_TYPE(pid_t,, AC_MSG_ERROR([No pid_t type.]), $db_includes)
|
|
||||||
AC_SUBST(size_t_decl)
|
|
||||||
AC_CHECK_TYPE(size_t,, AC_MSG_ERROR([No size_t type.]), $db_includes)
|
|
||||||
AC_SUBST(time_t_decl)
|
|
||||||
AC_CHECK_TYPE(time_t,, AC_MSG_ERROR([No time_t type.]), $db_includes)
|
|
||||||
|
|
||||||
# Check for ssize_t -- if none exists, find a signed integral type that's
|
|
||||||
# the same size as a size_t.
|
|
||||||
AC_CHECK_SIZEOF(size_t,, $db_includes)
|
|
||||||
AC_SUBST(ssize_t_decl)
|
|
||||||
AC_CHECK_TYPE(ssize_t,,
|
|
||||||
[AM_SEARCH_SSIZES(ssize_t_decl, ssize_t, $ac_cv_sizeof_size_t)],
|
|
||||||
$db_includes)
|
|
||||||
|
|
||||||
# Check for uintmax_t -- if none exists, find the largest unsigned integral
|
|
||||||
# type available.
|
|
||||||
AC_SUBST(uintmax_t_decl)
|
|
||||||
AC_CHECK_TYPE(uintmax_t,, [AC_CHECK_TYPE(unsigned long long,
|
|
||||||
[uintmax_t_decl="typedef unsigned long long uintmax_t;"],
|
|
||||||
[uintmax_t_decl="typedef unsigned long uintmax_t;"], $db_includes)])
|
|
||||||
|
|
||||||
# Check for uintptr_t -- if none exists, find an integral type which is
|
|
||||||
# the same size as a pointer.
|
|
||||||
AC_SUBST(uintptr_t_decl)
|
|
||||||
AC_CHECK_TYPE(uintptr_t,,
|
|
||||||
[AM_SEARCH_USIZES(uintptr_t_decl, uintptr_t, $ac_cv_sizeof_char_p)])
|
|
||||||
|
|
||||||
])
|
|
6
dist/buildrel
vendored
6
dist/buildrel
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: buildrel 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
#
|
#
|
||||||
# Build the distribution package.
|
# Build the distribution package.
|
||||||
|
@ -28,7 +30,7 @@ setenv D `pwd`
|
||||||
cd $D/dist
|
cd $D/dist
|
||||||
cvs -q update RELEASE
|
cvs -q update RELEASE
|
||||||
vi RELEASE
|
vi RELEASE
|
||||||
setenv VERSION `sh -c '. RELEASE; echo $DBSQL_VERSION'`
|
setenv VERSION `sh -c '. RELEASE; echo $DB_VERSION'`
|
||||||
echo "Version: $VERSION"
|
echo "Version: $VERSION"
|
||||||
|
|
||||||
# Make sure the source tree is up-to-date
|
# Make sure the source tree is up-to-date
|
||||||
|
|
2041
dist/config.guess
vendored
Executable file → Normal file
2041
dist/config.guess
vendored
Executable file → Normal file
File diff suppressed because it is too large
Load diff
2725
dist/config.sub
vendored
Executable file → Normal file
2725
dist/config.sub
vendored
Executable file → Normal file
File diff suppressed because it is too large
Load diff
44
dist/configure.ac
vendored
44
dist/configure.ac
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2009 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,12 +15,16 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: configure.ac 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
PACKAGE=dbsql
|
PACKAGE=dbsql
|
||||||
AC_INIT([DBSQL],[__EDIT_DBSQL_VERSION__],[support@dbsql.org],[dbsql-__EDIT_DBSQL_VERSION__])
|
AC_INIT(DBSQL,
|
||||||
AC_LANG(C)
|
__EDIT_DBSQL_VERSION__,
|
||||||
|
support@dbsql.org,
|
||||||
|
dbsql-__EDIT_DBSQL_VERSION__)
|
||||||
AC_CONFIG_SRCDIR([../src/clib/memcmp.c])
|
AC_CONFIG_SRCDIR([../src/clib/memcmp.c])
|
||||||
AC_CONFIG_HEADERS([dbsql_config.h:config.hin])
|
AC_CONFIG_HEADERS([dbsql_config.h:config.hin])
|
||||||
|
|
||||||
|
@ -242,21 +246,21 @@ AC_PROG_CC(cc gcc)
|
||||||
AC_SUBST(DB_PROTO1)
|
AC_SUBST(DB_PROTO1)
|
||||||
AC_SUBST(DB_PROTO2)
|
AC_SUBST(DB_PROTO2)
|
||||||
|
|
||||||
# Clear __P, some other systems use it too.
|
|
||||||
DB_PROTO1="#undef __P"
|
DB_PROTO1="#undef __P"
|
||||||
if test "$ac_cv_prog_cc_c89" = "no"; then
|
|
||||||
DB_PROTO2="#define __P(protos) ()"
|
# AC_PROG_CC_STDC only sets ac_cv_prog_cc_stdc if the test fails, so
|
||||||
|
# check for "no", not "yes".
|
||||||
|
if test "$ac_cv_prog_cc_stdc" = "no"; then
|
||||||
|
DB_PROTO2="#define __P(protos) ()"
|
||||||
else
|
else
|
||||||
DB_PROTO2="#define __P(protos) protos"
|
DB_PROTO2="#define __P(protos) protos"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for "const" and "inline" keywords.
|
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_SUBST(DB_CONST)
|
AC_SUBST(DB_CONST)
|
||||||
if test "$ac_cv_c_const" != "yes"; then
|
if test "$ac_cv_c_const" != "yes"; then
|
||||||
DB_CONST="#define const"
|
DB_CONST="#define const"
|
||||||
fi
|
fi
|
||||||
AC_C_INLINE
|
|
||||||
|
|
||||||
# Because of shared library building, the ${CC} used for config tests
|
# Because of shared library building, the ${CC} used for config tests
|
||||||
# may be different than the ${CC} we want to put in the Makefile.
|
# may be different than the ${CC} we want to put in the Makefile.
|
||||||
|
@ -289,13 +293,14 @@ if test "$db_cv_cxx" = "yes"; then
|
||||||
###### WORKAROUND: SEE SR #7938
|
###### WORKAROUND: SEE SR #7938
|
||||||
AC_PROG_CXXCPP
|
AC_PROG_CXXCPP
|
||||||
###############################
|
###############################
|
||||||
AC_CXX_STDHEADERS
|
AC_CXX_HAVE_STDHEADERS
|
||||||
MAKEFILE_CXX="${CXX}"
|
MAKEFILE_CXX="${CXX}"
|
||||||
MAKEFILE_CXXLINK="${CXX}"
|
MAKEFILE_CXXLINK="${CXX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do some gcc specific configuration.
|
# Do some gcc specific configuration.
|
||||||
AC_GCC_CONFIG1
|
AC_GCC_CONFIG1
|
||||||
|
AC_GCC_CONFIG2
|
||||||
|
|
||||||
# We need the -Kthread/-pthread flag when compiling on SCO/Caldera's UnixWare
|
# We need the -Kthread/-pthread flag when compiling on SCO/Caldera's UnixWare
|
||||||
# and OpenUNIX releases. We can't make the test until we know which compiler
|
# and OpenUNIX releases. We can't make the test until we know which compiler
|
||||||
|
@ -316,8 +321,7 @@ export CC CCC
|
||||||
CCC=CXX
|
CCC=CXX
|
||||||
|
|
||||||
# Libtool configuration.
|
# Libtool configuration.
|
||||||
LT_INIT
|
AC_PROG_LIBTOOL
|
||||||
AC_SUBST([LIBTOOL_DEPS])
|
|
||||||
|
|
||||||
SOFLAGS="-rpath \$(libdir)"
|
SOFLAGS="-rpath \$(libdir)"
|
||||||
LIBTOOL_PROG="${SHELL} ./libtool"
|
LIBTOOL_PROG="${SHELL} ./libtool"
|
||||||
|
@ -429,19 +433,15 @@ fi
|
||||||
|
|
||||||
# Checks for include files, structures, C types.
|
# Checks for include files, structures, C types.
|
||||||
AC_HEADER_STAT
|
AC_HEADER_STAT
|
||||||
AC_CHECK_HEADERS_ONCE([sys/time.h])
|
AC_HEADER_TIME
|
||||||
# End of obsolete code.
|
|
||||||
|
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_CHECK_HEADERS(sys/select.h sys/time.h sys/fcntl.h)
|
AC_CHECK_HEADERS(sys/select.h sys/time.h sys/fcntl.h)
|
||||||
AC_CHECK_MEMBERS([struct stat.st_blksize])
|
AC_CHECK_MEMBERS([struct stat.st_blksize])
|
||||||
AM_TYPES
|
AM_TYPES
|
||||||
|
|
||||||
AC_CACHE_CHECK([for ANSI C exit success/failure values], db_cv_exit_defines, [
|
AC_CACHE_CHECK([for ANSI C exit success/failure values], db_cv_exit_defines, [
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
AC_TRY_COMPILE([#include <stdlib.h>], return (EXIT_SUCCESS);,
|
||||||
[[#include <stdlib.h>]],
|
[db_cv_exit_defines=yes], [db_cv_exit_defines=no])])
|
||||||
[[return (EXIT_SUCCESS);]])],
|
|
||||||
[db_cv_exit_defines=yes],[db_cv_exit_defines=no])])
|
|
||||||
if test "$db_cv_exit_defines" = "yes"; then
|
if test "$db_cv_exit_defines" = "yes"; then
|
||||||
AC_DEFINE(HAVE_EXIT_SUCCESS)
|
AC_DEFINE(HAVE_EXIT_SUCCESS)
|
||||||
AH_TEMPLATE(HAVE_EXIT_SUCCESS,
|
AH_TEMPLATE(HAVE_EXIT_SUCCESS,
|
||||||
|
@ -461,12 +461,10 @@ AC_CHECK_FUNC(sched_yield,,
|
||||||
# library. Also we can't depend on any specific call existing (pthread_create,
|
# library. Also we can't depend on any specific call existing (pthread_create,
|
||||||
# for example), as it may be #defined in an include file -- OSF/1 (Tru64) has
|
# for example), as it may be #defined in an include file -- OSF/1 (Tru64) has
|
||||||
# this problem.
|
# this problem.
|
||||||
AC_CHECK_LIB([pthread],[main],[LOAD_LIBS="$LOAD_LIBS -lpthread"],[],[])ac_cv_lib_pthread=ac_cv_lib_pthread_main
|
AC_HAVE_LIBRARY(pthread, LOAD_LIBS="$LOAD_LIBS -lpthread")
|
||||||
|
|
||||||
|
|
||||||
# We use sqrt() so we need the math library -lm
|
# We use sqrt() so we need the math library -lm
|
||||||
AC_CHECK_LIB([m],[main],[LIBS="$LIBS -lm"],[],[])ac_cv_lib_m=ac_cv_lib_m_main
|
AC_HAVE_LIBRARY(m, LIBS="$LIBS -lm")
|
||||||
|
|
||||||
|
|
||||||
# Checks for system functions for which we have replacements.
|
# Checks for system functions for which we have replacements.
|
||||||
AC_REPLACE_FUNCS(getopt memcmp memcpy memmove strdup strndup strerror)
|
AC_REPLACE_FUNCS(getopt memcmp memcpy memmove strdup strndup strerror)
|
||||||
|
|
2
dist/dbsql.pc.in
vendored
2
dist/dbsql.pc.in
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
2
dist/dbsql.spec.in
vendored
2
dist/dbsql.spec.in
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|
17
dist/gen_inc.awk
vendored
17
dist/gen_inc.awk
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -34,7 +34,6 @@
|
||||||
# e_pfile include file that contains EXTERN prototypes
|
# e_pfile include file that contains EXTERN prototypes
|
||||||
# i_dfile list of internal (PUBLIC) #defines
|
# i_dfile list of internal (PUBLIC) #defines
|
||||||
# i_pfile include file that contains internal (PUBLIC) prototypes
|
# i_pfile include file that contains internal (PUBLIC) prototypes
|
||||||
# i_sfile include file that contains internal (STATIC) prototypes
|
|
||||||
/PUBLIC:/ {
|
/PUBLIC:/ {
|
||||||
sub("^.*PUBLIC:[ ][ ]*", "")
|
sub("^.*PUBLIC:[ ][ ]*", "")
|
||||||
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
||||||
|
@ -50,20 +49,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/STATIC:/ {
|
|
||||||
sub("^.*STATIC:[ ][ ]*", "")
|
|
||||||
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
|
||||||
print $0 >> i_sfile
|
|
||||||
next
|
|
||||||
}
|
|
||||||
sline = sprintf("%s %s", sline, $0)
|
|
||||||
if (sline ~ "\\)\\);") {
|
|
||||||
sub("^[ ]*", "", sline)
|
|
||||||
print sline >> i_sfile
|
|
||||||
sline = ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/EXTERN:/ {
|
/EXTERN:/ {
|
||||||
sub("^.*EXTERN:[ ][ ]*", "")
|
sub("^.*EXTERN:[ ][ ]*", "")
|
||||||
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
if ($0 ~ "^#if|^#ifdef|^#ifndef|^#else|^#endif") {
|
||||||
|
|
696
dist/install-sh
vendored
Executable file → Normal file
696
dist/install-sh
vendored
Executable file → Normal file
|
@ -1,541 +1,251 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
#
|
||||||
# install - install a program, script, or datafile
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||||
scriptversion=2020-11-14.01; # UTC
|
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
|
||||||
# following copyright and license.
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1994 X Consortium
|
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
# of this software and associated documentation files (the "Software"), to
|
# documentation for any purpose is hereby granted without fee, provided that
|
||||||
# deal in the Software without restriction, including without limitation the
|
# the above copyright notice appear in all copies and that both that
|
||||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
# copyright notice and this permission notice appear in supporting
|
||||||
# sell copies of the Software, and to permit persons to whom the Software is
|
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||||
# furnished to do so, subject to the following conditions:
|
# publicity pertaining to distribution of the software without specific,
|
||||||
#
|
# written prior permission. M.I.T. makes no representations about the
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# suitability of this software for any purpose. It is provided "as is"
|
||||||
# all copies or substantial portions of the Software.
|
# without express or implied warranty.
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
|
||||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Except as contained in this notice, the name of the X Consortium shall not
|
|
||||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
# ings in this Software without prior written authorization from the X Consor-
|
|
||||||
# tium.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# FSF changes to this file are in the public domain.
|
|
||||||
#
|
#
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
# 'make' implicit rules from creating a file called install from it
|
# `make' implicit rules from creating a file called install from it
|
||||||
# when there is no Makefile.
|
# when there is no Makefile.
|
||||||
#
|
#
|
||||||
# This script is compatible with the BSD install script, but was written
|
# This script is compatible with the BSD install script, but was written
|
||||||
# from scratch.
|
# from scratch. It can only install one file at a time, a restriction
|
||||||
|
# shared with many OS's install programs.
|
||||||
|
|
||||||
tab=' '
|
|
||||||
nl='
|
|
||||||
'
|
|
||||||
IFS=" $tab$nl"
|
|
||||||
|
|
||||||
# Set DOITPROG to "echo" to test this script.
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
doit=${DOITPROG-}
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
doit_exec=${doit:-exec}
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
# Put in absolute file names if you don't have them in your path;
|
|
||||||
# or use environment vars.
|
|
||||||
|
|
||||||
chgrpprog=${CHGRPPROG-chgrp}
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
chmodprog=${CHMODPROG-chmod}
|
|
||||||
chownprog=${CHOWNPROG-chown}
|
|
||||||
cmpprog=${CMPPROG-cmp}
|
|
||||||
cpprog=${CPPROG-cp}
|
|
||||||
mkdirprog=${MKDIRPROG-mkdir}
|
|
||||||
mvprog=${MVPROG-mv}
|
|
||||||
rmprog=${RMPROG-rm}
|
|
||||||
stripprog=${STRIPPROG-strip}
|
|
||||||
|
|
||||||
posix_mkdir=
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
# Desired mode of installed file.
|
transformbasename=""
|
||||||
mode=0755
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
# Create dirs (including intermediate dirs) using mode 755.
|
chmodcmd="$chmodprog 0755"
|
||||||
# This is like GNU 'install' as of coreutils 8.32 (2020).
|
chowncmd=""
|
||||||
mkdir_umask=22
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
backupsuffix=
|
|
||||||
chgrpcmd=
|
|
||||||
chmodcmd=$chmodprog
|
|
||||||
chowncmd=
|
|
||||||
mvcmd=$mvprog
|
|
||||||
rmcmd="$rmprog -f"
|
rmcmd="$rmprog -f"
|
||||||
stripcmd=
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
src=
|
while [ x"$1" != x ]; do
|
||||||
dst=
|
case $1 in
|
||||||
dir_arg=
|
-c) instcmd="$cpprog"
|
||||||
dst_arg=
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
copy_on_change=false
|
-d) dir_arg=true
|
||||||
is_target_a_directory=possibly
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
usage="\
|
-m) chmodcmd="$chmodprog $2"
|
||||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
shift
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
shift
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
continue;;
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
|
||||||
|
|
||||||
In the 1st form, copy SRCFILE to DSTFILE.
|
-o) chowncmd="$chownprog $2"
|
||||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
shift
|
||||||
In the 4th, create DIRECTORIES.
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
Options:
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
--help display this help and exit.
|
shift
|
||||||
--version display version info and exit.
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
-c (ignored)
|
-s) stripcmd="$stripprog"
|
||||||
-C install only if different (preserve data modification time)
|
shift
|
||||||
-d create directories instead of installing files.
|
continue;;
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
|
||||||
-o USER $chownprog installed files to USER.
|
|
||||||
-p pass -p to $cpprog.
|
|
||||||
-s $stripprog installed files.
|
|
||||||
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
|
|
||||||
-t DIRECTORY install into DIRECTORY.
|
|
||||||
-T report an error if DSTFILE is a directory.
|
|
||||||
|
|
||||||
Environment variables override the default commands:
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
shift
|
||||||
RMPROG STRIPPROG
|
continue;;
|
||||||
|
|
||||||
By default, rm is invoked with -f; when overridden with RMPROG,
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
it's up to you to specify -f if you want it.
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
If -S is not specified, no backups are attempted.
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
Email bug reports to bug-automake@gnu.org.
|
src=$1
|
||||||
Automake home page: https://www.gnu.org/software/automake/
|
else
|
||||||
"
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
while test $# -ne 0; do
|
dst=$1
|
||||||
case $1 in
|
fi
|
||||||
-c) ;;
|
shift
|
||||||
|
continue;;
|
||||||
-C) copy_on_change=true;;
|
esac
|
||||||
|
|
||||||
-d) dir_arg=true;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;;
|
|
||||||
|
|
||||||
-m) mode=$2
|
|
||||||
case $mode in
|
|
||||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
|
||||||
echo "$0: invalid mode: $mode" >&2
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-p) cpprog="$cpprog -p";;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog;;
|
|
||||||
|
|
||||||
-S) backupsuffix="$2"
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-t)
|
|
||||||
is_target_a_directory=always
|
|
||||||
dst_arg=$2
|
|
||||||
# Protect names problematic for 'test' and other utilities.
|
|
||||||
case $dst_arg in
|
|
||||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
|
||||||
esac
|
|
||||||
shift;;
|
|
||||||
|
|
||||||
-T) is_target_a_directory=never;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;;
|
|
||||||
|
|
||||||
--) shift
|
|
||||||
break;;
|
|
||||||
|
|
||||||
-*) echo "$0: invalid option: $1" >&2
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
*) break;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# We allow the use of options -d and -T together, by making -d
|
if [ x"$src" = x ]
|
||||||
# take the precedence; this is for compatibility with GNU install.
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
if test -n "$dir_arg"; then
|
exit 1
|
||||||
if test -n "$dst_arg"; then
|
else
|
||||||
echo "$0: target directory not allowed when installing a directory." >&2
|
true
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
if [ x"$dir_arg" != x ]; then
|
||||||
# When -d is used, all remaining arguments are directories to create.
|
dst=$src
|
||||||
# When -t is used, the destination is already specified.
|
src=""
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$dst_arg"; then
|
|
||||||
# $@ is not empty: it contains at least $arg.
|
|
||||||
set fnord "$@" "$dst_arg"
|
|
||||||
shift # fnord
|
|
||||||
fi
|
|
||||||
shift # arg
|
|
||||||
dst_arg=$arg
|
|
||||||
# Protect names problematic for 'test' and other utilities.
|
|
||||||
case $dst_arg in
|
|
||||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $# -eq 0; then
|
if [ -d $dst ]; then
|
||||||
if test -z "$dir_arg"; then
|
instcmd=:
|
||||||
echo "$0: no input file specified." >&2
|
chmodcmd=""
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# It's OK to call 'install-sh -d' without argument.
|
|
||||||
# This can happen when creating conditional directories.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
|
||||||
if test ! -d "$dst_arg"; then
|
|
||||||
echo "$0: $dst_arg: Is not a directory." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
do_exit='(exit $ret); exit $ret'
|
|
||||||
trap "ret=129; $do_exit" 1
|
|
||||||
trap "ret=130; $do_exit" 2
|
|
||||||
trap "ret=141; $do_exit" 13
|
|
||||||
trap "ret=143; $do_exit" 15
|
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes.
|
|
||||||
# However, 'strip' requires both read and write access to temps.
|
|
||||||
case $mode in
|
|
||||||
# Optimize common cases.
|
|
||||||
*644) cp_umask=133;;
|
|
||||||
*755) cp_umask=22;;
|
|
||||||
|
|
||||||
*[0-7])
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw='% 200'
|
|
||||||
fi
|
|
||||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
|
||||||
*)
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw=,u+rw
|
|
||||||
fi
|
|
||||||
cp_umask=$mode$u_plus_rw;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
for src
|
|
||||||
do
|
|
||||||
# Protect names problematic for 'test' and other utilities.
|
|
||||||
case $src in
|
|
||||||
-* | [=\(\)!]) src=./$src;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
dst=$src
|
|
||||||
dstdir=$dst
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
# Don't chown directories that already exist.
|
|
||||||
if test $dstdir_status = 0; then
|
|
||||||
chowncmd=""
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
if test ! -f "$src" && test ! -d "$src"; then
|
|
||||||
echo "$0: $src does not exist." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dst_arg"; then
|
|
||||||
echo "$0: no destination specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
dst=$dst_arg
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename.
|
|
||||||
if test -d "$dst"; then
|
|
||||||
if test "$is_target_a_directory" = never; then
|
|
||||||
echo "$0: $dst_arg: Is a directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
dstdir=$dst
|
|
||||||
dstbase=`basename "$src"`
|
|
||||||
case $dst in
|
|
||||||
*/) dst=$dst$dstbase;;
|
|
||||||
*) dst=$dst/$dstbase;;
|
|
||||||
esac
|
|
||||||
dstdir_status=0
|
|
||||||
else
|
|
||||||
dstdir=`dirname "$dst"`
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
case $dstdir in
|
|
||||||
*/) dstdirslash=$dstdir;;
|
|
||||||
*) dstdirslash=$dstdir/;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
obsolete_mkdir_used=false
|
|
||||||
|
|
||||||
if test $dstdir_status != 0; then
|
|
||||||
case $posix_mkdir in
|
|
||||||
'')
|
|
||||||
# With -d, create the new directory with the user-specified mode.
|
|
||||||
# Otherwise, rely on $mkdir_umask.
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
mkdir_mode=-m$mode
|
|
||||||
else
|
|
||||||
mkdir_mode=
|
|
||||||
fi
|
|
||||||
|
|
||||||
posix_mkdir=false
|
|
||||||
# The $RANDOM variable is not portable (e.g., dash). Use it
|
|
||||||
# here however when possible just to lower collision chance.
|
|
||||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
|
||||||
|
|
||||||
trap '
|
|
||||||
ret=$?
|
|
||||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
|
|
||||||
exit $ret
|
|
||||||
' 0
|
|
||||||
|
|
||||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
|
||||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
|
||||||
# directory is successfully created first before we actually test
|
|
||||||
# 'mkdir -p'.
|
|
||||||
if (umask $mkdir_umask &&
|
|
||||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
|
||||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
if test -z "$dir_arg" || {
|
|
||||||
# Check for POSIX incompatibilities with -m.
|
|
||||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
|
||||||
# other-writable bit of parent directory when it shouldn't.
|
|
||||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
|
||||||
test_tmpdir="$tmpdir/a"
|
|
||||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
|
||||||
case $ls_ld_tmpdir in
|
|
||||||
d????-?r-*) different_mode=700;;
|
|
||||||
d????-?--*) different_mode=755;;
|
|
||||||
*) false;;
|
|
||||||
esac &&
|
|
||||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
|
||||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
|
||||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
then posix_mkdir=:
|
|
||||||
fi
|
|
||||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
|
||||||
else
|
else
|
||||||
# Remove any dirs left behind by ancient mkdir implementations.
|
instcmd=$mkdirprog
|
||||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
|
||||||
fi
|
fi
|
||||||
trap '' 0;;
|
else
|
||||||
esac
|
|
||||||
|
|
||||||
if
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
$posix_mkdir && (
|
# might cause directories to be created, which would be especially bad
|
||||||
umask $mkdir_umask &&
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
|
||||||
)
|
|
||||||
then :
|
|
||||||
else
|
|
||||||
|
|
||||||
# mkdir does not conform to POSIX,
|
if [ -f $src -o -d $src ]
|
||||||
# or it failed possibly due to a race condition. Create the
|
then
|
||||||
# directory the slow way, step by step, checking for races as we go.
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
case $dstdir in
|
if [ x"$dst" = x ]
|
||||||
/*) prefix='/';;
|
then
|
||||||
[-=\(\)!]*) prefix='./';;
|
echo "install: no destination specified"
|
||||||
*) prefix='';;
|
exit 1
|
||||||
esac
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
oIFS=$IFS
|
# If destination is a directory, append the input filename; if your system
|
||||||
IFS=/
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
set -f
|
|
||||||
set fnord $dstdir
|
|
||||||
shift
|
|
||||||
set +f
|
|
||||||
IFS=$oIFS
|
|
||||||
|
|
||||||
prefixes=
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
for d
|
## this sed command emulates the dirname command
|
||||||
do
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
test X"$d" = X && continue
|
|
||||||
|
|
||||||
prefix=$prefix$d
|
# Make sure that the destination directory exists.
|
||||||
if test -d "$prefix"; then
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
prefixes=
|
|
||||||
else
|
|
||||||
if $posix_mkdir; then
|
|
||||||
(umask $mkdir_umask &&
|
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
|
||||||
# Don't fail if two instances are running concurrently.
|
|
||||||
test -d "$prefix" || exit 1
|
|
||||||
else
|
|
||||||
case $prefix in
|
|
||||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
|
||||||
*) qprefix=$prefix;;
|
|
||||||
esac
|
|
||||||
prefixes="$prefixes '$qprefix'"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
prefix=$prefix/
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -n "$prefixes"; then
|
# Skip lots of stat calls in the usual case.
|
||||||
# Don't fail if two instances are running concurrently.
|
if [ ! -d "$dstdir" ]; then
|
||||||
(umask $mkdir_umask &&
|
defaultIFS='
|
||||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
'
|
||||||
test -d "$dstdir" || exit 1
|
IFS="${IFS-${defaultIFS}}"
|
||||||
obsolete_mkdir_used=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
oIFS="${IFS}"
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
IFS='%'
|
||||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
IFS="${oIFS}"
|
||||||
else
|
|
||||||
|
|
||||||
# Make a couple of temp file names in the proper directory.
|
pathcomp=''
|
||||||
dsttmp=${dstdirslash}_inst.$$_
|
|
||||||
rmtmp=${dstdirslash}_rm.$$_
|
|
||||||
|
|
||||||
# Trap to clean up those temp files at exit.
|
while [ $# -ne 0 ] ; do
|
||||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
# Copy the file name to the temp name.
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
(umask $cp_umask &&
|
then
|
||||||
{ test -z "$stripcmd" || {
|
$mkdirprog "${pathcomp}"
|
||||||
# Create $dsttmp read-write so that cp doesn't create it read-only,
|
else
|
||||||
# which would cause strip to fail.
|
true
|
||||||
if test -z "$doit"; then
|
fi
|
||||||
: >"$dsttmp" # No need to fork-exec 'touch'.
|
|
||||||
else
|
|
||||||
$doit touch "$dsttmp"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
} &&
|
|
||||||
$doit_exec $cpprog "$src" "$dsttmp") &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits.
|
pathcomp="${pathcomp}/"
|
||||||
#
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
|
||||||
#
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
|
||||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
|
||||||
|
|
||||||
# If -C, don't bother to copy if it wouldn't change the file.
|
|
||||||
if $copy_on_change &&
|
|
||||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
|
||||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
|
||||||
set -f &&
|
|
||||||
set X $old && old=:$2:$4:$5:$6 &&
|
|
||||||
set X $new && new=:$2:$4:$5:$6 &&
|
|
||||||
set +f &&
|
|
||||||
test "$old" = "$new" &&
|
|
||||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
rm -f "$dsttmp"
|
|
||||||
else
|
|
||||||
# If $backupsuffix is set, and the file being installed
|
|
||||||
# already exists, attempt a backup. Don't worry if it fails,
|
|
||||||
# e.g., if mv doesn't support -f.
|
|
||||||
if test -n "$backupsuffix" && test -f "$dst"; then
|
|
||||||
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Rename the file to the real destination.
|
|
||||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
|
||||||
|
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
|
||||||
# support -f.
|
|
||||||
{
|
|
||||||
# Now remove or move aside any old file at destination location.
|
|
||||||
# We try this two ways since rm can't unlink itself on some
|
|
||||||
# systems and the destination file might be busy for other
|
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
|
||||||
# file should still install successfully.
|
|
||||||
{
|
|
||||||
test ! -f "$dst" ||
|
|
||||||
$doit $rmcmd "$dst" 2>/dev/null ||
|
|
||||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
|
||||||
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
|
|
||||||
} ||
|
|
||||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
|
||||||
(exit 1); exit 1
|
|
||||||
}
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
|
||||||
}
|
|
||||||
fi || exit 1
|
|
||||||
|
|
||||||
trap '' 0
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Local variables:
|
if [ x"$dir_arg" != x ]
|
||||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
then
|
||||||
# time-stamp-start: "scriptversion="
|
$doit $instcmd $dst &&
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-time-zone: "UTC0"
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
# time-stamp-end: "; # UTC"
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
# End:
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
13206
dist/ltmain.sh
vendored
13206
dist/ltmain.sh
vendored
File diff suppressed because it is too large
Load diff
0
dist/pubdef.in
vendored
0
dist/pubdef.in
vendored
4
dist/s_all
vendored
Executable file → Normal file
4
dist/s_all
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: s_all 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
sh s_perm # permissions.
|
sh s_perm # permissions.
|
||||||
sh s_symlink # symbolic links.
|
sh s_symlink # symbolic links.
|
||||||
|
|
8
dist/s_config
vendored
Executable file → Normal file
8
dist/s_config
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -x
|
#!/bin/sh -x
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# $Id: s_config 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
#
|
||||||
# Build the autoconfiguration files.
|
# Build the autoconfiguration files.
|
||||||
|
|
||||||
trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15
|
trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15
|
||||||
|
@ -24,11 +26,11 @@ trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15
|
||||||
. ./RELEASE
|
. ./RELEASE
|
||||||
|
|
||||||
echo "autoconf: building aclocal.m4..."
|
echo "autoconf: building aclocal.m4..."
|
||||||
cat aclocal/*.m4 > aclocal.m4
|
cat aclocal/*.ac > aclocal.m4
|
||||||
|
|
||||||
echo "autoconf: running autoheader to build config.hin..."
|
echo "autoconf: running autoheader to build config.hin..."
|
||||||
rm -f config.hin
|
rm -f config.hin
|
||||||
autoheader --warnings=all
|
autoheader
|
||||||
chmod 444 config.hin
|
chmod 444 config.hin
|
||||||
|
|
||||||
echo "autoconf: running autoconf to build configure"
|
echo "autoconf: running autoconf to build configure"
|
||||||
|
|
46
dist/s_include
vendored
Executable file → Normal file
46
dist/s_include
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# $Id: s_include 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
#
|
||||||
# Build the automatically generated function prototype files.
|
# Build the automatically generated function prototype files.
|
||||||
|
|
||||||
msgc="/* DO NOT EDIT: automatically built by dist/s_include. */"
|
msgc="/* DO NOT EDIT: automatically built by dist/s_include. */"
|
||||||
|
@ -77,8 +79,7 @@ e_dfile=/tmp/__db_c.$$
|
||||||
e_pfile=/tmp/__db_a.$$
|
e_pfile=/tmp/__db_a.$$
|
||||||
i_dfile=/tmp/__db_d.$$
|
i_dfile=/tmp/__db_d.$$
|
||||||
i_pfile=/tmp/__db_b.$$
|
i_pfile=/tmp/__db_b.$$
|
||||||
i_sfile=/tmp/__db_e.$$
|
trap 'rm -f $e_dfile $e_pfile $i_dfile $i_pfile; exit 0' 0 1 2 3 13 15
|
||||||
trap 'rm -f $e_dfile $e_pfile $i_dfile $i_pfile $i_sfile; exit 0' 0 1 2 3 13 15
|
|
||||||
|
|
||||||
head defonly space _DBSQL_EXT_DEF_IN_ > $e_dfile
|
head defonly space _DBSQL_EXT_DEF_IN_ > $e_dfile
|
||||||
head space _DBSQL_EXT_PROT_IN_ > $e_pfile
|
head space _DBSQL_EXT_PROT_IN_ > $e_pfile
|
||||||
|
@ -86,26 +87,21 @@ head defonly _DBSQL_INT_DEF_IN_ > $i_dfile
|
||||||
|
|
||||||
# Process the standard directories, creating per-directory prototype
|
# Process the standard directories, creating per-directory prototype
|
||||||
# files and adding to the external prototype and #define files.
|
# files and adding to the external prototype and #define files.
|
||||||
for pkg in dbsql os clib common ; do
|
for i in dbsql os clib common ; do
|
||||||
head "_${pkg}_ext_h_" > $i_pfile
|
head "_${i}_ext_h_" > $i_pfile
|
||||||
cfiles="../src/${pkg}/*.c"
|
|
||||||
[ "$cfiles" = "../src/dbsql/*.c" ] && cfiles="../src/*.c"
|
f="../src/$i/*.c"
|
||||||
for file in $(ls $cfiles); do
|
[ "$f" = "../src/dbsql/*.c" ] && f="../src/*.c"
|
||||||
fname="$(echo $file | sed -n 's/^\(.*\/\)*\([^.]*\)\(.*\)/\2/p')"
|
awk -f gen_inc.awk \
|
||||||
head "_${fname}_decl_h_" > $i_sfile
|
-v e_dfile=$e_dfile \
|
||||||
awk -f gen_inc.awk \
|
-v e_pfile=$e_pfile \
|
||||||
-v e_dfile=$e_dfile \
|
-v i_dfile=$i_dfile \
|
||||||
-v e_pfile=$e_pfile \
|
-v i_pfile=$i_pfile $f
|
||||||
-v i_dfile=$i_dfile \
|
|
||||||
-v i_pfile=$i_pfile \
|
tail "_${i}_ext_h_" >> $i_pfile
|
||||||
-v i_sfile=$i_sfile $file
|
|
||||||
tail "_${fname}_decl_h_" >> $i_sfile
|
f="../src/inc/${i}_ext.h"
|
||||||
decl="../src/inc/${fname}_decl.h"
|
cmp $i_pfile $f > /dev/null 2>&1 ||
|
||||||
# cmp $i_sfile $decl > /dev/null 2>&1 ||
|
(echo "Building $f" && rm -f $f && cp $i_pfile $f && chmod 444 $f)
|
||||||
# (echo "Building $decl" && rm -f $decl && cp $i_sfile $decl && chmod 444 $decl)
|
|
||||||
done
|
|
||||||
tail "_${pkg}_ext_h_" >> $i_pfile
|
|
||||||
ext="../src/inc/${pkg}_ext.h"
|
|
||||||
cmp $i_pfile $ext > /dev/null 2>&1 ||
|
|
||||||
(echo "Building $ext" && rm -f $ext && cp $i_pfile $ext && chmod 444 $ext)
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
4
dist/s_perm
vendored
Executable file → Normal file
4
dist/s_perm
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: s_perm 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
d=..
|
d=..
|
||||||
echo 'Updating DBSQL source tree permissions...'
|
echo 'Updating DBSQL source tree permissions...'
|
||||||
|
|
4
dist/s_readme
vendored
Executable file → Normal file
4
dist/s_readme
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# $Id: s_readme 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
#
|
||||||
# Build the README.
|
# Build the README.
|
||||||
|
|
||||||
echo 'Updating DBSQL README file...'
|
echo 'Updating DBSQL README file...'
|
||||||
|
|
4
dist/s_symlink
vendored
Executable file → Normal file
4
dist/s_symlink
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: s_symlink 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
echo 'Creating DBSQL source tree symbolic links...'
|
echo 'Creating DBSQL source tree symbolic links...'
|
||||||
|
|
||||||
|
|
4
dist/s_tags
vendored
Executable file → Normal file
4
dist/s_tags
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# $Id: s_tags 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
#
|
||||||
# Build tags files.
|
# Build tags files.
|
||||||
|
|
||||||
files=`echo ../src/*.[ch] \
|
files=`echo ../src/*.[ch] \
|
||||||
|
|
4
dist/s_test
vendored
Executable file → Normal file
4
dist/s_test
vendored
Executable file → Normal file
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -
|
#!/bin/sh -
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -17,6 +17,8 @@
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# $Id: s_test 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
#
|
||||||
# Build the Tcl test files.
|
# Build the Tcl test files.
|
||||||
|
|
||||||
msg1="# Automatically built by dist/s_test; may require local editing."
|
msg1="# Automatically built by dist/s_test; may require local editing."
|
||||||
|
|
41
dist/sqlconf
vendored
Executable file → Normal file
41
dist/sqlconf
vendored
Executable file → Normal file
|
@ -18,7 +18,7 @@ args=""
|
||||||
#args="--disable-shared $args"
|
#args="--disable-shared $args"
|
||||||
#args="--disable-static $args"
|
#args="--disable-static $args"
|
||||||
args="--enable-vacuum $args"
|
args="--enable-vacuum $args"
|
||||||
#args="--enable-datetime $args"
|
args="--enable-datetime $args"
|
||||||
args="--enable-authentication $args"
|
args="--enable-authentication $args"
|
||||||
args="--enable-incore-databases $args"
|
args="--enable-incore-databases $args"
|
||||||
args="--enable-incore-temp-databases $args"
|
args="--enable-incore-temp-databases $args"
|
||||||
|
@ -28,20 +28,11 @@ args="--enable-test $args"
|
||||||
args="--enable-tcl $args"
|
args="--enable-tcl $args"
|
||||||
#args="--enable-sqlite-compat $args"
|
#args="--enable-sqlite-compat $args"
|
||||||
args="--enable-soundex-sqlfn $args"
|
args="--enable-soundex-sqlfn $args"
|
||||||
#args="--with-tcl=/usr/lib/tcl-8.5.19/lib $args"
|
args="--enable-posix-mutexes $args"
|
||||||
#args="--with-berkeleydb=/usr/local/db-4.8.30 $args"
|
args="--with-tcl=/usr/lib/tcl8.4 $args"
|
||||||
|
args="--with-berkeleydb=/usr/local/db $args"
|
||||||
#args="--with-db-uniquename=FOO $args"
|
#args="--with-db-uniquename=FOO $args"
|
||||||
|
#args="LD_TWOLEVEL_NAMESPACE=1 LIBTSO_LIBS=-ltcl8.4 $args" # Mac OS/X
|
||||||
# Mac OS/X enable:
|
|
||||||
#args="LD_TWOLEVEL_NAMESPACE=1 LIBTSO_LIBS=-ltcl8.4 $args"
|
|
||||||
|
|
||||||
# On NixOS enable:
|
|
||||||
CFLAGS="${NIX_CFLAGS_COMPILE} -O0 -g -DDEBUG"
|
|
||||||
LDLAGS="${NIX_LDFLAGS} /home/gburd/src/libdb/build_unix/.libs"
|
|
||||||
#args="--with-berkeleydb=$(pkg-config --variable=prefix db) $args"
|
|
||||||
#args="--with-berkeleydb=/nix/store/mlhib3c2ra8bj36vhxmwqhyxph8a8sgf-db-4.8.30 $args"
|
|
||||||
args="--with-berkeleydb=/home/gburd/opt $args"
|
|
||||||
args="--with-tcl=$(pkg-config --variable=libdir tcl) $args"
|
|
||||||
|
|
||||||
echo "env $cppflags $ldflags $libs ../dist/configure $args"
|
echo "env $cppflags $ldflags $libs ../dist/configure $args"
|
||||||
env $cppflags $ldflags $libs sh ../dist/configure -C $args
|
env $cppflags $ldflags $libs sh ../dist/configure -C $args
|
||||||
|
@ -55,20 +46,16 @@ env $cppflags $ldflags $libs sh ../dist/configure -C $args
|
||||||
# echo 'print __db_dump(dbc->dbp, "a", "/tmp/o")' &&
|
# echo 'print __db_dump(dbc->dbp, "a", "/tmp/o")' &&
|
||||||
# echo "end") > .gdbinit
|
# echo "end") > .gdbinit
|
||||||
|
|
||||||
# (echo "set environment LD_LIBRARY_PATH=.:.libs" &&
|
(echo "set environment LD_LIBRARY_PATH=.:.libs" &&
|
||||||
# echo "dir ../src" &&
|
echo "dir ../src" &&
|
||||||
# echo "dir ../src/dbsql" &&
|
echo "dir ../src/dbsql" &&
|
||||||
# echo "dir ../src/dbsql/rl/src" &&
|
echo "dir /usr/local/db/src" &&
|
||||||
# echo "dir /usr/local/db/src/dist" &&
|
echo "path /usr/local/db/lib" &&
|
||||||
# echo "path /usr/local/db/lib" &&
|
echo "path .") > .gdbinit
|
||||||
# echo "path .") > .gdbinit
|
|
||||||
|
|
||||||
rm -f tags
|
rm -f tags
|
||||||
ln -s ../dist/tags tags
|
ln -s ../dist/tags tags
|
||||||
mkdir -p .libs && true
|
mkdir .libs && /bin/true
|
||||||
|
ln -s .gdbinit .libs/.gdbinit
|
||||||
|
ln -s ./.libs/dbsql dbsql-bin && /bin/true
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
nix-build -E 'with import <nixpkgs> {}; enableDebugging db4'
|
|
||||||
gdb -ix .gdbinit --tui build_unix/.libs/dbsql
|
|
||||||
r --init ../test/smoke.sql smoke
|
|
||||||
|
|
5
dist/srcfiles.in
vendored
5
dist/srcfiles.in
vendored
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or modify
|
# This library is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,6 +15,8 @@
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
# General Public License for more details.
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# $Id: srcfiles.in 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
|
||||||
|
|
||||||
# This is an input file for the s_win32_dsp. It lists the source files in
|
# This is an input file for the s_win32_dsp. It lists the source files in
|
||||||
|
@ -74,7 +76,6 @@ src/dbsql_tclsh.c app=dbsql_tclsh
|
||||||
src/lemon/lemon.c app=lemon
|
src/lemon/lemon.c app=lemon
|
||||||
src/lemon/lempar.c app=lemon
|
src/lemon/lempar.c app=lemon
|
||||||
src/os/os_jtime.c dynamic static
|
src/os/os_jtime.c dynamic static
|
||||||
src/os/os_sleep.c dynamic static
|
|
||||||
src/safety.c dynamic static
|
src/safety.c dynamic static
|
||||||
src/sm.c dynamic static
|
src/sm.c dynamic static
|
||||||
src/sql_fns.c dynamic static
|
src/sql_fns.c dynamic static
|
||||||
|
|
206
flake.lock
206
flake.lock
|
@ -1,206 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1673956053,
|
|
||||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1694529238,
|
|
||||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1685518550,
|
|
||||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"gitignore": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"pre-commit-hooks",
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1660459072,
|
|
||||||
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "gitignore.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-github-actions": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1693660503,
|
|
||||||
"narHash": "sha256-B/g2V4v6gjirFmy+I5mwB2bCYc0l3j5scVfwgl6WOl8=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nix-github-actions",
|
|
||||||
"rev": "bd5bdbb52350e145c526108f4ef192eb8e554fa0",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "nix-github-actions",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1697722682,
|
|
||||||
"narHash": "sha256-PRhNRNxBEsf4hdpuGIGcRckyYGm5iGuI9P0UGzOmzEo=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "8e8f3e83b66a6a9a9e953e4a14b1a227b22a18d4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-stable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1685801374,
|
|
||||||
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "c37ca420157f4abc31e26f436c1145f8951ff373",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixos-23.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689261696,
|
|
||||||
"narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "df1eee2aa65052a18121ed4971081576b25d6b5c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"pre-commit-hooks": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"gitignore": "gitignore",
|
|
||||||
"nixpkgs": "nixpkgs_2",
|
|
||||||
"nixpkgs-stable": "nixpkgs-stable"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1696846637,
|
|
||||||
"narHash": "sha256-0hv4kbXxci2+pxhuXlVgftj/Jq79VSmtAyvfabCCtYk=",
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "pre-commit-hooks.nix",
|
|
||||||
"rev": "42e1b6095ef80a51f79595d9951eb38e91c4e6ca",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "cachix",
|
|
||||||
"repo": "pre-commit-hooks.nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nix-github-actions": "nix-github-actions",
|
|
||||||
"nixpkgs": "nixpkgs",
|
|
||||||
"pre-commit-hooks": "pre-commit-hooks"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
104
flake.nix
104
flake.nix
|
@ -1,104 +0,0 @@
|
||||||
{
|
|
||||||
description = "The DBSQL library, a mixup of SQLite and Berkeley DB";
|
|
||||||
|
|
||||||
nixConfig = {
|
|
||||||
bash-prompt = "\\[\\e[34;1m\\]nix ~ \\[\\e[0m\\]";
|
|
||||||
};
|
|
||||||
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs";
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
};
|
|
||||||
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
|
||||||
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
|
|
||||||
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, pre-commit-hooks, nix-github-actions }:
|
|
||||||
let
|
|
||||||
inherit (nixpkgs) lib;
|
|
||||||
officialRelease = false;
|
|
||||||
|
|
||||||
#version = "DBSQL ${DBSQL_VERSION}: (${versionSuffix})";
|
|
||||||
version = "DBSQL 0.3.1: (${versionSuffix})";
|
|
||||||
versionSuffix =
|
|
||||||
if officialRelease
|
|
||||||
then ""
|
|
||||||
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}";
|
|
||||||
|
|
||||||
supportedSystems = [ "x86_64-linux" ];
|
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
overlays = [ self.overlay ];
|
|
||||||
});
|
|
||||||
|
|
||||||
in
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
|
|
||||||
overlays = [
|
|
||||||
|
|
||||||
(final: prev: {
|
|
||||||
dbsql = with final; stdenv.mkDerivation rec {
|
|
||||||
inherit version;
|
|
||||||
inherit system;
|
|
||||||
pname = "dbsql";
|
|
||||||
src = self;
|
|
||||||
configureFlags = [
|
|
||||||
"--host ${system}"
|
|
||||||
];
|
|
||||||
buildInputs = [
|
|
||||||
(enableDebuging db4)
|
|
||||||
glibc.out
|
|
||||||
glibc.static
|
|
||||||
tcl-8_5
|
|
||||||
];
|
|
||||||
nativeBuildInputs = [ autoreconfHook ];
|
|
||||||
meta = {
|
|
||||||
changelog = "https://git.burd.me/greg/dbsql/raw/branch/main/ChangeLog";
|
|
||||||
downloadPage = "https://git.burd.me/greg/dbsql/releases";
|
|
||||||
homepage = "https://github.com/gburd/dbsql";
|
|
||||||
license = "https://github.com/gburd/dbsql/LICENSE";
|
|
||||||
mainProgram = "dbsql";
|
|
||||||
maintainers = [ "Greg Burd <greg@burd.me>" ];
|
|
||||||
platforms = supportedSystems;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
checks = {
|
|
||||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
||||||
src = ./.;
|
|
||||||
hooks = {
|
|
||||||
nixpkgs-fmt.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
devShell = nixpkgs.legacyPackages.${system}.mkShell {
|
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
in rec {
|
|
||||||
packages = {
|
|
||||||
inherit (pkgs) dbsql;
|
|
||||||
|
|
||||||
githubActions = nix-github-actions.lib.mkGithubMatrix {
|
|
||||||
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" "x86_64-darwin" ] self.packages;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
packages.default = self.packages.${system}.dbsql;
|
|
||||||
packages.container = pkgs.callPackage ./container.nix { package = packages.default; };
|
|
||||||
|
|
||||||
apps.dbsql = flake-utils.lib.mkApp { drv = packages.default; };
|
|
||||||
apps.${system}.default = apps.dbsql;
|
|
||||||
|
|
||||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
28
shell.nix
28
shell.nix
|
@ -1,28 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
|
||||||
pkgs.mkShell {
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs.buildPackages; [
|
|
||||||
act
|
|
||||||
autoconf
|
|
||||||
ed
|
|
||||||
gcc
|
|
||||||
gdb
|
|
||||||
gettext
|
|
||||||
libtool
|
|
||||||
m4
|
|
||||||
pkg-config
|
|
||||||
perl
|
|
||||||
ripgrep
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
|
||||||
# (enableDebuging db4)
|
|
||||||
db4
|
|
||||||
glibc.out
|
|
||||||
glibc.static
|
|
||||||
tcl-8_5
|
|
||||||
];
|
|
||||||
|
|
||||||
DOCKER_BUILDKIT = 1;
|
|
||||||
}
|
|
253
src/api.c
253
src/api.c
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: api.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -48,7 +50,9 @@ typedef struct {
|
||||||
*
|
*
|
||||||
* STATIC: static void __corrupt_schema __P((init_data_t *));
|
* STATIC: static void __corrupt_schema __P((init_data_t *));
|
||||||
*/
|
*/
|
||||||
static void __corrupt_schema(init_data_t *data)
|
static void
|
||||||
|
__corrupt_schema(data)
|
||||||
|
init_data_t *data;
|
||||||
{
|
{
|
||||||
__str_append(data->err_msgs, "malformed database schema",
|
__str_append(data->err_msgs, "malformed database schema",
|
||||||
(char*)0);
|
(char*)0);
|
||||||
|
@ -68,10 +72,14 @@ static void __corrupt_schema(init_data_t *data)
|
||||||
* argv[4] = "1" for temporary files, "0" for main database,
|
* argv[4] = "1" for temporary files, "0" for main database,
|
||||||
* "2" or more for auxiliary database files.
|
* "2" or more for auxiliary database files.
|
||||||
*
|
*
|
||||||
* STATIC: static int __init_callback __P((void *, int, char **, char **));
|
* STATIC: static int __init_callback __P((init_data_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__init_callback(void* init, int argc, char **argv, char **col_name)
|
__init_callback(init, argc, argv, col_name)
|
||||||
|
void *init;
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
char **col_name;
|
||||||
{
|
{
|
||||||
init_data_t *data = (init_data_t*)init;
|
init_data_t *data = (init_data_t*)init;
|
||||||
parser_t parser;
|
parser_t parser;
|
||||||
|
@ -92,7 +100,7 @@ __init_callback(void* init, int argc, char **argv, char **col_name)
|
||||||
case 'v': /* FALLTHROUGH */
|
case 'v': /* FALLTHROUGH */
|
||||||
case 'i': /* FALLTHROUGH */
|
case 'i': /* FALLTHROUGH */
|
||||||
case 't':
|
case 't':
|
||||||
/* CREATE TABLE, CREATE INDEX, or CREATE VIEW statements */
|
/* CREATE TABLE, CREATE INDEX, or CREATE VIEW statements */
|
||||||
if (argv[2] == 0 || argv[4] == 0) {
|
if (argv[2] == 0 || argv[4] == 0) {
|
||||||
__corrupt_schema(data);
|
__corrupt_schema(data);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -146,7 +154,7 @@ __init_callback(void* init, int argc, char **argv, char **col_name)
|
||||||
default:
|
default:
|
||||||
/* This can not happen! */
|
/* This can not happen! */
|
||||||
nerr = 1;
|
nerr = 1;
|
||||||
DBSQL_ASSERT(nerr == 0); /* TODO: create a __fatal() */
|
DBSQL_ASSERT(nerr == 0); /* TODO create a __fatal() */
|
||||||
}
|
}
|
||||||
return nerr;
|
return nerr;
|
||||||
}
|
}
|
||||||
|
@ -163,8 +171,13 @@ __init_callback(void* init, int argc, char **argv, char **col_name)
|
||||||
* STATIC: static int __init_db_file __P((DBSQL *, int, char **));
|
* STATIC: static int __init_db_file __P((DBSQL *, int, char **));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__init_db_file(DBSQL* dbp, int dbi, char **err_msgs)
|
__init_db_file(dbp, dbi, err_msgs)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int dbi;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
int size;
|
||||||
table_t *table;
|
table_t *table;
|
||||||
char *args[6];
|
char *args[6];
|
||||||
char db_num[30];
|
char db_num[30];
|
||||||
|
@ -298,7 +311,9 @@ __init_db_file(DBSQL* dbp, int dbi, char **err_msgs)
|
||||||
* PUBLIC: int __init_databases __P((DBSQL *, char**));
|
* PUBLIC: int __init_databases __P((DBSQL *, char**));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__init_databases(DBSQL* dbp, char **err_msgs)
|
__init_databases(dbp, err_msgs)
|
||||||
|
DBSQL *dbp;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int rc = DBSQL_SUCCESS;
|
int rc = DBSQL_SUCCESS;
|
||||||
|
@ -371,7 +386,7 @@ __sqldb_init(p, dbp, name, temp, mem, init_sm)
|
||||||
* is locked) then that step is deferred until the first call to
|
* is locked) then that step is deferred until the first call to
|
||||||
* DBSQL->exec().
|
* DBSQL->exec().
|
||||||
*
|
*
|
||||||
* STATIC: static int __api_open __P((DBSQL *, const char *, int, char **));
|
* STATIC: int __api_open __P((DBSQL *, const char *, int, char **));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_open(dbp, filename, mode, err_msgs)
|
__api_open(dbp, filename, mode, err_msgs)
|
||||||
|
@ -454,7 +469,8 @@ __api_open(dbp, filename, mode, err_msgs)
|
||||||
* STATIC: static int __api_last_inserted_rowid __P((DBSQL *));
|
* STATIC: static int __api_last_inserted_rowid __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_last_inserted_rowid(DBSQL* dbp)
|
__api_last_inserted_rowid(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return dbp->lastRowid;
|
return dbp->lastRowid;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +482,8 @@ __api_last_inserted_rowid(DBSQL* dbp)
|
||||||
* STATIC: static int __api_last_change_count __P((DBSQL *));
|
* STATIC: static int __api_last_change_count __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_last_change_count(DBSQL* dbp)
|
__api_last_change_count(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return dbp->_num_last_changes;
|
return dbp->_num_last_changes;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +496,8 @@ __api_last_change_count(DBSQL* dbp)
|
||||||
* STATIC: static int __api_total_change_count __P((DBSQL *));
|
* STATIC: static int __api_total_change_count __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_total_change_count(DBSQL* dbp)
|
__api_total_change_count(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return dbp->_num_total_changes;
|
return dbp->_num_total_changes;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +509,8 @@ __api_total_change_count(DBSQL* dbp)
|
||||||
* STATIC: static int __api_close __P((DBSQL *));
|
* STATIC: static int __api_close __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_close(DBSQL* dbp)
|
__api_close(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
hash_ele_t *i;
|
hash_ele_t *i;
|
||||||
int j;
|
int j;
|
||||||
|
@ -538,9 +557,9 @@ __api_close(DBSQL* dbp)
|
||||||
*
|
*
|
||||||
* STATIC: static int __process_sql __P((DBSQL *, const char *,
|
* STATIC: static int __process_sql __P((DBSQL *, const char *,
|
||||||
* STATIC: dbsql_callback, void *, const char **,
|
* STATIC: dbsql_callback, void *, const char **,
|
||||||
* STATIC: dbsql_stmt_t **, char **));
|
* STATIC: dbsql_stmt_t, char **))
|
||||||
*
|
*
|
||||||
* dbp The database
|
* dbp The database on which the SQL executes
|
||||||
* sql The SQL to be executed
|
* sql The SQL to be executed
|
||||||
* callback Invoke this callback routine
|
* callback Invoke this callback routine
|
||||||
* arg First argument to callback()
|
* arg First argument to callback()
|
||||||
|
@ -549,7 +568,14 @@ __api_close(DBSQL* dbp)
|
||||||
* err_msgs OUT: Write error messages here
|
* err_msgs OUT: Write error messages here
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__process_sql(DBSQL *dbp, const char *sql, dbsql_callback callback, void *arg, const char **tail, dbsql_stmt_t **vm, char **err_msgs)
|
__process_sql(dbp, sql, callback, arg, tail, vm, err_msgs)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *sql;
|
||||||
|
dbsql_callback callback;
|
||||||
|
void *arg;
|
||||||
|
const char **tail;
|
||||||
|
dbsql_stmt_t **vm;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
parser_t parser;
|
parser_t parser;
|
||||||
|
|
||||||
|
@ -574,7 +600,7 @@ __process_sql(DBSQL *dbp, const char *sql, dbsql_callback callback, void *arg, c
|
||||||
*err_msgs = 0;
|
*err_msgs = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO: in the __meta subdatabase get:'format_version'
|
/* TODO: in the __meta subdatabase get:'format_version'
|
||||||
if (dbp->file_format < 3) {
|
if (dbp->file_format < 3) {
|
||||||
__safety_off(dbp);
|
__safety_off(dbp);
|
||||||
__str_append(err_msgs, "obsolete database file format",
|
__str_append(err_msgs, "obsolete database file format",
|
||||||
|
@ -651,7 +677,12 @@ __process_sql(DBSQL *dbp, const char *sql, dbsql_callback callback, void *arg, c
|
||||||
* arg First argument to callback()
|
* arg First argument to callback()
|
||||||
* err_msgs Write error messages here
|
* err_msgs Write error messages here
|
||||||
*/
|
*/
|
||||||
int __api_exec(DBSQL *dbp, const char *sql, dbsql_callback callback, void *arg, char **err_msgs)
|
int __api_exec(dbp, sql, callback, arg, err_msgs)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *sql;
|
||||||
|
dbsql_callback callback;
|
||||||
|
void *arg;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
return __process_sql(dbp, sql, callback, arg, 0, 0, err_msgs);
|
return __process_sql(dbp, sql, callback, arg, 0, 0, err_msgs);
|
||||||
}
|
}
|
||||||
|
@ -671,7 +702,12 @@ int __api_exec(DBSQL *dbp, const char *sql, dbsql_callback callback, void *arg,
|
||||||
* err_msgs OUT: Write error messages here
|
* err_msgs OUT: Write error messages here
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_prepare(DBSQL *dbp, const char *sql, const char **tail, dbsql_stmt_t **stmt, char **err_msgs)
|
__api_prepare(dbp, sql, tail, stmt, err_msgs)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *sql;
|
||||||
|
const char **tail;
|
||||||
|
dbsql_stmt_t **stmt;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
return __process_sql(dbp, sql, 0, 0, tail, stmt, err_msgs);
|
return __process_sql(dbp, sql, 0, 0, tail, stmt, err_msgs);
|
||||||
}
|
}
|
||||||
|
@ -697,7 +733,9 @@ __api_prepare(DBSQL *dbp, const char *sql, const char **tail, dbsql_stmt_t **stm
|
||||||
* with it.
|
* with it.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_finalize(dbsql_stmt_t* stmt, char **err_msgs)
|
__api_finalize(stmt, err_msgs)
|
||||||
|
dbsql_stmt_t *stmt;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
int rc = __vdbe_finalize((vdbe_t*)stmt, err_msgs);
|
int rc = __vdbe_finalize((vdbe_t*)stmt, err_msgs);
|
||||||
__str_urealloc(err_msgs);
|
__str_urealloc(err_msgs);
|
||||||
|
@ -720,7 +758,9 @@ __api_finalize(dbsql_stmt_t* stmt, char **err_msgs)
|
||||||
* is returned.
|
* is returned.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_reset(dbsql_stmt_t* stmt, char **err_msgs)
|
__api_reset(stmt, err_msgs)
|
||||||
|
dbsql_stmt_t *stmt;
|
||||||
|
char **err_msgs;
|
||||||
{
|
{
|
||||||
int rc = __vdbe_reset((vdbe_t*)stmt, err_msgs);
|
int rc = __vdbe_reset((vdbe_t*)stmt, err_msgs);
|
||||||
__vdbe_make_ready((vdbe_t*)stmt, -1, 0, 0, 0);
|
__vdbe_make_ready((vdbe_t*)stmt, -1, 0, 0, 0);
|
||||||
|
@ -743,7 +783,11 @@ __api_reset(dbsql_stmt_t* stmt, char **err_msgs)
|
||||||
* count Number of times table has been busy
|
* count Number of times table has been busy
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__default_busy_callback(DBSQL *dbp, void *arg, const char *not_used, int count)
|
__default_busy_callback(dbp, arg, not_used, count)
|
||||||
|
DBSQL *dbp;
|
||||||
|
void *arg;
|
||||||
|
const char *not_used;
|
||||||
|
int count;
|
||||||
{
|
{
|
||||||
#if defined(__LP64) || defined(__LP64__)
|
#if defined(__LP64) || defined(__LP64__)
|
||||||
u_int64_t timeout = (u_int64_t)arg;
|
u_int64_t timeout = (u_int64_t)arg;
|
||||||
|
@ -770,13 +814,13 @@ __default_busy_callback(DBSQL *dbp, void *arg, const char *not_used, int count)
|
||||||
if (delay <= 0)
|
if (delay <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
__os_sleep(0, delay);
|
__os_sleep(dbp, 0, delay);
|
||||||
return 1;
|
return 1;
|
||||||
#else
|
#else
|
||||||
if ((count + 1) * 1000 > timeout) {
|
if ((count + 1) * 1000 > timeout) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
__os_sleep(1, 0);
|
__os_sleep(dbp, 1, 0);
|
||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -790,7 +834,10 @@ __default_busy_callback(DBSQL *dbp, void *arg, const char *not_used, int count)
|
||||||
* STATIC: int (*)(DBSQL *, void*, const char*, int), void *));
|
* STATIC: int (*)(DBSQL *, void*, const char*, int), void *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_busy_callback(DBSQL *dbp, int (*busy)(DBSQL *, void *, const char*, int), void *arg)
|
__api_set_busy_callback(dbp, busy, arg)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int (*busy)(DBSQL *, void *, const char*, int);
|
||||||
|
void *arg;
|
||||||
{
|
{
|
||||||
dbp->xBusyCallback = busy;
|
dbp->xBusyCallback = busy;
|
||||||
dbp->pBusyArg = arg;
|
dbp->pBusyArg = arg;
|
||||||
|
@ -807,7 +854,11 @@ __api_set_busy_callback(DBSQL *dbp, int (*busy)(DBSQL *, void *, const char*, in
|
||||||
* STATIC: int (*)(void*), void *));
|
* STATIC: int (*)(void*), void *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_progress_callback(DBSQL* dbp, int num_ops, int (*progress)(void*), void* arg)
|
__api_set_progress_callback(dbp, num_ops, progress, arg)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int num_ops;
|
||||||
|
int (*progress)(void*);
|
||||||
|
void *arg;
|
||||||
{
|
{
|
||||||
if (num_ops > 0) {
|
if (num_ops > 0) {
|
||||||
dbp->xProgress = progress;
|
dbp->xProgress = progress;
|
||||||
|
@ -830,7 +881,9 @@ __api_set_progress_callback(DBSQL* dbp, int num_ops, int (*progress)(void*), voi
|
||||||
* STATIC: static void __api_set_busy_timeout __P((DBSQL *, int));
|
* STATIC: static void __api_set_busy_timeout __P((DBSQL *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_busy_timeout(DBSQL* dbp, int ms)
|
__api_set_busy_timeout(dbp, ms)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int ms;
|
||||||
{
|
{
|
||||||
#if defined(__LP64) || defined(__LP64__)
|
#if defined(__LP64) || defined(__LP64__)
|
||||||
u_int64_t delay = ms;
|
u_int64_t delay = ms;
|
||||||
|
@ -851,7 +904,8 @@ __api_set_busy_timeout(DBSQL* dbp, int ms)
|
||||||
* PUBLIC: void __api_interrupt __P((DBSQL *));
|
* PUBLIC: void __api_interrupt __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_interrupt(DBSQL* dbp)
|
__api_interrupt(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
dbp->flags |= DBSQL_Interrupt;
|
dbp->flags |= DBSQL_Interrupt;
|
||||||
}
|
}
|
||||||
|
@ -863,7 +917,10 @@ __api_interrupt(DBSQL* dbp)
|
||||||
* EXTERN: const char *dbsql_version __P((int *, int *, int *));
|
* EXTERN: const char *dbsql_version __P((int *, int *, int *));
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
dbsql_version(int* major, int* minor, int* patch)
|
dbsql_version(major, minor, patch)
|
||||||
|
int *major;
|
||||||
|
int *minor;
|
||||||
|
int *patch;
|
||||||
{
|
{
|
||||||
*major = DBSQL_VERSION_MAJOR;
|
*major = DBSQL_VERSION_MAJOR;
|
||||||
*minor = DBSQL_VERSION_MINOR;
|
*minor = DBSQL_VERSION_MINOR;
|
||||||
|
@ -907,13 +964,22 @@ __api_get_encoding()
|
||||||
* name Name of the function to add
|
* name Name of the function to add
|
||||||
* num_arg Number of arguments
|
* num_arg Number of arguments
|
||||||
* encoding The encoding expected by the functions
|
* encoding The encoding expected by the functions
|
||||||
* user_data User data
|
* user_data User data
|
||||||
* func The function's implementation
|
* func The function's implementation
|
||||||
* step Step is used by aggregate functions
|
* step Step is used by aggregate functions
|
||||||
* finalize When finished with an aggregate function
|
* finalize When finished with
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_create_function(DBSQL *dbp, const char *name, int encoding, int num_arg, void *user_data, /*TODO: not yet used*/ void (*func)(dbsql_func_t*, int, const char**), void (*step)(dbsql_func_t*, int, const char**), void (*finalize)(dbsql_func_t*))
|
__api_create_function(dbp, name, num_arg, user_data, encoding, func,
|
||||||
|
step, finalize)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *name;
|
||||||
|
int num_arg;
|
||||||
|
void *user_data;
|
||||||
|
int encoding;/*TODO: not yet used*/
|
||||||
|
void (*func)(dbsql_func_t*, int, const char**);
|
||||||
|
void (*step)(dbsql_func_t*, int, const char**);
|
||||||
|
void (*finalize)(dbsql_func_t*);
|
||||||
{
|
{
|
||||||
func_def_t *p;
|
func_def_t *p;
|
||||||
int name_len;
|
int name_len;
|
||||||
|
@ -947,7 +1013,7 @@ __api_create_function(DBSQL *dbp, const char *name, int encoding, int num_arg, v
|
||||||
* __api_exec_printf --
|
* __api_exec_printf --
|
||||||
*
|
*
|
||||||
* STATIC: static int __api_exec_printf __P((DBSQL *, const char *,
|
* STATIC: static int __api_exec_printf __P((DBSQL *, const char *,
|
||||||
* STATIC: dbsql_callback, void *, char **, ...))
|
* STATIC: dbsql_callback, void *, char **, ...));
|
||||||
* STATIC: __attribute__ ((__format__ (__printf__, 2, 5)));
|
* STATIC: __attribute__ ((__format__ (__printf__, 2, 5)));
|
||||||
*
|
*
|
||||||
* dbp The DBSQL database
|
* dbp The DBSQL database
|
||||||
|
@ -962,8 +1028,13 @@ static int
|
||||||
__api_exec_printf(DBSQL *dbp, const char *fmt, dbsql_callback callback,
|
__api_exec_printf(DBSQL *dbp, const char *fmt, dbsql_callback callback,
|
||||||
void *arg, char **err_msgs, ...)
|
void *arg, char **err_msgs, ...)
|
||||||
#else
|
#else
|
||||||
__api_exec_printf(DBSQL *dbp, const char *fmt, dbsql_callback callback,
|
__api_exec_printf(dbp, fmt, callback, arg, err_msgs, ...)
|
||||||
void *arg, char **err_msgs, va_dcl)
|
DBSQL *dbp;
|
||||||
|
const char *fmt;
|
||||||
|
dbsql_callback callback;
|
||||||
|
void *arg;
|
||||||
|
char **err_msgs;
|
||||||
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -989,7 +1060,13 @@ __api_exec_printf(DBSQL *dbp, const char *fmt, dbsql_callback callback,
|
||||||
* va_list Args list
|
* va_list Args list
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__api_exec_vprintf(DBSQL *dbp, const char *fmt, dbsql_callback callback, void *arg, char **err_msgs, va_list ap)
|
__api_exec_vprintf(dbp, fmt, callback, arg, err_msgs, ap)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *fmt;
|
||||||
|
dbsql_callback callback;
|
||||||
|
void *arg;
|
||||||
|
char **err_msgs;
|
||||||
|
va_list ap;
|
||||||
{
|
{
|
||||||
char *sql;
|
char *sql;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1004,7 +1081,7 @@ __api_exec_vprintf(DBSQL *dbp, const char *fmt, dbsql_callback callback, void *a
|
||||||
* __api_exec_table_printf --
|
* __api_exec_table_printf --
|
||||||
*
|
*
|
||||||
* STATIC: static int __api_exec_table_printf __P((DBSQL *, const char *,
|
* STATIC: static int __api_exec_table_printf __P((DBSQL *, const char *,
|
||||||
* STATIC: char ***, int *, int *, char **, ...))
|
* STATIC: char ***, int *, int *, char **, ...));
|
||||||
* STATIC: __attribute__ ((__format__ (__printf__, 2, 7)));
|
* STATIC: __attribute__ ((__format__ (__printf__, 2, 7)));
|
||||||
*
|
*
|
||||||
* dbp The DBSQL database
|
* dbp The DBSQL database
|
||||||
|
@ -1020,7 +1097,14 @@ static int
|
||||||
__api_exec_table_printf(DBSQL *dbp, const char *fmt, char ***results,
|
__api_exec_table_printf(DBSQL *dbp, const char *fmt, char ***results,
|
||||||
int *num_rows, int *num_cols, char **err_msgs, ...)
|
int *num_rows, int *num_cols, char **err_msgs, ...)
|
||||||
#else
|
#else
|
||||||
__api_exec_printf(DBSQL *dbp, const char *fmt, char ***results, int *num_rows, int *num_cols, char **err_msgs, va_dcl)
|
__api_exec_printf(dbp, fmt, results, num_rows, num_cols, err_msgs, ...)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *fmt;
|
||||||
|
char ***results;
|
||||||
|
int *num_rows;
|
||||||
|
int *num_cols;
|
||||||
|
char **err_msgs;
|
||||||
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -1048,7 +1132,14 @@ __api_exec_printf(DBSQL *dbp, const char *fmt, char ***results, int *num_rows, i
|
||||||
* ap Arguments to the format string
|
* ap Arguments to the format string
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__api_exec_table_vprintf(DBSQL *dbp, const char *fmt, char ***results, int *num_rows, int *num_cols, char **err_msgs, va_list ap)
|
__api_exec_table_vprintf(dbp, fmt, results, num_rows, num_cols, err_msgs, ap)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *fmt;
|
||||||
|
char ***results;
|
||||||
|
int *num_rows;
|
||||||
|
int *num_cols;
|
||||||
|
char **err_msgs;
|
||||||
|
va_list ap;
|
||||||
{
|
{
|
||||||
char *sql;
|
char *sql;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1068,7 +1159,10 @@ __api_exec_table_vprintf(DBSQL *dbp, const char *fmt, char ***results, int *num_
|
||||||
* STATIC: static int __api_func_return_type __P((DBSQL *, const char *, int));
|
* STATIC: static int __api_func_return_type __P((DBSQL *, const char *, int));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__api_func_return_type(DBSQL *dbp, const char *name, int data_type)
|
__api_func_return_type(dbp, name, data_type)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *name;
|
||||||
|
int data_type;
|
||||||
{
|
{
|
||||||
func_def_t *p = (func_def_t*)__hash_find((hash_t*)dbp->fns, name,
|
func_def_t *p = (func_def_t*)__hash_find((hash_t*)dbp->fns, name,
|
||||||
strlen(name));
|
strlen(name));
|
||||||
|
@ -1091,7 +1185,10 @@ __api_func_return_type(DBSQL *dbp, const char *name, int data_type)
|
||||||
* STATIC: void (*trace)(void*, const char *), void *));
|
* STATIC: void (*trace)(void*, const char *), void *));
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
__api_set_trace_callback(DBSQL *dbp, void (*trace)(void*,const char*), void *arg)
|
__api_set_trace_callback(dbp, trace, arg)
|
||||||
|
DBSQL *dbp;
|
||||||
|
void (*trace)(void*,const char*);
|
||||||
|
void *arg;
|
||||||
{
|
{
|
||||||
void *old = dbp->pTraceArg;
|
void *old = dbp->pTraceArg;
|
||||||
dbp->xTrace = trace;
|
dbp->xTrace = trace;
|
||||||
|
@ -1113,7 +1210,10 @@ __api_set_trace_callback(DBSQL *dbp, void (*trace)(void*,const char*), void *arg
|
||||||
* arg Argument to the function
|
* arg Argument to the function
|
||||||
*/
|
*/
|
||||||
void *
|
void *
|
||||||
__api_set_commit_callback(DBSQL* dbp, int (*callback)(void*), void* arg)
|
__api_set_commit_callback(dbp, callback, arg)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int (*callback)(void*);
|
||||||
|
void *arg;
|
||||||
{
|
{
|
||||||
void *old = dbp->pCommitArg;
|
void *old = dbp->pCommitArg;
|
||||||
dbp->xCommitCallback = callback;
|
dbp->xCommitCallback = callback;
|
||||||
|
@ -1127,7 +1227,8 @@ __api_set_commit_callback(DBSQL* dbp, int (*callback)(void*), void* arg)
|
||||||
* STATIC: static DB_ENV *__api_get_dbenv __P((DBSQL *));
|
* STATIC: static DB_ENV *__api_get_dbenv __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
static DB_ENV *
|
static DB_ENV *
|
||||||
__api_get_dbenv(DBSQL* dbp)
|
__api_get_dbenv(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return dbp->dbenv;
|
return dbp->dbenv;
|
||||||
}
|
}
|
||||||
|
@ -1143,7 +1244,9 @@ __api_get_dbenv(DBSQL* dbp)
|
||||||
* callback Function to invoke on each commit
|
* callback Function to invoke on each commit
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_errcall(DBSQL *dbp, void (*callback)(const char *, char *))
|
__api_set_errcall(dbp, callback)
|
||||||
|
DBSQL *dbp;
|
||||||
|
void (*callback)(const char *, char *);
|
||||||
{
|
{
|
||||||
dbp->dbsql_errcall = callback;
|
dbp->dbsql_errcall = callback;
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1261,9 @@ __api_set_errcall(DBSQL *dbp, void (*callback)(const char *, char *))
|
||||||
* file Open file stream for suitable for writing
|
* file Open file stream for suitable for writing
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_errfile(DBSQL* dbp, FILE* file)
|
__api_set_errfile(dbp, file)
|
||||||
|
DBSQL *dbp;
|
||||||
|
FILE *file;
|
||||||
{
|
{
|
||||||
dbp->dbsql_errfile = file;
|
dbp->dbsql_errfile = file;
|
||||||
}
|
}
|
||||||
|
@ -1173,14 +1278,16 @@ __api_set_errfile(DBSQL* dbp, FILE* file)
|
||||||
* file OUT: The file used for error messages
|
* file OUT: The file used for error messages
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_get_errfile(DBSQL* dbp, FILE **file)
|
__api_get_errfile(dbp, file)
|
||||||
|
DBSQL *dbp;
|
||||||
|
FILE **file;
|
||||||
{
|
{
|
||||||
*file = dbp->dbsql_errfile;
|
*file = dbp->dbsql_errfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __api_set_errpfx --
|
* __api_set_errpfx --
|
||||||
* Set a prefix for use when writing error messages.
|
* Set a prefix for use when writting error messages.
|
||||||
*
|
*
|
||||||
* STATIC: static void __api_set_errpfx __P((DBSQL *, const char *));
|
* STATIC: static void __api_set_errpfx __P((DBSQL *, const char *));
|
||||||
*
|
*
|
||||||
|
@ -1188,7 +1295,9 @@ __api_get_errfile(DBSQL* dbp, FILE **file)
|
||||||
* prefix A prefix string
|
* prefix A prefix string
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_set_errpfx(DBSQL *dbp, const char *prefix)
|
__api_set_errpfx(dbp, prefix)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char *prefix;
|
||||||
{
|
{
|
||||||
__dbsql_strdup(dbp, prefix, &dbp->dbsql_errpfx);
|
__dbsql_strdup(dbp, prefix, &dbp->dbsql_errpfx);
|
||||||
}
|
}
|
||||||
|
@ -1197,13 +1306,15 @@ __api_set_errpfx(DBSQL *dbp, const char *prefix)
|
||||||
* __api_get_errpfx --
|
* __api_get_errpfx --
|
||||||
* Get the error prefix.
|
* Get the error prefix.
|
||||||
*
|
*
|
||||||
* STATIC: static void __api_get_errpfx __P((DBSQL *, const char **));
|
* STATIC: static void __api_get_errpfx __P((DBSQL *, char **));
|
||||||
*
|
*
|
||||||
* dbp Attach the hook to this database
|
* dbp Attach the hook to this database
|
||||||
* prefix OUT: The prefix string
|
* prefix OUT: The prefix string
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_get_errpfx(DBSQL *dbp, const char **prefix)
|
__api_get_errpfx(dbp, prefix)
|
||||||
|
DBSQL *dbp;
|
||||||
|
const char **prefix;
|
||||||
{
|
{
|
||||||
*prefix = dbp->dbsql_errpfx;
|
*prefix = dbp->dbsql_errpfx;
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1327,12 @@ __api_get_errpfx(DBSQL *dbp, const char **prefix)
|
||||||
* EXTERN: const char *, int, u_int32_t flags));
|
* EXTERN: const char *, int, u_int32_t flags));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_int32_t flags)
|
dbsql_create_env(dbpp, dir, crypt, mode, flags)
|
||||||
|
DBSQL **dbpp;
|
||||||
|
const char *dir;
|
||||||
|
const char *crypt;
|
||||||
|
int mode;
|
||||||
|
u_int32_t flags;
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
DB_ENV *dbenv;
|
DB_ENV *dbenv;
|
||||||
|
@ -1225,9 +1341,9 @@ dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_i
|
||||||
int env_open_flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |
|
int env_open_flags = DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL |
|
||||||
DB_INIT_TXN | DB_CREATE;
|
DB_INIT_TXN | DB_CREATE;
|
||||||
|
|
||||||
/* Setup the DB_ENV with that directory as DB_HOME */
|
/* Setup the DB_ENV with that directory as DB_HOME */
|
||||||
if ((rc = db_env_create(&dbenv, 0)) != 0) {
|
if ((rc = db_env_create(&dbenv, 0)) != 0) {
|
||||||
__dbsql_err(NULL, "%s", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,32 +1351,27 @@ dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_i
|
||||||
if (dir == 0 || dir[0] == '\0') {
|
if (dir == 0 || dir[0] == '\0') {
|
||||||
/* When dir is NULL, place all resources in memory. */
|
/* When dir is NULL, place all resources in memory. */
|
||||||
env_open_flags |= DB_PRIVATE;
|
env_open_flags |= DB_PRIVATE;
|
||||||
rc = dbenv->log_set_config(dbenv, DB_LOG_IN_MEMORY, 1);
|
dbenv->set_flags(dbenv, DB_LOG_INMEMORY, 1);
|
||||||
if (rc) {
|
/* Specify the size of the in-memory log buffer. */
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
|
||||||
return DBSQL_CANTOPEN;
|
|
||||||
}
|
|
||||||
/* Specify the size of the in-memory log buffer. */
|
|
||||||
if ((rc = dbenv->set_lg_bsize(dbenv, 10 * 1024 * 1024)) != 0) {
|
if ((rc = dbenv->set_lg_bsize(dbenv, 10 * 1024 * 1024)) != 0) {
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (__dbsql_exists(NULL, dir, &dir_p) == 0) {
|
if (__os_exists(dir, &dir_p) == 0) {
|
||||||
if (dir_p) {
|
if (dir_p) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
snprintf(buf, 1024, "%s%s%s", dir,
|
snprintf(buf, 1024, "%s%s%s", dir,
|
||||||
PATH_SEPARATOR, dir);
|
PATH_SEPARATOR, dir);
|
||||||
if (__dbsql_exists(NULL, buf, &dir_p) == 0)
|
if (__os_exists(buf, &dir_p) == 0)
|
||||||
env_open_flags = DB_JOINENV;
|
env_open_flags = DB_JOINENV;
|
||||||
} else {
|
} else {
|
||||||
__dbsql_err(NULL,
|
__dbsql_err(NULL,
|
||||||
"Environment must be a directory.");
|
"Environment must be a directory.");
|
||||||
return DBSQL_INVALID_NAME;
|
return DBSQL_INVALID_NAME;
|
||||||
}
|
}
|
||||||
} else {
|
} else { /* TODO __db_omode("rwxrwxrwx"):mode) != 0) */
|
||||||
mode = mode == 0 ? __dbsql_omode(NULL, "rwxrwxrwx") : mode;
|
if (mkdir(dir, mode == 0 ? 0777 : mode) != 0)
|
||||||
if (__dbsql_mkdir(NULL, dir, mode) != 0)
|
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1269,13 +1380,13 @@ dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_i
|
||||||
env_open_flags |= DB_THREAD;
|
env_open_flags |= DB_THREAD;
|
||||||
|
|
||||||
if ((rc = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
|
if ((rc = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
dbenv->close(dbenv, 0);
|
dbenv->close(dbenv, 0);
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = dbenv->set_cachesize(dbenv, 0, 1 * 1024 * 1024, 1)) != 0) {
|
if ((rc = dbenv->set_cachesize(dbenv, 0, 1 * 1024 * 1024, 1)) != 0) {
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
dbenv->close(dbenv, 0);
|
dbenv->close(dbenv, 0);
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
|
@ -1283,14 +1394,14 @@ dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_i
|
||||||
if (crypt && crypt[0]) {
|
if (crypt && crypt[0]) {
|
||||||
if ((rc = dbenv->set_encrypt(dbenv, crypt,
|
if ((rc = dbenv->set_encrypt(dbenv, crypt,
|
||||||
DB_ENCRYPT_AES)) != 0) {
|
DB_ENCRYPT_AES)) != 0) {
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
dbenv->close(dbenv, 0);
|
dbenv->close(dbenv, 0);
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = dbenv->open(dbenv, dir, env_open_flags, mode)) != 0) {
|
if ((rc = dbenv->open(dbenv, dir, env_open_flags, mode)) != 0) {
|
||||||
__dbsql_err(NULL, "%s\n", db_strerror(rc));
|
__dbsql_err(NULL, db_strerror(rc));
|
||||||
dbenv->close(dbenv, 0);
|
dbenv->close(dbenv, 0);
|
||||||
return DBSQL_CANTOPEN;
|
return DBSQL_CANTOPEN;
|
||||||
}
|
}
|
||||||
|
@ -1311,7 +1422,10 @@ dbsql_create_env(DBSQL **dbpp, const char *dir, const char *crypt, int mode, u_i
|
||||||
* EXTERN: int dbsql_create __P((DBSQL **, DB_ENV *, u_int32_t));
|
* EXTERN: int dbsql_create __P((DBSQL **, DB_ENV *, u_int32_t));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
dbsql_create(DBSQL **dbpp, DB_ENV* dbenv, u_int32_t flags)
|
dbsql_create(dbpp, dbenv, flags)
|
||||||
|
DBSQL **dbpp;
|
||||||
|
DB_ENV *dbenv;
|
||||||
|
u_int32_t flags;
|
||||||
{
|
{
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
DBSQL_ASSERT(dbpp != 0);
|
DBSQL_ASSERT(dbpp != 0);
|
||||||
|
@ -1321,6 +1435,7 @@ dbsql_create(DBSQL **dbpp, DB_ENV* dbenv, u_int32_t flags)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Does the library expect data to be encoded as UTF-8
|
* Does the library expect data to be encoded as UTF-8
|
||||||
|
* or iso8859? The following global constant always
|
||||||
* lets us know.
|
* lets us know.
|
||||||
* TODO: Make this configurable as a flag and part of the meta
|
* TODO: Make this configurable as a flag and part of the meta
|
||||||
* database.
|
* database.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: api_table.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -59,7 +61,11 @@ typedef struct table_result {
|
||||||
* STATIC: static int __get_table_cb __P((void *, int, char **, char **));
|
* STATIC: static int __get_table_cb __P((void *, int, char **, char **));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__get_table_cb(void* arg, int ncol, char* *argv, char* *colv)
|
__get_table_cb(arg, ncol, argv, colv)
|
||||||
|
void *arg;
|
||||||
|
int ncol;
|
||||||
|
char **argv;
|
||||||
|
char **colv;
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
table_result_t *p = (table_result_t*)arg;
|
table_result_t *p = (table_result_t*)arg;
|
||||||
|
@ -244,7 +250,8 @@ __api_get_table(dbp, sql, results, nrows, ncols, err_msgs)
|
||||||
* result Result returned from from __api_get_table()
|
* result Result returned from from __api_get_table()
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__api_free_table(char* *results)
|
__api_free_table(results)
|
||||||
|
char **results;
|
||||||
{
|
{
|
||||||
char *last_result;
|
char *last_result;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_attach.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -38,7 +40,10 @@
|
||||||
* PUBLIC: void __attach __P((parser_t *, token_t *, token_t *));
|
* PUBLIC: void __attach __P((parser_t *, token_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__attach(parser_t* parser, token_t* file, token_t* db)
|
__attach(parser, file, db)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *file;
|
||||||
|
token_t *db;
|
||||||
{
|
{
|
||||||
int rc, i;
|
int rc, i;
|
||||||
dbsql_db_t *new;
|
dbsql_db_t *new;
|
||||||
|
@ -133,7 +138,9 @@ __attach(parser_t* parser, token_t* file, token_t* db)
|
||||||
* PUBLIC: void __detach __P((parser_t *, token_t *));
|
* PUBLIC: void __detach __P((parser_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__detach(parser_t* parser, token_t* db)
|
__detach(parser, db)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *db;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
|
@ -280,7 +287,9 @@ int __ref_normalize_src_list(normctx, src_list)
|
||||||
* database
|
* database
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__ref_normalize_select(ref_normalizer_ctx_t* normctx, select_t* select)
|
__ref_normalize_select(normctx, select)
|
||||||
|
ref_normalizer_ctx_t *normctx;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
while (select) {
|
while (select) {
|
||||||
if (__ref_normalize_expr_list(normctx, select->pEList)) {
|
if (__ref_normalize_expr_list(normctx, select->pEList)) {
|
||||||
|
@ -339,7 +348,9 @@ int __ref_normalize_expr(normctx, expr)
|
||||||
* expr The expression to be fixed to one database
|
* expr The expression to be fixed to one database
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__ref_normalize_expr_list(ref_normalizer_ctx_t* normctx, expr_list_t* list)
|
__ref_normalize_expr_list(normctx, list)
|
||||||
|
ref_normalizer_ctx_t *normctx;
|
||||||
|
expr_list_t *list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_auth.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -97,7 +99,9 @@ int __api_set_authorizer(dbp, auth, arg)
|
||||||
* STATIC: static void __auth_bad_return_code __P((parser_t *, int));
|
* STATIC: static void __auth_bad_return_code __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__auth_bad_return_code(parser_t* parser, int rc)
|
__auth_bad_return_code(parser, rc)
|
||||||
|
parser_t *parser;
|
||||||
|
int rc;
|
||||||
{
|
{
|
||||||
char buf[20];
|
char buf[20];
|
||||||
sprintf(buf, "(%d)", rc);
|
sprintf(buf, "(%d)", rc);
|
||||||
|
@ -126,7 +130,10 @@ __auth_bad_return_code(parser_t* parser, int rc)
|
||||||
* tab_list All table that expr might refer to
|
* tab_list All table that expr might refer to
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__auth_read(parser_t* parser, expr_t* expr, src_list_t* tab_list)
|
__auth_read(parser, expr, tab_list)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
|
src_list_t *tab_list;
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
@ -257,7 +264,8 @@ void __auth_context_push(parser, authctx, context)
|
||||||
* PUBLIC: void __auth_context_pop __P((auth_context_t *));
|
* PUBLIC: void __auth_context_pop __P((auth_context_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__auth_context_pop(auth_context_t* authctx)
|
__auth_context_pop(authctx)
|
||||||
|
auth_context_t *authctx;
|
||||||
{
|
{
|
||||||
if (authctx->pParse) {
|
if (authctx->pParse) {
|
||||||
authctx->pParse->zAuthContext = authctx->zAuthContext;
|
authctx->pParse->zAuthContext = authctx->zAuthContext;
|
||||||
|
|
192
src/cg_build.c
192
src/cg_build.c
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_build.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -54,7 +56,9 @@
|
||||||
* PUBLIC: void __parse_begin __P((parser_t *, int));
|
* PUBLIC: void __parse_begin __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__parse_begin(parser_t* parser, int explain_flag)
|
__parse_begin(parser, explain_flag)
|
||||||
|
parser_t *parser;
|
||||||
|
int explain_flag;
|
||||||
{
|
{
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
int i;
|
int i;
|
||||||
|
@ -86,7 +90,11 @@ __parse_begin(parser_t* parser, int explain_flag)
|
||||||
* STATIC: static int __null_callback __P((void *, int , char **, char **));
|
* STATIC: static int __null_callback __P((void *, int , char **, char **));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__null_callback(void* not_used, int n, char* *a, char* *b)
|
__null_callback(not_used, n, a, b)
|
||||||
|
void *not_used;
|
||||||
|
int n;
|
||||||
|
char **a;
|
||||||
|
char **b;
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +112,8 @@ __null_callback(void* not_used, int n, char* *a, char* *b)
|
||||||
* PUBLIC: void __parse_exec __P((parser_t *));
|
* PUBLIC: void __parse_exec __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__parse_exec(parser_t* parser)
|
__parse_exec(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
int rc = DBSQL_SUCCESS;
|
int rc = DBSQL_SUCCESS;
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
@ -273,7 +282,9 @@ __find_index(dbp, name, database)
|
||||||
* STATIC: static void __delete_index __P((DBSQL *, index_t *));
|
* STATIC: static void __delete_index __P((DBSQL *, index_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__delete_index(DBSQL* dbp, index_t* index)
|
__delete_index(dbp, index)
|
||||||
|
DBSQL *dbp;
|
||||||
|
index_t *index;
|
||||||
{
|
{
|
||||||
index_t *old;
|
index_t *old;
|
||||||
|
|
||||||
|
@ -296,7 +307,9 @@ __delete_index(DBSQL* dbp, index_t* index)
|
||||||
* PUBLIC: void __unlink_and_delete_index __P((DBSQL *, index_t *));
|
* PUBLIC: void __unlink_and_delete_index __P((DBSQL *, index_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__unlink_and_delete_index(DBSQL* dbp, index_t* index)
|
__unlink_and_delete_index(dbp, index)
|
||||||
|
DBSQL *dbp;
|
||||||
|
index_t *index;
|
||||||
{
|
{
|
||||||
if (index->pTable->pIndex == index) {
|
if (index->pTable->pIndex == index) {
|
||||||
index->pTable->pIndex = index->pNext;
|
index->pTable->pIndex = index->pNext;
|
||||||
|
@ -325,7 +338,9 @@ __unlink_and_delete_index(DBSQL* dbp, index_t* index)
|
||||||
* PUBLIC: void __reset_internal_schema __P((DBSQL *, int));
|
* PUBLIC: void __reset_internal_schema __P((DBSQL *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__reset_internal_schema(DBSQL* dbp, int idb)
|
__reset_internal_schema(dbp, idb)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int idb;
|
||||||
{
|
{
|
||||||
hash_ele_t *ele;
|
hash_ele_t *ele;
|
||||||
hash_t temp1;
|
hash_t temp1;
|
||||||
|
@ -391,7 +406,8 @@ __reset_internal_schema(DBSQL* dbp, int idb)
|
||||||
* PUBLIC: void __rollback_internal_changes __P((DBSQL *));
|
* PUBLIC: void __rollback_internal_changes __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__rollback_internal_changes(DBSQL* dbp)
|
__rollback_internal_changes(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
if (dbp->flags & DBSQL_InternChanges) {
|
if (dbp->flags & DBSQL_InternChanges) {
|
||||||
__reset_internal_schema(dbp, 0);
|
__reset_internal_schema(dbp, 0);
|
||||||
|
@ -405,7 +421,8 @@ __rollback_internal_changes(DBSQL* dbp)
|
||||||
* PUBLIC: void __commit_internal_changes __P((DBSQL *));
|
* PUBLIC: void __commit_internal_changes __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__commit_internal_changes(DBSQL* dbp)
|
__commit_internal_changes(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
dbp->aDb[0].schema_sig = dbp->next_sig;
|
dbp->aDb[0].schema_sig = dbp->next_sig;
|
||||||
dbp->flags &= ~DBSQL_InternChanges;
|
dbp->flags &= ~DBSQL_InternChanges;
|
||||||
|
@ -428,7 +445,9 @@ __commit_internal_changes(DBSQL* dbp)
|
||||||
* PUBLIC: void __vdbe_delete_table __P((DBSQL *, table_t *));
|
* PUBLIC: void __vdbe_delete_table __P((DBSQL *, table_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vdbe_delete_table(DBSQL* dbp, table_t* table)
|
__vdbe_delete_table(dbp, table)
|
||||||
|
DBSQL *dbp;
|
||||||
|
table_t *table;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
index_t *index, *next;
|
index_t *index, *next;
|
||||||
|
@ -481,7 +500,9 @@ __vdbe_delete_table(DBSQL* dbp, table_t* table)
|
||||||
* STATIC: static void __unlink_and_delete_table __P((DBSQL, table_t *));
|
* STATIC: static void __unlink_and_delete_table __P((DBSQL, table_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__unlink_and_delete_table(DBSQL* dbp, table_t* table)
|
__unlink_and_delete_table(dbp, table)
|
||||||
|
DBSQL *dbp;
|
||||||
|
table_t *table;
|
||||||
{
|
{
|
||||||
table_t *old;
|
table_t *old;
|
||||||
foreign_key_t *f1, *f2;
|
foreign_key_t *f1, *f2;
|
||||||
|
@ -517,7 +538,8 @@ __unlink_and_delete_table(DBSQL* dbp, table_t* table)
|
||||||
* PUBLIC: char *__table_name_from_token __P((token_t *));
|
* PUBLIC: char *__table_name_from_token __P((token_t *));
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
__table_name_from_token(token_t* name)
|
__table_name_from_token(name)
|
||||||
|
token_t *name;
|
||||||
{
|
{
|
||||||
char *n;
|
char *n;
|
||||||
__dbsql_strndup(NULL, name->z, &n, name->n);
|
__dbsql_strndup(NULL, name->z, &n, name->n);
|
||||||
|
@ -722,7 +744,9 @@ void __start_table(parser, start, name, temp, view)
|
||||||
* PUBLIC: void __add_column __P((parser_t *, token_t *));
|
* PUBLIC: void __add_column __P((parser_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_column(parser_t* parser, token_t* name)
|
__add_column(parser, name)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *name;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
int i;
|
int i;
|
||||||
|
@ -767,7 +791,9 @@ __add_column(parser_t* parser, token_t* name)
|
||||||
* PUBLIC: void __add_not_null __P((parser_t *, int));
|
* PUBLIC: void __add_not_null __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_not_null(parser_t* parser, int on_error)
|
__add_not_null(parser, on_error)
|
||||||
|
parser_t *parser;
|
||||||
|
int on_error;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
int i;
|
int i;
|
||||||
|
@ -791,7 +817,10 @@ __add_not_null(parser_t* parser, int on_error)
|
||||||
* PUBLIC: void __add_column_type __P((parser_t *, token_t *, token_t *));
|
* PUBLIC: void __add_column_type __P((parser_t *, token_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_column_type(parser_t* parser, token_t* first, token_t* last)
|
__add_column_type(parser, first, last)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *first;
|
||||||
|
token_t *last;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -832,7 +861,10 @@ __add_column_type(parser_t* parser, token_t* first, token_t* last)
|
||||||
* PUBLIC: void __add_default_value __P((parser_t *, token_t *, int));
|
* PUBLIC: void __add_default_value __P((parser_t *, token_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_default_value(parser_t* parser, token_t* val, int minus)
|
__add_default_value(parser, val, minus)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *val;
|
||||||
|
int minus;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
int i;
|
int i;
|
||||||
|
@ -874,7 +906,10 @@ __add_default_value(parser_t* parser, token_t* val, int minus)
|
||||||
* PUBLIC: void __add_primary_key __P((parser_t *, id_list_t *, int));
|
* PUBLIC: void __add_primary_key __P((parser_t *, id_list_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_primary_key(parser_t* parser, id_list_t* list, int on_error)
|
__add_primary_key(parser, list, on_error)
|
||||||
|
parser_t *parser;
|
||||||
|
id_list_t *list;
|
||||||
|
int on_error;
|
||||||
{
|
{
|
||||||
table_t *table = parser->pNewTable;
|
table_t *table = parser->pNewTable;
|
||||||
char *type = 0;
|
char *type = 0;
|
||||||
|
@ -980,7 +1015,9 @@ __collate_type(type, ntype)
|
||||||
* PUBLIC: void __add_collate_type __P((parser_t *, int));
|
* PUBLIC: void __add_collate_type __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_collate_type(parser_t* parser, int type)
|
__add_collate_type(parser, type)
|
||||||
|
parser_t *parser;
|
||||||
|
int type;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
int i;
|
int i;
|
||||||
|
@ -1010,8 +1047,9 @@ __add_collate_type(parser_t* parser, int type)
|
||||||
*
|
*
|
||||||
* PUBLIC: void __change_schema_signature __P((DBSQL *, vdbe_t *));
|
* PUBLIC: void __change_schema_signature __P((DBSQL *, vdbe_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void __change_schema_signature(dbp, v)
|
||||||
__change_schema_signature(DBSQL* dbp, vdbe_t* v)
|
DBSQL *dbp;
|
||||||
|
vdbe_t *v;
|
||||||
{
|
{
|
||||||
static struct drand48_data rand;
|
static struct drand48_data rand;
|
||||||
static int first_time = 1;
|
static int first_time = 1;
|
||||||
|
@ -1060,7 +1098,10 @@ __ident_length(z)
|
||||||
* STATIC: static void __ident_put __P((char *, int *, char *));
|
* STATIC: static void __ident_put __P((char *, int *, char *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__ident_put(char* z, int* idx, char* ident)
|
__ident_put(z, idx, ident)
|
||||||
|
char *z;
|
||||||
|
int *idx;
|
||||||
|
char *ident;
|
||||||
{
|
{
|
||||||
int i, j, need_quote;
|
int i, j, need_quote;
|
||||||
i = *idx;
|
i = *idx;
|
||||||
|
@ -1093,7 +1134,8 @@ __ident_put(char* z, int* idx, char* ident)
|
||||||
* STATIC: static char *__gen_create_table_stmt __P((table_t *));
|
* STATIC: static char *__gen_create_table_stmt __P((table_t *));
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
__gen_create_table_stmt(table_t* table)
|
__gen_create_table_stmt(table)
|
||||||
|
table_t *table;
|
||||||
{
|
{
|
||||||
int i, k, n;
|
int i, k, n;
|
||||||
char *stmt;
|
char *stmt;
|
||||||
|
@ -1152,7 +1194,10 @@ __gen_create_table_stmt(table_t* table)
|
||||||
* PUBLIC: select_t *));
|
* PUBLIC: select_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__ending_create_table_paren(parser_t* parser, token_t* end, select_t* select)
|
__ending_create_table_paren(parser, end, select)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *end;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
@ -1263,7 +1308,7 @@ __ending_create_table_paren(parser_t* parser, token_t* end, select_t* select)
|
||||||
table_t *old;
|
table_t *old;
|
||||||
foreign_key_t *fkey;
|
foreign_key_t *fkey;
|
||||||
old = __hash_insert(&dbp->aDb[table->iDb].tblHash,
|
old = __hash_insert(&dbp->aDb[table->iDb].tblHash,
|
||||||
table->zName, strlen(table->zName) + 1, table);
|
table->zName, strlen(table->zName) + 1, table);
|
||||||
if (old) {
|
if (old) {
|
||||||
/* Malloc must have failed inside __hash_insert() */
|
/* Malloc must have failed inside __hash_insert() */
|
||||||
DBSQL_ASSERT(table == old);
|
DBSQL_ASSERT(table == old);
|
||||||
|
@ -1368,7 +1413,9 @@ void __create_view(parser, begin, name, select, temp)
|
||||||
* PUBLIC: int __view_get_column_names __P((parser_t *, table_t *));
|
* PUBLIC: int __view_get_column_names __P((parser_t *, table_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__view_get_column_names(parser_t* parser, table_t* table)
|
__view_get_column_names(parser, table)
|
||||||
|
parser_t *parser;
|
||||||
|
table_t *table;
|
||||||
{
|
{
|
||||||
expr_list_t *elist;
|
expr_list_t *elist;
|
||||||
select_t *sel;
|
select_t *sel;
|
||||||
|
@ -1405,7 +1452,7 @@ __view_get_column_names(parser_t* parser, table_t* table)
|
||||||
/*
|
/*
|
||||||
* If we get this far, it means we need to compute the table names.
|
* If we get this far, it means we need to compute the table names.
|
||||||
*/
|
*/
|
||||||
/* If nCol == 0, then 'table' must be a VIEW */
|
/* If nCol == 0, then 'table' must be a VIEW */
|
||||||
DBSQL_ASSERT(table->pSelect);
|
DBSQL_ASSERT(table->pSelect);
|
||||||
sel = table->pSelect;
|
sel = table->pSelect;
|
||||||
|
|
||||||
|
@ -1453,7 +1500,8 @@ __view_get_column_names(parser_t* parser, table_t* table)
|
||||||
* STATIC: static void __view_reset_column_names __P((table_t *));
|
* STATIC: static void __view_reset_column_names __P((table_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__view_reset_column_names(table_t* table)
|
__view_reset_column_names(table)
|
||||||
|
table_t *table;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (table == 0 || table->pSelect==0 ) return;
|
if (table == 0 || table->pSelect==0 ) return;
|
||||||
|
@ -1476,7 +1524,9 @@ __view_reset_column_names(table_t* table)
|
||||||
* STATIC: static void __view_reset_all __P((DBSQL *, int));
|
* STATIC: static void __view_reset_all __P((DBSQL *, int));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__view_reset_all(DBSQL* dbp, int idx)
|
__view_reset_all(dbp, idx)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int idx;
|
||||||
{
|
{
|
||||||
hash_ele_t *i;
|
hash_ele_t *i;
|
||||||
if (!DB_PROPERTY_HAS_VALUE(dbp, idx, DBSQL_UNRESET_VIEWS))
|
if (!DB_PROPERTY_HAS_VALUE(dbp, idx, DBSQL_UNRESET_VIEWS))
|
||||||
|
@ -1499,7 +1549,9 @@ __view_reset_all(DBSQL* dbp, int idx)
|
||||||
* PUBLIC: table_t *__table_from_token __P((parser_t *, token_t *));
|
* PUBLIC: table_t *__table_from_token __P((parser_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
table_t *
|
table_t *
|
||||||
__table_from_token(parser_t* parser, token_t* token)
|
__table_from_token(parser, token)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *token;
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
table_t *table;
|
table_t *table;
|
||||||
|
@ -1526,7 +1578,10 @@ __table_from_token(parser_t* parser, token_t* token)
|
||||||
* PUBLIC: void __drop_table __P((parser_t *, token_t *name, int));
|
* PUBLIC: void __drop_table __P((parser_t *, token_t *name, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__drop_table(parser_t* parser, token_t* name, int view)
|
__drop_table(parser, name, view)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *name;
|
||||||
|
int view;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
|
@ -1688,7 +1743,9 @@ __drop_table(parser_t* parser, token_t* name, int view)
|
||||||
* PUBLIC: void __add_idx_key_type __P((vdbe_t *, index_t *));
|
* PUBLIC: void __add_idx_key_type __P((vdbe_t *, index_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_idx_key_type(vdbe_t* v, index_t* idx)
|
__add_idx_key_type(v, idx)
|
||||||
|
vdbe_t *v;
|
||||||
|
index_t *idx;
|
||||||
{
|
{
|
||||||
char *type;
|
char *type;
|
||||||
table_t *table;
|
table_t *table;
|
||||||
|
@ -1862,7 +1919,9 @@ void __create_foreign_key(parser, from_col, to, to_col, flags)
|
||||||
* PUBLIC: void __defer_foreign_key __P((parser_t *, int));
|
* PUBLIC: void __defer_foreign_key __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__defer_foreign_key(parser_t* parser, int deferred)
|
__defer_foreign_key(parser, deferred)
|
||||||
|
parser_t *parser;
|
||||||
|
int deferred;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
foreign_key_t *fkey;
|
foreign_key_t *fkey;
|
||||||
|
@ -1872,8 +1931,8 @@ __defer_foreign_key(parser_t* parser, int deferred)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __create_index --
|
* __creat_index --
|
||||||
* Create a new index for an SQL table. 'index' is the name of the
|
* Create a new index for an SQL table. 'index' is the name of the
|
||||||
* index and pTable is the name of the table that is to be indexed.
|
* index and pTable is the name of the table that is to be indexed.
|
||||||
* Both will be NULL for a primary key or an index that is created
|
* Both will be NULL for a primary key or an index that is created
|
||||||
* to satisfy a UNIQUE constraint. If pTable and pIndex are NULL,
|
* to satisfy a UNIQUE constraint. If pTable and pIndex are NULL,
|
||||||
|
@ -1897,8 +1956,14 @@ __defer_foreign_key(parser_t* parser, int deferred)
|
||||||
* statement.
|
* statement.
|
||||||
* end The ")" that closes the CREATE INDEX statement.
|
* end The ")" that closes the CREATE INDEX statement.
|
||||||
*/
|
*/
|
||||||
void
|
void __create_index(parser, token, sltable, list, on_error, start, end)
|
||||||
__create_index(parser_t* parser, token_t* token, src_list_t* sltable, id_list_t* list, int on_error, token_t* start, token_t* end)
|
parser_t *parser;
|
||||||
|
token_t *token;
|
||||||
|
src_list_t *sltable;
|
||||||
|
id_list_t *list;
|
||||||
|
int on_error;
|
||||||
|
token_t *start;
|
||||||
|
token_t *end;
|
||||||
{
|
{
|
||||||
table_t *table; /* Table to be indexed */
|
table_t *table; /* Table to be indexed */
|
||||||
index_t *index; /* The index to be created */
|
index_t *index; /* The index to be created */
|
||||||
|
@ -1906,7 +1971,7 @@ __create_index(parser_t* parser, token_t* token, src_list_t* sltable, id_list_t*
|
||||||
int i, j;
|
int i, j;
|
||||||
token_t null_id; /* Fake token for an empty ID list */
|
token_t null_id; /* Fake token for an empty ID list */
|
||||||
ref_normalizer_ctx_t normctx; /* For assigning database
|
ref_normalizer_ctx_t normctx; /* For assigning database
|
||||||
names to sltable */
|
names to sltable */
|
||||||
int temp; /* True for a temporary index */
|
int temp; /* True for a temporary index */
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
|
||||||
|
@ -2080,9 +2145,9 @@ __create_index(parser_t* parser, token_t* token, src_list_t* sltable, id_list_t*
|
||||||
if (!parser->explain) {
|
if (!parser->explain) {
|
||||||
index_t *rindex;
|
index_t *rindex;
|
||||||
rindex = __hash_insert(&dbp->aDb[index->iDb].idxHash,
|
rindex = __hash_insert(&dbp->aDb[index->iDb].idxHash,
|
||||||
index->zName, strlen(index->zName) + 1, index);
|
index->zName, strlen(index->zName) + 1, index);
|
||||||
if (rindex) {
|
if (rindex) {
|
||||||
/* Malloc must have failed */
|
/* Malloc must have failed */
|
||||||
DBSQL_ASSERT(rindex == index);
|
DBSQL_ASSERT(rindex == index);
|
||||||
__dbsql_free(dbp, index);
|
__dbsql_free(dbp, index);
|
||||||
goto exit_create_index;
|
goto exit_create_index;
|
||||||
|
@ -2218,10 +2283,12 @@ exit_create_index:
|
||||||
* This routine will drop an existing named index. This routine
|
* This routine will drop an existing named index. This routine
|
||||||
* implements the DROP INDEX statement.
|
* implements the DROP INDEX statement.
|
||||||
*
|
*
|
||||||
* PUBLIC: void __drop_index __P((parser_t *, src_list_t *));
|
* PUBILC: __drop_index __P((parser_t *, src_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__drop_index(parser_t* parser, src_list_t* name)
|
__drop_index(parser, name)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *name;
|
||||||
{
|
{
|
||||||
index_t *index;
|
index_t *index;
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
|
@ -2316,7 +2383,9 @@ __drop_index(parser_t* parser, src_list_t* name)
|
||||||
* PUBLIC: id_list_t *__id_list_append __P((id_list_t *, token_t *));
|
* PUBLIC: id_list_t *__id_list_append __P((id_list_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
id_list_t *
|
id_list_t *
|
||||||
__id_list_append(id_list_t* list, token_t* token)
|
__id_list_append(list, token)
|
||||||
|
id_list_t *list;
|
||||||
|
token_t *token;
|
||||||
{
|
{
|
||||||
if (list == 0) {
|
if (list == 0) {
|
||||||
if (__dbsql_calloc(NULL, 1, sizeof(id_list_t), &list) ==ENOMEM)
|
if (__dbsql_calloc(NULL, 1, sizeof(id_list_t), &list) ==ENOMEM)
|
||||||
|
@ -2371,7 +2440,10 @@ __id_list_append(id_list_t* list, token_t* token)
|
||||||
* PUBLIC: token_t *));
|
* PUBLIC: token_t *));
|
||||||
*/
|
*/
|
||||||
src_list_t *
|
src_list_t *
|
||||||
__src_list_append(src_list_t* list, token_t* table, token_t* database)
|
__src_list_append(list, table, database)
|
||||||
|
src_list_t *list;
|
||||||
|
token_t *table;
|
||||||
|
token_t *database;
|
||||||
{
|
{
|
||||||
if (list == 0) {
|
if (list == 0) {
|
||||||
if (__dbsql_calloc(NULL, 1, sizeof(src_list_t), &list)==ENOMEM)
|
if (__dbsql_calloc(NULL, 1, sizeof(src_list_t), &list)==ENOMEM)
|
||||||
|
@ -2424,10 +2496,12 @@ __src_list_append(src_list_t* list, token_t* table, token_t* database)
|
||||||
* __src_list_assign_cursors --
|
* __src_list_assign_cursors --
|
||||||
* Assign cursors to all tables in a src_list_t.
|
* Assign cursors to all tables in a src_list_t.
|
||||||
*
|
*
|
||||||
* PUBLIC: void __src_list_assign_cursors __P((parser_t *, src_list_t *));
|
* __src_list_assign_cursors __P((parser_t *, src_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__src_list_assign_cursors(parser_t* parser, src_list_t* list)
|
__src_list_assign_cursors(parser, list)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < list->nSrc; i++) {
|
for (i = 0; i < list->nSrc; i++) {
|
||||||
|
@ -2444,7 +2518,9 @@ __src_list_assign_cursors(parser_t* parser, src_list_t* list)
|
||||||
* PUBLIC: void __src_list_add_alias __P((src_list_t *, token_t *));
|
* PUBLIC: void __src_list_add_alias __P((src_list_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__src_list_add_alias(src_list_t* list, token_t* token)
|
__src_list_add_alias(list, token)
|
||||||
|
src_list_t *list;
|
||||||
|
token_t *token;
|
||||||
{
|
{
|
||||||
if (list && list->nSrc > 0) {
|
if (list && list->nSrc > 0) {
|
||||||
int i = list->nSrc - 1;
|
int i = list->nSrc - 1;
|
||||||
|
@ -2461,7 +2537,8 @@ __src_list_add_alias(src_list_t* list, token_t* token)
|
||||||
* PUBLIC: void __id_list_delete __P((id_list_t *));
|
* PUBLIC: void __id_list_delete __P((id_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__id_list_delete(id_list_t* list)
|
__id_list_delete(list)
|
||||||
|
id_list_t *list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
|
@ -2502,7 +2579,8 @@ __id_list_index(list, name)
|
||||||
* PUBLIC: void __src_list_delete __P((src_list_t *));
|
* PUBLIC: void __src_list_delete __P((src_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__src_list_delete(src_list_t* list)
|
__src_list_delete(list)
|
||||||
|
src_list_t *list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
|
@ -2528,7 +2606,9 @@ __src_list_delete(src_list_t* list)
|
||||||
* PUBLIC: void __dbsql_txn_begin __P((parser_t *, int));
|
* PUBLIC: void __dbsql_txn_begin __P((parser_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__dbsql_txn_begin(parser_t* parser, int on_error)
|
__dbsql_txn_begin(parser, on_error)
|
||||||
|
parser_t *parser;
|
||||||
|
int on_error;
|
||||||
{
|
{
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
|
|
||||||
|
@ -2558,7 +2638,8 @@ __dbsql_txn_begin(parser_t* parser, int on_error)
|
||||||
* PUBLIC: void __dbsql_txn_commit __P((parser_t *));
|
* PUBLIC: void __dbsql_txn_commit __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__dbsql_txn_commit(parser_t* parser)
|
__dbsql_txn_commit(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
|
|
||||||
|
@ -2588,7 +2669,8 @@ __dbsql_txn_commit(parser_t* parser)
|
||||||
* PUBLIC: void __dbsql_txn_abort __P((parser_t *));
|
* PUBLIC: void __dbsql_txn_abort __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__dbsql_txn_abort(parser_t* parser)
|
__dbsql_txn_abort(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
|
@ -2660,7 +2742,10 @@ void __code_verify_schema(parser, idb)
|
||||||
* PUBLIC: void __vdbe_prepare_write __P((parser_t*, int, int));
|
* PUBLIC: void __vdbe_prepare_write __P((parser_t*, int, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vdbe_prepare_write(parser_t* parser, int checkpoint, int idb)
|
__vdbe_prepare_write(parser, checkpoint, idb)
|
||||||
|
parser_t *parser;
|
||||||
|
int checkpoint;
|
||||||
|
int idb;
|
||||||
{
|
{
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
@ -2695,7 +2780,8 @@ __vdbe_prepare_write(parser_t* parser, int checkpoint, int idb)
|
||||||
* PUBLIC: void __vdbe_conclude_write __P((parser_t *));
|
* PUBLIC: void __vdbe_conclude_write __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vdbe_conclude_write(parser_t* parser)
|
__vdbe_conclude_write(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
DBSQL *dbp = parser->db;
|
DBSQL *dbp = parser->db;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_copy.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_date.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -27,7 +29,7 @@
|
||||||
*
|
*
|
||||||
* All times and dates are managed as Julian Day numbers. The
|
* All times and dates are managed as Julian Day numbers. The
|
||||||
* dates and times are stored as the number of days since noon
|
* dates and times are stored as the number of days since noon
|
||||||
* in Greenwich on November 24, 4714, B.C. according to the Gregorian
|
* in Greenwich on November 24, 4714 B.C. according to the Gregorian
|
||||||
* calendar system.
|
* calendar system.
|
||||||
*
|
*
|
||||||
* 1970-01-01 00:00:00 is JD 2440587.5
|
* 1970-01-01 00:00:00 is JD 2440587.5
|
||||||
|
@ -41,7 +43,7 @@
|
||||||
* The Gregorian calendar system is used for all dates and times,
|
* The Gregorian calendar system is used for all dates and times,
|
||||||
* even those that predate the Gregorian calendar. Historians usually
|
* even those that predate the Gregorian calendar. Historians usually
|
||||||
* use the Julian calendar for dates prior to 1582-10-15 and for some
|
* use the Julian calendar for dates prior to 1582-10-15 and for some
|
||||||
* dates afterward, depending on locale. Beware of this difference.
|
* dates afterwards, depending on locale. Beware of this difference.
|
||||||
*
|
*
|
||||||
* The conversion algorithms are implemented based on descriptions
|
* The conversion algorithms are implemented based on descriptions
|
||||||
* in the following text:
|
* in the following text:
|
||||||
|
@ -59,9 +61,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dbsql_int.h"
|
#include "dbsql_int.h"
|
||||||
|
@ -168,7 +167,7 @@ __convert_str_to_double(date, result)
|
||||||
*
|
*
|
||||||
* A missing specifier is not considered an error.
|
* A missing specifier is not considered an error.
|
||||||
*
|
*
|
||||||
* STATIC: static int __parse_tz __P((const char *, datetime_t *));
|
* STATIC: int __parse_tz __P((const char *, datetime_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__parse_tz(date, dt)
|
__parse_tz(date, dt)
|
||||||
|
@ -270,7 +269,8 @@ __parse_hh_mm_ss(date, dt)
|
||||||
* STATIC: static void compute_jd __P((datetime_t *));
|
* STATIC: static void compute_jd __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__compute_jd(datetime_t* dt)
|
__compute_jd(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
int Y, M, D, A, B, X1, X2;
|
int Y, M, D, A, B, X1, X2;
|
||||||
|
|
||||||
|
@ -419,7 +419,8 @@ __parse_date_or_time(date, dt)
|
||||||
* STATIC: static void __compute_ymd __P((datetime_t *));
|
* STATIC: static void __compute_ymd __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__compute_ymd(datetime_t* dt)
|
__compute_ymd(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
int Z, A, B, C, D, E, X1;
|
int Z, A, B, C, D, E, X1;
|
||||||
if (dt->validYMD)
|
if (dt->validYMD)
|
||||||
|
@ -445,7 +446,8 @@ __compute_ymd(datetime_t* dt)
|
||||||
* STATIC: static void __compute_hms __P((datetime_t *));
|
* STATIC: static void __compute_hms __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__compute_hms(datetime_t* dt)
|
__compute_hms(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
int Z, s;
|
int Z, s;
|
||||||
if (dt->validHMS)
|
if (dt->validHMS)
|
||||||
|
@ -469,7 +471,8 @@ __compute_hms(datetime_t* dt)
|
||||||
* STATIC: static void __compute_ymd_hms __P((datetime_t *));
|
* STATIC: static void __compute_ymd_hms __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__compute_ymd_hms(datetime_t* dt)
|
__compute_ymd_hms(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
__compute_ymd(dt);
|
__compute_ymd(dt);
|
||||||
__compute_hms(dt);
|
__compute_hms(dt);
|
||||||
|
@ -482,7 +485,8 @@ __compute_ymd_hms(datetime_t* dt)
|
||||||
* STATIC: static void __clear_ymd_hms_tz __P((datetime_t *));
|
* STATIC: static void __clear_ymd_hms_tz __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__clear_ymd_hms_tz(datetime_t* dt)
|
__clear_ymd_hms_tz(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
dt->validYMD = 0;
|
dt->validYMD = 0;
|
||||||
dt->validHMS = 0;
|
dt->validHMS = 0;
|
||||||
|
@ -497,7 +501,8 @@ __clear_ymd_hms_tz(datetime_t* dt)
|
||||||
* STATIC: static double __localtime_offset __P((datetime_t *));
|
* STATIC: static double __localtime_offset __P((datetime_t *));
|
||||||
*/
|
*/
|
||||||
static double
|
static double
|
||||||
__localtime_offset(datetime_t* dt)
|
__localtime_offset(dt)
|
||||||
|
datetime_t *dt;
|
||||||
{
|
{
|
||||||
datetime_t x, y;
|
datetime_t x, y;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
@ -1014,7 +1019,8 @@ __strftime_sql_func(context, argc, argv)
|
||||||
* PUBLIC: void __register_datetime_funcs __P((DBSQL *));
|
* PUBLIC: void __register_datetime_funcs __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__register_datetime_funcs(DBSQL* dbp)
|
__register_datetime_funcs(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
static struct {
|
static struct {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -1033,8 +1039,8 @@ __register_datetime_funcs(DBSQL* dbp)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(funcs) / sizeof(funcs[0]); i++) {
|
for (i = 0; i < sizeof(funcs) / sizeof(funcs[0]); i++) {
|
||||||
dbp->create_function(dbp, funcs[i].name, DBSQL_UTF8_ENCODED,
|
dbp->create_function(dbp, funcs[i].name, funcs[i].args,
|
||||||
funcs[i].args, NULL, funcs[i].func,
|
DBSQL_UTF8_ENCODED, NULL, funcs[i].func,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (funcs[i].func) {
|
if (funcs[i].func) {
|
||||||
dbp->func_return_type(dbp, funcs[i].name,
|
dbp->func_return_type(dbp, funcs[i].name,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_delete.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +38,9 @@
|
||||||
* PUBLIC: table_t *__src_list_lookup __P((parser_t *, src_list_t *));
|
* PUBLIC: table_t *__src_list_lookup __P((parser_t *, src_list_t *));
|
||||||
*/
|
*/
|
||||||
table_t *
|
table_t *
|
||||||
__src_list_lookup(parser_t* parser, src_list_t* src)
|
__src_list_lookup(parser, src)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *src;
|
||||||
{
|
{
|
||||||
table_t *table = 0;
|
table_t *table = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -58,7 +62,10 @@ __src_list_lookup(parser_t* parser, src_list_t* src)
|
||||||
* PUBLIC: int __is_table_read_only __P((parser_t *, table_t *, int));
|
* PUBLIC: int __is_table_read_only __P((parser_t *, table_t *, int));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__is_table_read_only(parser_t* parser, table_t* table, int views_ok)
|
__is_table_read_only(parser, table, views_ok)
|
||||||
|
parser_t *parser;
|
||||||
|
table_t *table;
|
||||||
|
int views_ok;
|
||||||
{
|
{
|
||||||
if (table->readOnly) {
|
if (table->readOnly) {
|
||||||
__error_msg(parser, "table %s may not be modified",
|
__error_msg(parser, "table %s may not be modified",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_expr.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -40,7 +42,11 @@
|
||||||
* PUBLIC: expr_t *__expr __P((int, expr_t *, expr_t *, token_t *));
|
* PUBLIC: expr_t *__expr __P((int, expr_t *, expr_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
expr_t *
|
expr_t *
|
||||||
__expr(int op, expr_t* left, expr_t* right, token_t* token)
|
__expr(op, left, right, token)
|
||||||
|
int op;
|
||||||
|
expr_t *left;
|
||||||
|
expr_t *right;
|
||||||
|
token_t *token;
|
||||||
{
|
{
|
||||||
expr_t *new;
|
expr_t *new;
|
||||||
if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) {
|
if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) {
|
||||||
|
@ -75,7 +81,10 @@ __expr(int op, expr_t* left, expr_t* right, token_t* token)
|
||||||
* PUBLIC: void __expr_span __P((expr_t *, token_t *, token_t *));
|
* PUBLIC: void __expr_span __P((expr_t *, token_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_span(expr_t* expr, token_t* left, token_t* right)
|
__expr_span(expr, left, right)
|
||||||
|
expr_t *expr;
|
||||||
|
token_t *left;
|
||||||
|
token_t *right;
|
||||||
{
|
{
|
||||||
DBSQL_ASSERT(right != 0);
|
DBSQL_ASSERT(right != 0);
|
||||||
DBSQL_ASSERT(left != 0);
|
DBSQL_ASSERT(left != 0);
|
||||||
|
@ -101,7 +110,9 @@ __expr_span(expr_t* expr, token_t* left, token_t* right)
|
||||||
* PUBLIC: expr_t *__expr_function __P((expr_list_t *, token_t *));
|
* PUBLIC: expr_t *__expr_function __P((expr_list_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
expr_t *
|
expr_t *
|
||||||
__expr_function(expr_list_t* list, token_t* token)
|
__expr_function(list, token)
|
||||||
|
expr_list_t *list;
|
||||||
|
token_t *token;
|
||||||
{
|
{
|
||||||
expr_t *new;
|
expr_t *new;
|
||||||
if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) {
|
if (__dbsql_calloc(NULL, 1, sizeof(expr_t), &new) == ENOMEM) {
|
||||||
|
@ -129,7 +140,8 @@ __expr_function(expr_list_t* list, token_t* token)
|
||||||
* PUBLIC: void __expr_delete __P((expr_t *));
|
* PUBLIC: void __expr_delete __P((expr_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_delete(expr_t* p)
|
__expr_delete(p)
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -159,7 +171,8 @@ __expr_delete(expr_t* p)
|
||||||
* PUBLIC: expr_t *__expr_dup __P((expr_t *));
|
* PUBLIC: expr_t *__expr_dup __P((expr_t *));
|
||||||
*/
|
*/
|
||||||
expr_t *
|
expr_t *
|
||||||
__expr_dup(expr_t* p)
|
__expr_dup(p)
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
expr_t *new;
|
expr_t *new;
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
|
@ -188,7 +201,9 @@ __expr_dup(expr_t* p)
|
||||||
* PUBLIC: void __token_copy __P((token_t *, token_t *));
|
* PUBLIC: void __token_copy __P((token_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__token_copy(token_t* to, token_t* from)
|
__token_copy(to, from)
|
||||||
|
token_t *to;
|
||||||
|
token_t *from;
|
||||||
{
|
{
|
||||||
if (to->dyn)
|
if (to->dyn)
|
||||||
__dbsql_free(NULL, (char*)to->z);
|
__dbsql_free(NULL, (char*)to->z);
|
||||||
|
@ -208,7 +223,8 @@ __token_copy(token_t* to, token_t* from)
|
||||||
* PUBLIC: expr_list_t *__expr_list_dup __P((expr_list_t *));
|
* PUBLIC: expr_list_t *__expr_list_dup __P((expr_list_t *));
|
||||||
*/
|
*/
|
||||||
expr_list_t *
|
expr_list_t *
|
||||||
__expr_list_dup(expr_list_t* p)
|
__expr_list_dup(p)
|
||||||
|
expr_list_t *p;
|
||||||
{
|
{
|
||||||
expr_list_t *new;
|
expr_list_t *new;
|
||||||
int i;
|
int i;
|
||||||
|
@ -252,7 +268,8 @@ __expr_list_dup(expr_list_t* p)
|
||||||
* PUBLIC: src_list_t *__src_list_dup __P((src_list_t *));
|
* PUBLIC: src_list_t *__src_list_dup __P((src_list_t *));
|
||||||
*/
|
*/
|
||||||
src_list_t *
|
src_list_t *
|
||||||
__src_list_dup(src_list_t* p)
|
__src_list_dup(p)
|
||||||
|
src_list_t *p;
|
||||||
{
|
{
|
||||||
src_list_t *new;
|
src_list_t *new;
|
||||||
int i;
|
int i;
|
||||||
|
@ -287,7 +304,8 @@ __src_list_dup(src_list_t* p)
|
||||||
* PUBLIC: id_list_t *__id_list_dup __P((id_list_t *));
|
* PUBLIC: id_list_t *__id_list_dup __P((id_list_t *));
|
||||||
*/
|
*/
|
||||||
id_list_t *
|
id_list_t *
|
||||||
__id_list_dup(id_list_t* p)
|
__id_list_dup(p)
|
||||||
|
id_list_t *p;
|
||||||
{
|
{
|
||||||
id_list_t *new;
|
id_list_t *new;
|
||||||
int i;
|
int i;
|
||||||
|
@ -314,7 +332,8 @@ __id_list_dup(id_list_t* p)
|
||||||
* PUBLIC: select_t *__select_dup __P((select_t *));
|
* PUBLIC: select_t *__select_dup __P((select_t *));
|
||||||
*/
|
*/
|
||||||
select_t *
|
select_t *
|
||||||
__select_dup(select_t* p)
|
__select_dup(p)
|
||||||
|
select_t *p;
|
||||||
{
|
{
|
||||||
select_t *new;
|
select_t *new;
|
||||||
if (p == 0)
|
if (p == 0)
|
||||||
|
@ -348,7 +367,10 @@ __select_dup(select_t* p)
|
||||||
* PUBLIC: token_t *));
|
* PUBLIC: token_t *));
|
||||||
*/
|
*/
|
||||||
expr_list_t *
|
expr_list_t *
|
||||||
__expr_list_append(expr_list_t* list, expr_t* expr, token_t* name)
|
__expr_list_append(list, expr, name)
|
||||||
|
expr_list_t *list;
|
||||||
|
expr_t *expr;
|
||||||
|
token_t *name;
|
||||||
{
|
{
|
||||||
if (list == 0) {
|
if (list == 0) {
|
||||||
if (__dbsql_calloc(NULL, 1, sizeof(expr_list_t),
|
if (__dbsql_calloc(NULL, 1, sizeof(expr_list_t),
|
||||||
|
@ -389,7 +411,8 @@ __expr_list_append(expr_list_t* list, expr_t* expr, token_t* name)
|
||||||
* PUBLIC: void __expr_list_delete __P((expr_list_t *));
|
* PUBLIC: void __expr_list_delete __P((expr_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_list_delete(expr_list_t* list)
|
__expr_list_delete(list)
|
||||||
|
expr_list_t *list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
|
@ -413,7 +436,8 @@ __expr_list_delete(expr_list_t* list)
|
||||||
* PUBLIC: int __expr_is_constant __P((expr_t *));
|
* PUBLIC: int __expr_is_constant __P((expr_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_is_constant(expr_t* p)
|
__expr_is_constant(p)
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
@ -472,7 +496,9 @@ __expr_is_constant(expr_t* p)
|
||||||
* PUBLIC: int __expr_is_integer __P((expr_t *, int *));
|
* PUBLIC: int __expr_is_integer __P((expr_t *, int *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_is_integer(expr_t* p, int* value)
|
__expr_is_integer(p, value)
|
||||||
|
expr_t *p;
|
||||||
|
int *value;
|
||||||
{
|
{
|
||||||
const char *z;
|
const char *z;
|
||||||
int v, n;
|
int v, n;
|
||||||
|
@ -1048,7 +1074,11 @@ __get_function_name(expr, name, len)
|
||||||
* PUBLIC: int __expr_check __P((parser_t *, expr_t *, int, int *));
|
* PUBLIC: int __expr_check __P((parser_t *, expr_t *, int, int *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_check(parser_t* parser, expr_t* expr, int agg_allowed, int* agg)
|
__expr_check(parser, expr, agg_allowed, agg)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
|
int agg_allowed;
|
||||||
|
int *agg;
|
||||||
{
|
{
|
||||||
int nerr, i, n, no_such_func, is_type_of, wrong_num_args, is_agg, nid;
|
int nerr, i, n, no_such_func, is_type_of, wrong_num_args, is_agg, nid;
|
||||||
const char *id;
|
const char *id;
|
||||||
|
@ -1079,7 +1109,7 @@ __expr_check(parser_t* parser, expr_t* expr, int agg_allowed, int* agg)
|
||||||
def = __find_function(parser->db, id, nid, -1, 0);
|
def = __find_function(parser->db, id, nid, -1, 0);
|
||||||
if (def == 0) {
|
if (def == 0) {
|
||||||
if (n == 1 && nid == 6 &&
|
if (n == 1 && nid == 6 &&
|
||||||
strncasecmp(id, "typeof",6) == 0) {
|
strncasecmp(id, "typeof",6) == 0) {
|
||||||
is_type_of = 1;
|
is_type_of = 1;
|
||||||
} else {
|
} else {
|
||||||
no_such_func = 1;
|
no_such_func = 1;
|
||||||
|
@ -1131,7 +1161,8 @@ __expr_check(parser_t* parser, expr_t* expr, int agg_allowed, int* agg)
|
||||||
}
|
}
|
||||||
} else if (def->dataType >= 0) {
|
} else if (def->dataType >= 0) {
|
||||||
if (def->dataType < n) {
|
if (def->dataType < n) {
|
||||||
expr->dataType = __expr_type(expr->pList->a[def->dataType].pExpr);
|
expr->dataType =
|
||||||
|
__expr_type(expr->pList->a[def->dataType].pExpr);
|
||||||
} else {
|
} else {
|
||||||
expr->dataType = DBSQL_SO_NUM;
|
expr->dataType = DBSQL_SO_NUM;
|
||||||
}
|
}
|
||||||
|
@ -1182,7 +1213,8 @@ __expr_check(parser_t* parser, expr_t* expr, int agg_allowed, int* agg)
|
||||||
* PUBLIC: int __expr_type __P((expr_t *));
|
* PUBLIC: int __expr_type __P((expr_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_type(expr_t* p)
|
__expr_type(p)
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
expr_list_t *list;
|
expr_list_t *list;
|
||||||
|
@ -1275,7 +1307,9 @@ __expr_type(expr_t* p)
|
||||||
* PUBLIC: void __expr_code __P((parser_t *, expr_t *));
|
* PUBLIC: void __expr_code __P((parser_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_code(parser_t* parser, expr_t* expr)
|
__expr_code(parser, expr)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
{
|
{
|
||||||
vdbe_t *v = parser->pVdbe;
|
vdbe_t *v = parser->pVdbe;
|
||||||
int i, op, dest, nexpr, nid, addr, expr_end_lable, jump_inst;
|
int i, op, dest, nexpr, nid, addr, expr_end_lable, jump_inst;
|
||||||
|
@ -1531,7 +1565,11 @@ __expr_code(parser_t* parser, expr_t* expr)
|
||||||
* PUBILC: void __expr_if_true __P((parser_t *, expr_t *, int, int));
|
* PUBILC: void __expr_if_true __P((parser_t *, expr_t *, int, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_if_true(parser_t* parser, expr_t* expr, int dest, int jump_if_null)
|
__expr_if_true(parser, expr, dest, jump_if_null)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
|
int dest;
|
||||||
|
int jump_if_null;
|
||||||
{
|
{
|
||||||
vdbe_t *v = parser->pVdbe;
|
vdbe_t *v = parser->pVdbe;
|
||||||
int d2, addr, op = 0;
|
int d2, addr, op = 0;
|
||||||
|
@ -1622,7 +1660,11 @@ __expr_if_true(parser_t* parser, expr_t* expr, int dest, int jump_if_null)
|
||||||
* PUBLIC: void __expr_if_false __P((parser_t *, expr_t *, int, int));
|
* PUBLIC: void __expr_if_false __P((parser_t *, expr_t *, int, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__expr_if_false(parser_t* parser, expr_t* expr, int dest, int jump_if_null)
|
__expr_if_false(parser, expr, dest, jump_if_null)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
|
int dest;
|
||||||
|
int jump_if_null;
|
||||||
{
|
{
|
||||||
vdbe_t *v = parser->pVdbe;
|
vdbe_t *v = parser->pVdbe;
|
||||||
int addr, d2, op = 0;
|
int addr, d2, op = 0;
|
||||||
|
@ -1720,7 +1762,9 @@ __expr_if_false(parser_t* parser, expr_t* expr, int dest, int jump_if_null)
|
||||||
* PUBLIC: int __expr_compare __P((expr_t *, expr_t *));
|
* PUBLIC: int __expr_compare __P((expr_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_compare(expr_t* a, expr_t* b)
|
__expr_compare(a, b)
|
||||||
|
expr_t *a;
|
||||||
|
expr_t *b;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (a == 0) {
|
if (a == 0) {
|
||||||
|
@ -1772,7 +1816,8 @@ __expr_compare(expr_t* a, expr_t* b)
|
||||||
* STATIC: static int __append_agg_info __P((parser_t *));
|
* STATIC: static int __append_agg_info __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__append_agg_info(parser_t* parser)
|
__append_agg_info(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
agg_expr_t *agg;
|
agg_expr_t *agg;
|
||||||
if ((parser->nAgg & 0x7) == 0) {
|
if ((parser->nAgg & 0x7) == 0) {
|
||||||
|
@ -1797,7 +1842,9 @@ __append_agg_info(parser_t* parser)
|
||||||
* PUBLIC: int __expr_analyze_aggregates __P((parser_t *, expr_t *));
|
* PUBLIC: int __expr_analyze_aggregates __P((parser_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__expr_analyze_aggregates(parser_t* parser, expr_t* expr)
|
__expr_analyze_aggregates(parser, expr)
|
||||||
|
parser_t *parser;
|
||||||
|
expr_t *expr;
|
||||||
{
|
{
|
||||||
int i, n, nexpr, nerr = 0;
|
int i, n, nexpr, nerr = 0;
|
||||||
agg_expr_t *agg;
|
agg_expr_t *agg;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_insert.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_pragma.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -37,7 +39,8 @@
|
||||||
* STATIC: static int __get_boolean __P((char *));
|
* STATIC: static int __get_boolean __P((char *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__get_boolean(char* z)
|
__get_boolean(z)
|
||||||
|
char *z;
|
||||||
{
|
{
|
||||||
static char *true[] = { "yes", "on", "true" };
|
static char *true[] = { "yes", "on", "true" };
|
||||||
int i;
|
int i;
|
||||||
|
@ -67,7 +70,8 @@ __get_boolean(char* z)
|
||||||
* STATIC: static int __get_safety_level __P((char *));
|
* STATIC: static int __get_safety_level __P((char *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__get_safety_level(char* z)
|
__get_safety_level(z)
|
||||||
|
char *z;
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
const char *word;
|
const char *word;
|
||||||
|
@ -109,7 +113,11 @@ __get_safety_level(char* z)
|
||||||
* PUBLIC: void __pragma __P((parser_t *, token_t *, token_t *, int));
|
* PUBLIC: void __pragma __P((parser_t *, token_t *, token_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__pragma(parser_t* parser, token_t* left, token_t* right, int minus_p)
|
__pragma(parser, left, right, minus_p)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *left;
|
||||||
|
token_t *right;
|
||||||
|
int minus_p;
|
||||||
{
|
{
|
||||||
char *left_name = 0;
|
char *left_name = 0;
|
||||||
char *right_name = 0;
|
char *right_name = 0;
|
||||||
|
|
110
src/cg_select.c
110
src/cg_select.c
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_select.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,7 +108,11 @@ __select_new(result_cols, from_clause, where_clause, groupby_clause,
|
||||||
* PUBLIC: int __join_type __P((parser_t *, token_t *, token_t *, token_t *));
|
* PUBLIC: int __join_type __P((parser_t *, token_t *, token_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__join_type(parser_t* parser, token_t* a, token_t* b, token_t* c)
|
__join_type(parser, a, b, c)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *a;
|
||||||
|
token_t *b;
|
||||||
|
token_t *c;
|
||||||
{
|
{
|
||||||
int jointype = 0;
|
int jointype = 0;
|
||||||
token_t *ap_all[3];
|
token_t *ap_all[3];
|
||||||
|
@ -252,7 +258,8 @@ __add_where_term(col, table1, table2, expr)
|
||||||
* STATIC: static void __set_join_expr __P((expr_t *));
|
* STATIC: static void __set_join_expr __P((expr_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__set_join_expr(expr_t* p)
|
__set_join_expr(p)
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
while (p) {
|
while (p) {
|
||||||
ExprSetProperty(p, EP_FromJoin);
|
ExprSetProperty(p, EP_FromJoin);
|
||||||
|
@ -272,7 +279,9 @@ __set_join_expr(expr_t* p)
|
||||||
* STATIC: static int __process_join __P((parser_t *, select_t *));
|
* STATIC: static int __process_join __P((parser_t *, select_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__process_join(parser_t* parser, select_t* select)
|
__process_join(parser, select)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
src_list_t *src;
|
src_list_t *src;
|
||||||
|
@ -373,7 +382,8 @@ __process_join(parser_t* parser, select_t* select)
|
||||||
* PUBLIC: void __select_delete __P((select_t *));
|
* PUBLIC: void __select_delete __P((select_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__select_delete(select_t* select)
|
__select_delete(select)
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
if (select == 0)
|
if (select == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -395,7 +405,8 @@ __select_delete(select_t* select)
|
||||||
* STATIC: static void __aggregage_info_reset __P((parser_t *));
|
* STATIC: static void __aggregage_info_reset __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__aggregate_info_reset(parser_t* parser)
|
__aggregate_info_reset(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
__dbsql_free(parser->db, parser->aAgg);
|
__dbsql_free(parser->db, parser->aAgg);
|
||||||
parser->aAgg = 0;
|
parser->aAgg = 0;
|
||||||
|
@ -412,7 +423,10 @@ __aggregate_info_reset(parser_t* parser)
|
||||||
* STATIC: expr_list_t *));
|
* STATIC: expr_list_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__push_onto_sorter(parser_t* parser, vdbe_t* v, expr_list_t* orderby_clause)
|
__push_onto_sorter(parser, v, orderby_clause)
|
||||||
|
parser_t *parser;
|
||||||
|
vdbe_t *v;
|
||||||
|
expr_list_t *orderby_clause;
|
||||||
{
|
{
|
||||||
int i, order, type, c;
|
int i, order, type, c;
|
||||||
char *sort_order;
|
char *sort_order;
|
||||||
|
@ -458,7 +472,9 @@ __push_onto_sorter(parser_t* parser, vdbe_t* v, expr_list_t* orderby_clause)
|
||||||
* PUBLIC: void __add_key_type __P((vdbe_t *, expr_list_t *));
|
* PUBLIC: void __add_key_type __P((vdbe_t *, expr_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__add_key_type(vdbe_t* v, expr_list_t* elist)
|
__add_key_type(v, elist)
|
||||||
|
vdbe_t *v;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int col = elist->nExpr;
|
int col = elist->nExpr;
|
||||||
|
@ -705,7 +721,12 @@ __select_inner_loop(parser, select, elist, src_table, num_cols, orderby_clause,
|
||||||
* param Optional parameter associated with dest
|
* param Optional parameter associated with dest
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__generate_sort_tail(select_t* select, vdbe_t* v, int num_cols, int dest, int param)
|
__generate_sort_tail(select, v, num_cols, dest, param)
|
||||||
|
select_t *select;
|
||||||
|
vdbe_t *v;
|
||||||
|
int num_cols;
|
||||||
|
int dest;
|
||||||
|
int param;
|
||||||
{
|
{
|
||||||
int i, addr;
|
int i, addr;
|
||||||
int end = __vdbe_make_label(v);
|
int end = __vdbe_make_label(v);
|
||||||
|
@ -784,7 +805,10 @@ __generate_sort_tail(select_t* select, vdbe_t* v, int num_cols, int dest, int pa
|
||||||
* elist Expressions defining the result set
|
* elist Expressions defining the result set
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__generate_column_types(parser_t* parser, src_list_t* tables, expr_list_t* elist)
|
__generate_column_types(parser, tables, elist)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *tables;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
int i, j, col;
|
int i, j, col;
|
||||||
expr_t *p;
|
expr_t *p;
|
||||||
|
@ -843,7 +867,10 @@ __generate_column_types(parser_t* parser, src_list_t* tables, expr_list_t* elist
|
||||||
* elist Expressions defining the result set
|
* elist Expressions defining the result set
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__generate_column_names(parser_t* parser, src_list_t* tables, expr_list_t* elist)
|
__generate_column_names(parser, tables, elist)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *tables;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
int i, j, show_full_names, icol, addr;
|
int i, j, show_full_names, icol, addr;
|
||||||
char *type, *name, *col, *tab;
|
char *type, *name, *col, *tab;
|
||||||
|
@ -923,7 +950,8 @@ __generate_column_names(parser_t* parser, src_list_t* tables, expr_list_t* elist
|
||||||
* STATIC: static const char *__select_op_name __P((int));
|
* STATIC: static const char *__select_op_name __P((int));
|
||||||
*/
|
*/
|
||||||
static const char *
|
static const char *
|
||||||
__select_op_name(int id)
|
__select_op_name(id)
|
||||||
|
int id;
|
||||||
{
|
{
|
||||||
char *z;
|
char *z;
|
||||||
switch(id) {
|
switch(id) {
|
||||||
|
@ -961,7 +989,9 @@ __select_op_name(int id)
|
||||||
* STATIC: static int __file_in_column_list __P((parser_t *, select_t *));
|
* STATIC: static int __file_in_column_list __P((parser_t *, select_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__fill_in_column_list(parser_t* parser, select_t* select)
|
__fill_in_column_list(parser, select)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
int i, j, k, rc;
|
int i, j, k, rc;
|
||||||
src_list_t *tables;
|
src_list_t *tables;
|
||||||
|
@ -1217,7 +1247,8 @@ __fill_in_column_list(parser_t* parser, select_t* select)
|
||||||
* PUBLIC: void __select_unbind __P((select_t *));
|
* PUBLIC: void __select_unbind __P((select_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__select_unbind(select_t* select)
|
__select_unbind(select)
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
table_t *table;
|
table_t *table;
|
||||||
|
@ -1359,7 +1390,8 @@ __match_orderby_to_column(parser, select, orderby_clause, table_idx,
|
||||||
* PUBLIC: vdbe_t *__parser_get_vdbe __P((parser_t *));
|
* PUBLIC: vdbe_t *__parser_get_vdbe __P((parser_t *));
|
||||||
*/
|
*/
|
||||||
vdbe_t *
|
vdbe_t *
|
||||||
__parser_get_vdbe(parser_t* parser)
|
__parser_get_vdbe(parser)
|
||||||
|
parser_t *parser;
|
||||||
{
|
{
|
||||||
vdbe_t *v = parser->pVdbe;
|
vdbe_t *v = parser->pVdbe;
|
||||||
if (v == 0) {
|
if (v == 0) {
|
||||||
|
@ -1401,7 +1433,9 @@ __parser_get_vdbe(parser_t* parser)
|
||||||
* STATIC: expr_list_t *));
|
* STATIC: expr_list_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__multi_select_sort_order(select_t* select, expr_list_t* orderby_clause)
|
__multi_select_sort_order(select, orderby_clause)
|
||||||
|
select_t *select;
|
||||||
|
expr_list_t *orderby_clause;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
expr_list_t *elist;
|
expr_list_t *elist;
|
||||||
|
@ -1450,7 +1484,9 @@ __multi_select_sort_order(select_t* select, expr_list_t* orderby_clause)
|
||||||
* STATIC: static void __compute_limit_registers __P((parser_t *, select_t *));
|
* STATIC: static void __compute_limit_registers __P((parser_t *, select_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__compute_limit_registers(parser_t* parser, select_t* select)
|
__compute_limit_registers(parser, select)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
int mem;
|
int mem;
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
|
@ -1519,7 +1555,11 @@ __compute_limit_registers(parser_t* parser, select_t* select)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__multi_select(parser_t* parser, select_t* select, int dest, int param)
|
__multi_select(parser, select, dest, param)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
|
int dest;
|
||||||
|
int param;
|
||||||
{
|
{
|
||||||
int tab1, tab2;
|
int tab1, tab2;
|
||||||
int cont, brk, start;
|
int cont, brk, start;
|
||||||
|
@ -1629,6 +1669,7 @@ __multi_select(parser_t* parser, select_t* select, int dest, int param)
|
||||||
rc = __select(parser, prior, prior_op, union_tab, 0, 0, 0);
|
rc = __select(parser, prior, prior_op, union_tab, 0, 0, 0);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Code the current SELECT statement.
|
* Code the current SELECT statement.
|
||||||
*/
|
*/
|
||||||
|
@ -1651,6 +1692,7 @@ __multi_select(parser_t* parser, select_t* select, int dest, int param)
|
||||||
select->nOffset = offset;
|
select->nOffset = offset;
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert the data in the temporary table into whatever form
|
* Convert the data in the temporary table into whatever form
|
||||||
* it is that we currently need.
|
* it is that we currently need.
|
||||||
|
@ -1711,6 +1753,7 @@ __multi_select(parser_t* parser, select_t* select, int dest, int param)
|
||||||
rc = __select(parser, prior, SRT_Union, tab1, 0, 0, 0);
|
rc = __select(parser, prior, SRT_Union, tab1, 0, 0, 0);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Code the current SELECT into temporary table "tab2".
|
* Code the current SELECT into temporary table "tab2".
|
||||||
*/
|
*/
|
||||||
|
@ -1727,6 +1770,7 @@ __multi_select(parser_t* parser, select_t* select, int dest, int param)
|
||||||
select->nOffset = offset;
|
select->nOffset = offset;
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate code to take the intersection of the two temporary
|
* Generate code to take the intersection of the two temporary
|
||||||
* tables.
|
* tables.
|
||||||
|
@ -1796,10 +1840,13 @@ static void __subst_expr_list(expr_list_t*,int,expr_list_t*);
|
||||||
* changes to pExpr so that it refers directly to the source table
|
* changes to pExpr so that it refers directly to the source table
|
||||||
* of the subquery rather the result set of the subquery.
|
* of the subquery rather the result set of the subquery.
|
||||||
*
|
*
|
||||||
* STATIC: static void __subst_expr __P((expr_t *, int, expr_list_t *));
|
* STATIC: void __subst_expr __P((expr_t *, int, expr_list_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__subst_expr(expr_t* expr, int table, expr_list_t* elist)
|
__subst_expr(expr, table, elist)
|
||||||
|
expr_t *expr;
|
||||||
|
int table;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
expr_t *new;
|
expr_t *new;
|
||||||
|
|
||||||
|
@ -1841,7 +1888,10 @@ __subst_expr(expr_t* expr, int table, expr_list_t* elist)
|
||||||
* STATIC: expr_list_t *));
|
* STATIC: expr_list_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__subst_expr_list(expr_list_t* list, int table, expr_list_t* elist)
|
__subst_expr_list(list, table, elist)
|
||||||
|
expr_list_t *list;
|
||||||
|
int table;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (list == 0)
|
if (list == 0)
|
||||||
|
@ -1932,7 +1982,12 @@ __subst_expr_list(expr_list_t* list, int table, expr_list_t* elist)
|
||||||
* subquery_agg_p True if the subquery uses aggregate functions
|
* subquery_agg_p True if the subquery uses aggregate functions
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__flatten_subquery(parser_t* parser, select_t* select, int from, int agg_p, int subquery_agg_p)
|
__flatten_subquery(parser, select, from, agg_p, subquery_agg_p)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
|
int from;
|
||||||
|
int agg_p;
|
||||||
|
int subquery_agg_p;
|
||||||
{
|
{
|
||||||
select_t *sub_select; /* The inner query or "subquery" */
|
select_t *sub_select; /* The inner query or "subquery" */
|
||||||
src_list_t *outer_from_clause; /* The FROM clause of the outer query */
|
src_list_t *outer_from_clause; /* The FROM clause of the outer query */
|
||||||
|
@ -2175,7 +2230,11 @@ __flatten_subquery(parser_t* parser, select_t* select, int from, int agg_p, int
|
||||||
* STATIC: static int __min_max_query __P((parser_t *, select_t *, int, int));
|
* STATIC: static int __min_max_query __P((parser_t *, select_t *, int, int));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__min_max_query(parser_t* parser, select_t* select, int dest, int param)
|
__min_max_query(parser, select, dest, param)
|
||||||
|
parser_t *parser;
|
||||||
|
select_t *select;
|
||||||
|
int dest;
|
||||||
|
int param;
|
||||||
{
|
{
|
||||||
expr_t *expr;
|
expr_t *expr;
|
||||||
int col;
|
int col;
|
||||||
|
@ -2850,7 +2909,10 @@ int __select(parser, select, dest, param, parent, parent_tab, parent_agg_p)
|
||||||
* PUBLIC: table_t *__select_result_set __P((parser_t *, char *, select_t *));
|
* PUBLIC: table_t *__select_result_set __P((parser_t *, char *, select_t *));
|
||||||
*/
|
*/
|
||||||
table_t *
|
table_t *
|
||||||
__select_result_set(parser_t* parser, char* tab_name, select_t* select)
|
__select_result_set(parser, tab_name, select)
|
||||||
|
parser_t *parser;
|
||||||
|
char *tab_name;
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
int i, j, n, cnt;
|
int i, j, n, cnt;
|
||||||
table_t *table;
|
table_t *table;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_trigger.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
@ -28,7 +30,8 @@
|
||||||
* PUBLIC: void __vdbe_delete_trigger_step __P((trigger_step_t *));
|
* PUBLIC: void __vdbe_delete_trigger_step __P((trigger_step_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vdbe_delete_trigger_step(trigger_step_t* ts)
|
__vdbe_delete_trigger_step(ts)
|
||||||
|
trigger_step_t *ts;
|
||||||
{
|
{
|
||||||
while(ts) {
|
while(ts) {
|
||||||
trigger_step_t * tmp = ts;
|
trigger_step_t * tmp = ts;
|
||||||
|
@ -220,7 +223,10 @@ __begin_trigger(parser, trigger, tr_tm, op, columns, tab_name, foreach,
|
||||||
* CREATE TRIGGER
|
* CREATE TRIGGER
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__finish_trigger(parser_t* parser, trigger_step_t* steplist, token_t* all)
|
__finish_trigger(parser, steplist, all)
|
||||||
|
parser_t *parser;
|
||||||
|
trigger_step_t *steplist;
|
||||||
|
token_t *all;
|
||||||
{
|
{
|
||||||
ref_normalizer_ctx_t normctx;
|
ref_normalizer_ctx_t normctx;
|
||||||
trigger_t *nt = 0; /* The trigger whose construction is finishing up */
|
trigger_t *nt = 0; /* The trigger whose construction is finishing up */
|
||||||
|
@ -312,7 +318,8 @@ __finish_trigger(parser_t* parser, trigger_step_t* steplist, token_t* all)
|
||||||
* STATIC: static void __persist_trigger_step __P((trigger_step_t *));
|
* STATIC: static void __persist_trigger_step __P((trigger_step_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__persist_trigger_step(trigger_step_t* ts)
|
__persist_trigger_step(ts)
|
||||||
|
trigger_step_t *ts;
|
||||||
{
|
{
|
||||||
if (ts->target.z) {
|
if (ts->target.z) {
|
||||||
__dbsql_strndup(NULL, ts->target.z, &ts->target.z, ts->target.n);
|
__dbsql_strndup(NULL, ts->target.z, &ts->target.z, ts->target.n);
|
||||||
|
@ -351,7 +358,8 @@ __persist_trigger_step(trigger_step_t* ts)
|
||||||
* PUBLIC: trigger_step_t * __trigger_select_step __P((select_t *));
|
* PUBLIC: trigger_step_t * __trigger_select_step __P((select_t *));
|
||||||
*/
|
*/
|
||||||
trigger_step_t *
|
trigger_step_t *
|
||||||
__trigger_select_step(select_t* select)
|
__trigger_select_step(select)
|
||||||
|
select_t *select;
|
||||||
{
|
{
|
||||||
trigger_step_t *ts;
|
trigger_step_t *ts;
|
||||||
|
|
||||||
|
@ -386,7 +394,12 @@ __trigger_select_step(select_t* select)
|
||||||
* etc.)
|
* etc.)
|
||||||
*/
|
*/
|
||||||
trigger_step_t *
|
trigger_step_t *
|
||||||
__trigger_insert_step(token_t* tab_name, id_list_t* column, expr_list_t* elist, select_t* select, int orconf)
|
__trigger_insert_step(tab_name, column, elist, select, orconf)
|
||||||
|
token_t *tab_name;
|
||||||
|
id_list_t *column;
|
||||||
|
expr_list_t *elist;
|
||||||
|
select_t *select;
|
||||||
|
int orconf;
|
||||||
{
|
{
|
||||||
trigger_step_t *ts;
|
trigger_step_t *ts;
|
||||||
|
|
||||||
|
@ -423,7 +436,11 @@ __trigger_insert_step(token_t* tab_name, id_list_t* column, expr_list_t* elist,
|
||||||
* etc)
|
* etc)
|
||||||
*/
|
*/
|
||||||
trigger_step_t *
|
trigger_step_t *
|
||||||
__trigger_update_step(token_t* tab_name, expr_list_t* elist, expr_t* where_clause, int orconf)
|
__trigger_update_step(tab_name, elist, where_clause, orconf)
|
||||||
|
token_t *tab_name;
|
||||||
|
expr_list_t *elist;
|
||||||
|
expr_t *where_clause;
|
||||||
|
int orconf;
|
||||||
{
|
{
|
||||||
trigger_step_t *ts;
|
trigger_step_t *ts;
|
||||||
|
|
||||||
|
@ -449,7 +466,9 @@ __trigger_update_step(token_t* tab_name, expr_list_t* elist, expr_t* where_claus
|
||||||
* PUBLIC: trigger_step_t *__trigger_delete_step __P((token_t *, expr_t *));
|
* PUBLIC: trigger_step_t *__trigger_delete_step __P((token_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
trigger_step_t *
|
trigger_step_t *
|
||||||
__trigger_delete_step(token_t* tab_name, expr_t* where_clause)
|
__trigger_delete_step(tab_name, where_clause)
|
||||||
|
token_t *tab_name;
|
||||||
|
expr_t *where_clause;
|
||||||
{
|
{
|
||||||
trigger_step_t *ts;
|
trigger_step_t *ts;
|
||||||
|
|
||||||
|
@ -472,7 +491,8 @@ __trigger_delete_step(token_t* tab_name, expr_t* where_clause)
|
||||||
* PUBLIC: void __vdbe_delete_trigger __P((trigger_t *));
|
* PUBLIC: void __vdbe_delete_trigger __P((trigger_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vdbe_delete_trigger(trigger_t* trigger)
|
__vdbe_delete_trigger(trigger)
|
||||||
|
trigger_t *trigger;
|
||||||
{
|
{
|
||||||
if (trigger == 0)
|
if (trigger == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -503,7 +523,9 @@ __vdbe_delete_trigger(trigger_t* trigger)
|
||||||
* PUBLIC: void __drop_trigger __P((parser_t *, src_list_t *));
|
* PUBLIC: void __drop_trigger __P((parser_t *, src_list_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__drop_trigger(parser_t* parser, src_list_t* trig_list)
|
__drop_trigger(parser, trig_list)
|
||||||
|
parser_t *parser;
|
||||||
|
src_list_t *trig_list;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
trigger_t *trigger;
|
trigger_t *trigger;
|
||||||
|
@ -547,7 +569,10 @@ __drop_trigger(parser_t* parser, src_list_t* trig_list)
|
||||||
* PUBLIC: void __drop_trigger_ptr __P((parser_t *, trigger_t *, int));
|
* PUBLIC: void __drop_trigger_ptr __P((parser_t *, trigger_t *, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__drop_trigger_ptr(parser_t* parser, trigger_t* trigger, int nested)
|
__drop_trigger_ptr(parser, trigger, nested)
|
||||||
|
parser_t *parser;
|
||||||
|
trigger_t *trigger;
|
||||||
|
int nested;
|
||||||
{
|
{
|
||||||
table_t *table;
|
table_t *table;
|
||||||
vdbe_t *v;
|
vdbe_t *v;
|
||||||
|
@ -646,7 +671,9 @@ __drop_trigger_ptr(parser_t* parser, trigger_t* trigger, int nested)
|
||||||
* STATIC: static int __check_column_overlap __P((id_list_t *, expr_list_t *));
|
* STATIC: static int __check_column_overlap __P((id_list_t *, expr_list_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__check_column_overlap(id_list_t* id_list, expr_list_t* elist)
|
__check_column_overlap(id_list, elist)
|
||||||
|
id_list_t *id_list;
|
||||||
|
expr_list_t *elist;
|
||||||
{
|
{
|
||||||
int e;
|
int e;
|
||||||
if (!id_list || !elist)
|
if (!id_list || !elist)
|
||||||
|
@ -767,7 +794,10 @@ static src_list_t *targetSrcList(parser, step)
|
||||||
* orconfin Conflict algorithm. (OE_Abort, etc)
|
* orconfin Conflict algorithm. (OE_Abort, etc)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__code_trigger_program(parser_t* parser, trigger_step_t* steplist, int orconfin)
|
__code_trigger_program(parser, steplist, orconfin)
|
||||||
|
parser_t *parser;
|
||||||
|
trigger_step_t *steplist;
|
||||||
|
int orconfin;
|
||||||
{
|
{
|
||||||
int orconf;
|
int orconf;
|
||||||
trigger_step_t * ts = steplist;
|
trigger_step_t * ts = steplist;
|
||||||
|
@ -841,7 +871,7 @@ __code_trigger_program(parser_t* parser, trigger_step_t* steplist, int orconfin)
|
||||||
* pointing at a row containing values to be substituted for old.*
|
* pointing at a row containing values to be substituted for old.*
|
||||||
* expressions in the trigger program(s).
|
* expressions in the trigger program(s).
|
||||||
*
|
*
|
||||||
* PUBLIC: int __code_row_trigger __P(());
|
* PUBlIC: int __code_row_trigger __P(());
|
||||||
*
|
*
|
||||||
* parser Parser context
|
* parser Parser context
|
||||||
* op One of TK_UPDATE, TK_INSERT, TK_DELETE
|
* op One of TK_UPDATE, TK_INSERT, TK_DELETE
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_update.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_vacuum.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +38,9 @@
|
||||||
* PUBLIC: void __vacuum __P((parser_t *, token_t *));
|
* PUBLIC: void __vacuum __P((parser_t *, token_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__vacuum(parser_t* parser, token_t* tab_name)
|
__vacuum(parser, tab_name)
|
||||||
|
parser_t *parser;
|
||||||
|
token_t *tab_name;
|
||||||
{
|
{
|
||||||
vdbe_t *v = __parser_get_vdbe(parser);
|
vdbe_t *v = __parser_get_vdbe(parser);
|
||||||
__vdbe_add_op(v, OP_Vacuum, 0, 0);
|
__vdbe_add_op(v, OP_Vacuum, 0, 0);
|
||||||
|
@ -51,7 +55,9 @@ __vacuum(parser_t* parser, token_t* tab_name)
|
||||||
* PUBLIC: int __execute_vacuum __P((char **, DBSQL *));
|
* PUBLIC: int __execute_vacuum __P((char **, DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__execute_vacuum(char* *err_msgs, DBSQL* dbp)
|
__execute_vacuum(err_msgs, dbp)
|
||||||
|
char **err_msgs;
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return DBSQL_SUCCESS; /* NOTE: When DB implements compaction (someday)
|
return DBSQL_SUCCESS; /* NOTE: When DB implements compaction (someday)
|
||||||
then this will be the place to invoke the
|
then this will be the place to invoke the
|
||||||
|
@ -68,7 +74,9 @@ __execute_vacuum(char* *err_msgs, DBSQL* dbp)
|
||||||
* PUBLIC: int __execute_vacuum __P((char **, DBSQL *));
|
* PUBLIC: int __execute_vacuum __P((char **, DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__execute_vacuum(char* *err_msgs, DBSQL* dbp)
|
__execute_vacuum(err_msgs, dbp)
|
||||||
|
char **err_msgs;
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
return DBSQL_SUCCESS;
|
return DBSQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: cg_where.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,12 +33,12 @@
|
||||||
* clause subexpression is separated from the others by an AND operator.
|
* clause subexpression is separated from the others by an AND operator.
|
||||||
*/
|
*/
|
||||||
typedef struct expr_info {
|
typedef struct expr_info {
|
||||||
expr_t *p; /* Pointer to the subexpression */
|
expr_t *p; /* Pointer to the subexpression */
|
||||||
u_int8_t indexable; /* True if this subexprssion is usable
|
u_int8_t indexable; /* True if this subexprssion is usable
|
||||||
by an index */
|
by an index */
|
||||||
short int idxLeft; /* p->pLeft is a column in this table
|
short int idxLeft; /* p->pLeft is a column in this table
|
||||||
number. -1 if p->pLeft is not the
|
number. -1 if p->pLeft is not the
|
||||||
column of any table */
|
column of any table */
|
||||||
short int idxRight; /* p->pRight is a column in this table
|
short int idxRight; /* p->pRight is a column in this table
|
||||||
number. -1 if p->pRight is not the
|
number. -1 if p->pRight is not the
|
||||||
column of any table */
|
column of any table */
|
||||||
|
@ -71,7 +73,10 @@ typedef struct expr_mask_set {
|
||||||
* STATIC: static int __expr_split __P((int, expr_info_t *, expr_t *));
|
* STATIC: static int __expr_split __P((int, expr_info_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__expr_split(int num_slot, expr_info_t* slot, expr_t* expr)
|
__expr_split(num_slot, slot, expr)
|
||||||
|
int num_slot;
|
||||||
|
expr_info_t *slot;
|
||||||
|
expr_t *expr;
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
if (expr == 0 || num_slot < 1)
|
if (expr == 0 || num_slot < 1)
|
||||||
|
@ -98,7 +103,9 @@ __expr_split(int num_slot, expr_info_t* slot, expr_t* expr)
|
||||||
* STATIC: static int __get_cursor_bitmask __P((expr_mask_set_t *, int));
|
* STATIC: static int __get_cursor_bitmask __P((expr_mask_set_t *, int));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__get_cursor_bitmask(expr_mask_set_t* mask_set, int cursor)
|
__get_cursor_bitmask(mask_set, cursor)
|
||||||
|
expr_mask_set_t *mask_set;
|
||||||
|
int cursor;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < mask_set->n; i++) {
|
for (i = 0; i < mask_set->n; i++) {
|
||||||
|
@ -135,7 +142,9 @@ __get_cursor_bitmask(expr_mask_set_t* mask_set, int cursor)
|
||||||
* STATIC: static int __expr_table_usage __P((expr_mask_set_t *, expr_t *));
|
* STATIC: static int __expr_table_usage __P((expr_mask_set_t *, expr_t *));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__expr_table_usage(expr_mask_set_t* mask_set, expr_t* p)
|
__expr_table_usage(mask_set, p)
|
||||||
|
expr_mask_set_t *mask_set;
|
||||||
|
expr_t *p;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int mask = 0;
|
unsigned int mask = 0;
|
||||||
|
@ -168,7 +177,8 @@ __expr_table_usage(expr_mask_set_t* mask_set, expr_t* p)
|
||||||
* STATIC: static int __allowed_op __P((int));
|
* STATIC: static int __allowed_op __P((int));
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
__allowed_op(int op)
|
__allowed_op(op)
|
||||||
|
int op;
|
||||||
{
|
{
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case TK_LT: /* FALLTHROUGH */
|
case TK_LT: /* FALLTHROUGH */
|
||||||
|
@ -193,7 +203,9 @@ __allowed_op(int op)
|
||||||
* STATIC: static void expr_analyze __P((expr_mask_set_t *, expr_info_t *));
|
* STATIC: static void expr_analyze __P((expr_mask_set_t *, expr_info_t *));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__expr_analyze(expr_mask_set_t* mask_set, expr_info_t* info)
|
__expr_analyze(mask_set, info)
|
||||||
|
expr_mask_set_t *mask_set;
|
||||||
|
expr_info_t *info;
|
||||||
{
|
{
|
||||||
expr_t *expr = info->p;
|
expr_t *expr = info->p;
|
||||||
info->prereqLeft = __expr_table_usage(mask_set, expr->pLeft);
|
info->prereqLeft = __expr_table_usage(mask_set, expr->pLeft);
|
||||||
|
@ -1381,7 +1393,8 @@ where_info_t *__where_begin(parser, tab_list, where_clause, push_key_p,
|
||||||
* PUBLIC: void __where_end __P((where_info_t *));
|
* PUBLIC: void __where_end __P((where_info_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__where_end(where_info_t* winfo)
|
__where_end(winfo)
|
||||||
|
where_info_t *winfo;
|
||||||
{
|
{
|
||||||
int i, addr;
|
int i, addr;
|
||||||
where_level_t *level;
|
where_level_t *level;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: getopt.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: memcmp.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -116,7 +116,8 @@
|
||||||
*/
|
*/
|
||||||
#ifndef HAVE_SRAND48_R
|
#ifndef HAVE_SRAND48_R
|
||||||
void
|
void
|
||||||
__rng_seed(char* buf)
|
__rng_seed(buf)
|
||||||
|
char *buf;
|
||||||
{
|
{
|
||||||
u_int32_t pid;
|
u_int32_t pid;
|
||||||
double jt;
|
double jt;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* $Id: strcasecmp.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -48,6 +48,8 @@
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* $Id: strdup.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: xvprintf.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -126,7 +128,9 @@ static et_info_t fmtinfo[] = {
|
||||||
* always returned.
|
* always returned.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
et_getdigit(long_double_t* val, int* cnt)
|
et_getdigit(val, cnt)
|
||||||
|
long_double_t *val;
|
||||||
|
int *cnt;
|
||||||
{
|
{
|
||||||
int digit;
|
int digit;
|
||||||
long_double_t d;
|
long_double_t d;
|
||||||
|
@ -755,7 +759,10 @@ __et_printf(dbp, func, arg, fmt, ap)
|
||||||
* STATIC: static void mout __P((void *, char *, int));
|
* STATIC: static void mout __P((void *, char *, int));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__mout(void* arg, char* zNewText, int nNewChar)
|
__mout(arg, zNewText, nNewChar)
|
||||||
|
void *arg;
|
||||||
|
char *zNewText;
|
||||||
|
int nNewChar;
|
||||||
{
|
{
|
||||||
xvprintf_t *pM = (xvprintf_t*)arg;
|
xvprintf_t *pM = (xvprintf_t*)arg;
|
||||||
if (pM->len + nNewChar + 1 > pM->amt) {
|
if (pM->len + nNewChar + 1 > pM->amt) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,14 +16,12 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_alloc.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql.h"
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
#include "db_int.h"
|
#include "dbsql_int.h"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __dbsql_umalloc --
|
* __dbsql_umalloc --
|
||||||
|
@ -33,7 +31,10 @@
|
||||||
* PUBLIC: int __dbsql_umalloc __P((DBSQL *, size_t, void *));
|
* PUBLIC: int __dbsql_umalloc __P((DBSQL *, size_t, void *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_umalloc(DBSQL* dbp, size_t size, void* storep)
|
__dbsql_umalloc(dbp, size, storep)
|
||||||
|
DBSQL *dbp;
|
||||||
|
size_t size;
|
||||||
|
void *storep;
|
||||||
{
|
{
|
||||||
return (__os_umalloc((dbp ? dbp->dbenv : NULL), size, storep));
|
return (__os_umalloc((dbp ? dbp->dbenv : NULL), size, storep));
|
||||||
}
|
}
|
||||||
|
@ -45,7 +46,10 @@ __dbsql_umalloc(DBSQL* dbp, size_t size, void* storep)
|
||||||
* PUBLIC: int __dbsql_urealloc __P((DBSQL *, size_t, void *));
|
* PUBLIC: int __dbsql_urealloc __P((DBSQL *, size_t, void *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_urealloc(DBSQL* dbp, size_t size, void* storep)
|
__dbsql_urealloc(dbp, size, storep)
|
||||||
|
DBSQL *dbp;
|
||||||
|
size_t size;
|
||||||
|
void *storep;
|
||||||
{
|
{
|
||||||
return (__os_urealloc((dbp ? dbp->dbenv : NULL), size, storep));
|
return (__os_urealloc((dbp ? dbp->dbenv : NULL), size, storep));
|
||||||
}
|
}
|
||||||
|
@ -57,7 +61,9 @@ __dbsql_urealloc(DBSQL* dbp, size_t size, void* storep)
|
||||||
* PUBLIC: void __dbsql_ufree __P((DBSQL *, void *));
|
* PUBLIC: void __dbsql_ufree __P((DBSQL *, void *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__dbsql_ufree(DBSQL* dbp, void* ptr)
|
__dbsql_ufree(dbp, ptr)
|
||||||
|
DBSQL *dbp;
|
||||||
|
void *ptr;
|
||||||
{
|
{
|
||||||
__os_ufree((dbp ? dbp->dbenv : NULL), ptr);
|
__os_ufree((dbp ? dbp->dbenv : NULL), ptr);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +139,10 @@ __dbsql_calloc(dbp, num, size, storep)
|
||||||
* PUBLIC: int __dbsql_malloc __P((DBSQL *, size_t, void *));
|
* PUBLIC: int __dbsql_malloc __P((DBSQL *, size_t, void *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_malloc(DBSQL* dbp, size_t size, void* storep)
|
__dbsql_malloc(dbp, size, storep)
|
||||||
|
DBSQL *dbp;
|
||||||
|
size_t size;
|
||||||
|
void *storep;
|
||||||
{
|
{
|
||||||
return (__os_malloc((dbp ? dbp->dbenv : NULL), size, storep));
|
return (__os_malloc((dbp ? dbp->dbenv : NULL), size, storep));
|
||||||
}
|
}
|
||||||
|
@ -145,7 +154,10 @@ __dbsql_malloc(DBSQL* dbp, size_t size, void* storep)
|
||||||
* PUBLIC: int __dbsql_realloc __P((DBSQL *, size_t, void *));
|
* PUBLIC: int __dbsql_realloc __P((DBSQL *, size_t, void *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_realloc(DBSQL* dbp, size_t size, void* storep)
|
__dbsql_realloc(dbp, size, storep)
|
||||||
|
DBSQL *dbp;
|
||||||
|
size_t size;
|
||||||
|
void *storep;
|
||||||
{
|
{
|
||||||
return (__os_realloc((dbp ? dbp->dbenv : NULL), size, storep));
|
return (__os_realloc((dbp ? dbp->dbenv : NULL), size, storep));
|
||||||
}
|
}
|
||||||
|
@ -157,7 +169,9 @@ __dbsql_realloc(DBSQL* dbp, size_t size, void* storep)
|
||||||
* PUBLIC: void __dbsql_free __P((DBSQL *, void *));
|
* PUBLIC: void __dbsql_free __P((DBSQL *, void *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__dbsql_free(DBSQL* dbp, void* ptr)
|
__dbsql_free(dbp, ptr)
|
||||||
|
DBSQL *dbp;
|
||||||
|
void *ptr;
|
||||||
{
|
{
|
||||||
__os_free((dbp ? dbp->dbenv : NULL), ptr);
|
__os_free((dbp ? dbp->dbenv : NULL), ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_atof.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
#include "dbsql_int.h"
|
#include "dbsql_int.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __dbsql_atof --
|
* __dbsql_atof --
|
||||||
* The string z[] is an ascii representation of a real number.
|
* The string z[] is an ascii representation of a real number.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_atoi.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
#include "dbsql_int.h"
|
#include "dbsql_int.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __dbsql_atoi --
|
* __dbsql_atoi --
|
||||||
* Return TRUE if 'str' is a 32-bit signed integer and write
|
* Return TRUE if 'str' is a 32-bit signed integer and write
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_err.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
@ -63,7 +65,8 @@ __dbsql_assert(failedexpr, file, line)
|
||||||
* PUBLIC: int __dbsql_panic_msg __P((DBSQL *));
|
* PUBLIC: int __dbsql_panic_msg __P((DBSQL *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_panic_msg(DBSQL* dbp)
|
__dbsql_panic_msg(dbp)
|
||||||
|
DBSQL *dbp;
|
||||||
{
|
{
|
||||||
__dbsql_err(dbp, "PANIC: fatal database error detected; run recovery");
|
__dbsql_err(dbp, "PANIC: fatal database error detected; run recovery");
|
||||||
|
|
||||||
|
@ -80,7 +83,9 @@ __dbsql_panic_msg(DBSQL* dbp)
|
||||||
* PUBLIC: int __dbsql_panic __P((DBSQL *, int));
|
* PUBLIC: int __dbsql_panic __P((DBSQL *, int));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__dbsql_panic(DBSQL* dbp, int errval)
|
__dbsql_panic(dbp, errval)
|
||||||
|
DBSQL *dbp;
|
||||||
|
int errval;
|
||||||
{
|
{
|
||||||
if (dbp != NULL) {
|
if (dbp != NULL) {
|
||||||
PANIC_SET(dbp, 1);
|
PANIC_SET(dbp, 1);
|
||||||
|
@ -117,7 +122,8 @@ __dbsql_panic(DBSQL* dbp, int errval)
|
||||||
* EXTERN: char *dbsql_strerror __P((int));
|
* EXTERN: char *dbsql_strerror __P((int));
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
dbsql_strerror(int error)
|
dbsql_strerror(error)
|
||||||
|
int error;
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -276,8 +282,8 @@ __dbsql_errcall(dbp, error, error_set, fmt, ap)
|
||||||
* are pretty rare anymore.
|
* are pretty rare anymore.
|
||||||
*/
|
*/
|
||||||
if ((size_t)(p - errbuf) > sizeof(errbuf)) {
|
if ((size_t)(p - errbuf) > sizeof(errbuf)) {
|
||||||
IGNORE_RESULT(write(
|
write(
|
||||||
STDERR_FILENO, OVERFLOW_ERROR, sizeof(OVERFLOW_ERROR) - 1));
|
STDERR_FILENO, OVERFLOW_ERROR, sizeof(OVERFLOW_ERROR) - 1);
|
||||||
abort();
|
abort();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/*-
|
|
||||||
* DBSQL - A SQL database engine.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* There are special exceptions to the terms and conditions of the GPL as it
|
|
||||||
* is applied to this software. View the full text of the exception in file
|
|
||||||
* LICENSE_EXCEPTIONS in the directory of this software distribution.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
|
||||||
#include "dbsql_int.h"
|
|
||||||
#include "db_int.h"
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* __dbsql_exists --
|
|
||||||
* Returns if file exists using the __os_exists call of DB.
|
|
||||||
*
|
|
||||||
* PUBLIC: int __dbsql_exists __P((DBSQL *, const char *, int *));
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
__dbsql_exists(dbp, path, isdirp)
|
|
||||||
DBSQL *dbp;
|
|
||||||
const char *path;
|
|
||||||
int *isdirp;
|
|
||||||
{
|
|
||||||
return (__os_exists((dbp ? dbp->dbenv : NULL), path, isdirp));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* __dbsql_mkdir --
|
|
||||||
* Create a directory using the __os_mkdir call of DB.
|
|
||||||
*
|
|
||||||
* PUBLIC: int __dbsql_mkdir __P((DBSQL *, const char *, int));
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
__dbsql_mkdir(dbp, path, mode)
|
|
||||||
DBSQL *dbp;
|
|
||||||
const char *path;
|
|
||||||
int mode;
|
|
||||||
{
|
|
||||||
return (__os_mkdir((dbp ? dbp->dbenv : NULL), path, mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* __dbsql_omode --
|
|
||||||
* Convert a file mode from a string to an int.
|
|
||||||
*
|
|
||||||
* PUBLIC: int __dbsql_omode __P((DBSQL *, const char *));
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
__dbsql_omode(dbp, mode)
|
|
||||||
DBSQL *dbp;
|
|
||||||
const char *mode;
|
|
||||||
{
|
|
||||||
u_int t;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
|
|
||||||
#define __SETMODE(offset, valid_ch, mask) { \
|
|
||||||
if (mode[offset] == (valid_ch)) \
|
|
||||||
t |= (mask); \
|
|
||||||
else if (mode[offset] != '-') \
|
|
||||||
goto format_err; \
|
|
||||||
}
|
|
||||||
t = 0;
|
|
||||||
__SETMODE(0, 'r', S_IRUSR);
|
|
||||||
__SETMODE(1, 'w', S_IWUSR);
|
|
||||||
__SETMODE(2, 'x', S_IXUSR);
|
|
||||||
__SETMODE(3, 'r', S_IRGRP);
|
|
||||||
__SETMODE(4, 'w', S_IWGRP);
|
|
||||||
__SETMODE(5, 'x', S_IXGRP);
|
|
||||||
__SETMODE(6, 'r', S_IROTH);
|
|
||||||
__SETMODE(7, 'w', S_IWOTH);
|
|
||||||
__SETMODE(8, 'x', S_IXOTH);
|
|
||||||
if (mode[9] != '\0' || t == 0) {
|
|
||||||
/*
|
|
||||||
* We disallow modes of 0 -- we use 0 to decide the application
|
|
||||||
* never configured intermediate directory permissions, and we
|
|
||||||
* shouldn't create intermediate directories. Besides, setting
|
|
||||||
* the permissions to 0 makes no sense.
|
|
||||||
*/
|
|
||||||
|
|
||||||
format_err: __dbsql_err(dbp, "illegal mode \"%s\"", mode);
|
|
||||||
return (EINVAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: hash.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
@ -116,7 +118,10 @@
|
||||||
* PUBLIC: void __hash_init __P((hash_t *, int, int));
|
* PUBLIC: void __hash_init __P((hash_t *, int, int));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__hash_init(hash_t* this, int class, int copy_key_p)
|
__hash_init(this, class, copy_key_p)
|
||||||
|
hash_t *this;
|
||||||
|
int class;
|
||||||
|
int copy_key_p;
|
||||||
{
|
{
|
||||||
DBSQL_ASSERT(this != 0);
|
DBSQL_ASSERT(this != 0);
|
||||||
DBSQL_ASSERT(class >= DBSQL_HASH_INT && class <= DBSQL_HASH_BINARY);
|
DBSQL_ASSERT(class >= DBSQL_HASH_INT && class <= DBSQL_HASH_BINARY);
|
||||||
|
@ -138,7 +143,8 @@ __hash_init(hash_t* this, int class, int copy_key_p)
|
||||||
* PUBLIC: void __hash_clear __P((hash_t *));
|
* PUBLIC: void __hash_clear __P((hash_t *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__hash_clear(hash_t* this)
|
__hash_clear(this)
|
||||||
|
hash_t *this;
|
||||||
{
|
{
|
||||||
hash_ele_t *elem;
|
hash_ele_t *elem;
|
||||||
DBSQL_ASSERT(this != 0);
|
DBSQL_ASSERT(this != 0);
|
||||||
|
@ -317,7 +323,9 @@ static int
|
||||||
* STATIC: static void __rehash __P((hash_t *, int));
|
* STATIC: static void __rehash __P((hash_t *, int));
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
__rehash(hash_t* this, int new_size)
|
__rehash(this, new_size)
|
||||||
|
hash_t *this;
|
||||||
|
int new_size;
|
||||||
{
|
{
|
||||||
struct _ht *new_ht; /* The new hash table */
|
struct _ht *new_ht; /* The new hash table */
|
||||||
hash_ele_t *elem, *next_elem; /* For looping over existing elements */
|
hash_ele_t *elem, *next_elem; /* For looping over existing elements */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: str.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
@ -54,7 +56,7 @@
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990, 1993, 1994, 1995
|
* Copyright (c) 1990, 1993, 1994, 1995
|
||||||
* The Regents of the University of California. All rights reserved.
|
*The Regents of the University of California. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -82,7 +84,7 @@
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995, 1996
|
* Copyright (c) 1995, 1996
|
||||||
* The President and Fellows of Harvard University. All rights reserved.
|
*The President and Fellows of Harvard University. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -95,9 +97,6 @@
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
#include "dbsql_int.h"
|
#include "dbsql_int.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
|
|
||||||
unsigned char __str_upper_to_lower[] = {
|
unsigned char __str_upper_to_lower[] = {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||||
|
@ -187,7 +186,7 @@ __str_nappend(result, va_alist)
|
||||||
size_t len;
|
size_t len;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
char *r;
|
char *r;
|
||||||
unsigned long n;
|
int n;
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -222,15 +221,16 @@ __str_nappend(result, va_alist)
|
||||||
* the quote characters. The conversion is done in-place. If the
|
* the quote characters. The conversion is done in-place. If the
|
||||||
* input does not begin with a quote character, then this routine
|
* input does not begin with a quote character, then this routine
|
||||||
* is a no-op. Quotes can be of the form "'a-b-c'" or the MS-Access style
|
* is a no-op. Quotes can be of the form "'a-b-c'" or the MS-Access style
|
||||||
* brackets around identifiers such as: "[a-b-c]". In both cases the
|
* brackets around identifers such as: "[a-b-c]". In both cases the
|
||||||
* result is "a-b-c".
|
* result is "a-b-c".
|
||||||
*
|
*
|
||||||
* PUBLIC: void __str_unquote __P((char *));
|
* PUBLIC: void __str_unquote __P((char *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__str_unquote(char* z)
|
__str_unquote(z)
|
||||||
|
char *z;
|
||||||
{
|
{
|
||||||
char quote;
|
int quote;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (z == NULL)
|
if (z == NULL)
|
||||||
|
@ -261,20 +261,21 @@ __str_unquote(char* z)
|
||||||
* __str_urealloc --
|
* __str_urealloc --
|
||||||
* Make a duplicate of a string into memory obtained from
|
* Make a duplicate of a string into memory obtained from
|
||||||
* __dbsql_umalloc() Free the original string using __dbsql_free().
|
* __dbsql_umalloc() Free the original string using __dbsql_free().
|
||||||
* This routine is called on all strings that are passed outside
|
* This routine is called on all strings that are passed outside of
|
||||||
* the library. That way clients can free the string using
|
* the library. That way clients can free the string using
|
||||||
* __dbsql_ufree() rather than having to call __dbsql_free().
|
* __dbsql_ufree() rather than having to call __dbsql_free().
|
||||||
*
|
*
|
||||||
* PUBLIC: int __str_urealloc __P((char **));
|
* PUBLIC: int __str_urealloc __P((char **));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_urealloc(char* *pz)
|
__str_urealloc(pz)
|
||||||
|
char **pz;
|
||||||
{
|
{
|
||||||
int rc = DBSQL_SUCCESS;
|
int rc = DBSQL_SUCCESS;
|
||||||
char *new;
|
char *new;
|
||||||
|
|
||||||
if (pz == 0 || *pz == NULL)
|
if (pz == 0 || *pz == NULL)
|
||||||
return rc;
|
return;
|
||||||
|
|
||||||
if (__dbsql_umalloc(NULL, strlen(*pz) + 1, &new) == ENOMEM) {
|
if (__dbsql_umalloc(NULL, strlen(*pz) + 1, &new) == ENOMEM) {
|
||||||
rc = ENOMEM;
|
rc = ENOMEM;
|
||||||
|
@ -296,7 +297,8 @@ __str_urealloc(char* *pz)
|
||||||
* PUBLIC: int __str_is_numeric __P((const char *));
|
* PUBLIC: int __str_is_numeric __P((const char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_is_numeric(const char *z)
|
__str_is_numeric(z)
|
||||||
|
const char *z;
|
||||||
{
|
{
|
||||||
if (*z == '-' || *z == '+')
|
if (*z == '-' || *z == '+')
|
||||||
z++;
|
z++;
|
||||||
|
@ -394,7 +396,7 @@ static int __utf8_to_int(const unsigned char *z) {
|
||||||
* '?' Matches exactly one character.
|
* '?' Matches exactly one character.
|
||||||
*
|
*
|
||||||
* [...] Matches one character from the enclosed list of
|
* [...] Matches one character from the enclosed list of
|
||||||
* characters.
|
* characters.
|
||||||
*
|
*
|
||||||
* [^...] Matches one character not in the enclosed list.
|
* [^...] Matches one character not in the enclosed list.
|
||||||
*
|
*
|
||||||
|
@ -408,17 +410,20 @@ static int __utf8_to_int(const unsigned char *z) {
|
||||||
*
|
*
|
||||||
* Hints: to match '*' or '?', put them in "[]". Like this:
|
* Hints: to match '*' or '?', put them in "[]". Like this:
|
||||||
*
|
*
|
||||||
* abc[*]xyz Matches "abc*xyz" only
|
* abc[*]xyz Matches "abc*xyz" only
|
||||||
*
|
*
|
||||||
* PUBLIC: int __str_glob_cmp __P((const unsigned char *,
|
* PUBLIC: int __str_glob_cmp __P((const unsigned char *,
|
||||||
* PUBLIC: const unsigned char *));
|
* PUBLIC: const unsigned char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_glob_cmp(const unsigned char *pattern, const unsigned char *string)
|
__str_glob_cmp(pattern, string)
|
||||||
|
const unsigned char *pattern;
|
||||||
|
const unsigned char *string;
|
||||||
{
|
{
|
||||||
unsigned char c, c2;
|
char c;
|
||||||
int invert;
|
int invert;
|
||||||
int seen;
|
int seen;
|
||||||
|
char c2;
|
||||||
|
|
||||||
while((c = *pattern) != 0) {
|
while((c = *pattern) != 0) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
|
@ -524,7 +529,9 @@ __str_glob_cmp(const unsigned char *pattern, const unsigned char *string)
|
||||||
* PUBLIC: const unsigned char *));
|
* PUBLIC: const unsigned char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_like_cmp(const unsigned char *pattern, const unsigned char *string)
|
__str_like_cmp(pattern, string)
|
||||||
|
const unsigned char *pattern;
|
||||||
|
const unsigned char *string;
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
int c2;
|
int c2;
|
||||||
|
@ -592,7 +599,9 @@ __str_like_cmp(const unsigned char *pattern, const unsigned char *string)
|
||||||
* PUBLIC: int __str_numeric_cmp __P((const char *, const char *));
|
* PUBLIC: int __str_numeric_cmp __P((const char *, const char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_numeric_cmp(const char *left, const char *right)
|
__str_numeric_cmp(left, right)
|
||||||
|
const char *left;
|
||||||
|
const char *right;
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
int left_is_num, right_is_num;
|
int left_is_num, right_is_num;
|
||||||
|
@ -642,10 +651,10 @@ __str_numeric_cmp(const char *left, const char *right)
|
||||||
* PUBLIC: int __str_int_in32b __P((const char *));
|
* PUBLIC: int __str_int_in32b __P((const char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_int_in32b(const char *num)
|
__str_int_in32b(num)
|
||||||
|
const char *num;
|
||||||
{
|
{
|
||||||
int i = 0;
|
int c, i = 0;
|
||||||
char c;
|
|
||||||
if (*num == '-' || *num == '+')
|
if (*num == '-' || *num == '+')
|
||||||
num++;
|
num++;
|
||||||
while ((c = num[i]) >= '0' && c <= '9') {
|
while ((c = num[i]) >= '0' && c <= '9') {
|
||||||
|
@ -684,7 +693,9 @@ __str_int_in32b(const char *num)
|
||||||
* PUBLIC: void __str_real_as_sortable __P((double, char *));
|
* PUBLIC: void __str_real_as_sortable __P((double, char *));
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
__str_real_as_sortable(double r, char* z)
|
__str_real_as_sortable(r, z)
|
||||||
|
double r;
|
||||||
|
char *z;
|
||||||
{
|
{
|
||||||
int neg;
|
int neg;
|
||||||
int exp;
|
int exp;
|
||||||
|
@ -813,10 +824,13 @@ __str_real_as_sortable(double r, char* z)
|
||||||
* PUBLIC: int __str_cmp __P((const char *, const char *));
|
* PUBLIC: int __str_cmp __P((const char *, const char *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__str_cmp(const char *a, const char *b)
|
__str_cmp(a, b)
|
||||||
|
const char *a;
|
||||||
|
const char *b;
|
||||||
{
|
{
|
||||||
unsigned char dir = 0, res = 0;
|
int res = 0;
|
||||||
int a_numeric_p, b_numeric_p;
|
int a_numeric_p, b_numeric_p;
|
||||||
|
int dir = 0;
|
||||||
|
|
||||||
while(res == 0 && *a && *b) {
|
while(res == 0 && *a && *b) {
|
||||||
if (a[0] == 'N' || b[0] == 'N') {
|
if (a[0] == 'N' || b[0] == 'N') {
|
||||||
|
|
24
src/dbsql.in
24
src/dbsql.in
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql.in 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DBSQL_H_
|
#ifndef _DBSQL_H_
|
||||||
|
@ -26,7 +28,7 @@
|
||||||
#include <stdlib.h> /* Needed for drand48 */
|
#include <stdlib.h> /* Needed for drand48 */
|
||||||
#include <stdarg.h> /* Needed for the definition of va_list */
|
#include <stdarg.h> /* Needed for the definition of va_list */
|
||||||
|
|
||||||
@inttypes_h_decl@
|
@inttypes_decl@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ extern const char dbsql_encoding[];
|
||||||
#define DBSQL_CANTOPEN (-50988)/* Unable to open the database file */
|
#define DBSQL_CANTOPEN (-50988)/* Unable to open the database file */
|
||||||
#define DBSQL_PROTOCOL (-50987)/* Database lock protocol error */
|
#define DBSQL_PROTOCOL (-50987)/* Database lock protocol error */
|
||||||
#define DBSQL_SCHEMA (-50986)/* The database schema changed */
|
#define DBSQL_SCHEMA (-50986)/* The database schema changed */
|
||||||
#define DBSQL_CONSTRAINT (-50985)/* Abort due to constraint violation */
|
#define DBSQL_CONSTRAINT (-50985)/* Abort due to contraint violation */
|
||||||
#define DBSQL_MISMATCH (-50984)/* Data type mismatch */
|
#define DBSQL_MISMATCH (-50984)/* Data type mismatch */
|
||||||
#define DBSQL_MISUSE (-50983)/* Library used incorrectly */
|
#define DBSQL_MISUSE (-50983)/* Library used incorrectly */
|
||||||
#define DBSQL_AUTH (-50982)/* Authorization denied */
|
#define DBSQL_AUTH (-50982)/* Authorization denied */
|
||||||
|
@ -218,14 +220,14 @@ struct __dbsql {
|
||||||
void (*get_errpfx) __P((DBSQL *, const char **));
|
void (*get_errpfx) __P((DBSQL *, const char **));
|
||||||
DB_ENV *(*get_dbenv) __P((DBSQL *));
|
DB_ENV *(*get_dbenv) __P((DBSQL *));
|
||||||
|
|
||||||
/* Callback access functions. */
|
/* Callback access functions. */
|
||||||
void *(*set_tracecall) __P((DBSQL *, void(*)(void *, const char *),\
|
void *(*set_tracecall) __P((DBSQL *, void(*)(void *, const char *),\
|
||||||
void *));
|
void *));
|
||||||
#ifndef DBSQL_NO_PROGRESS
|
#ifndef DBSQL_NO_PROGRESS
|
||||||
void (*set_progresscall) __P((DBSQL *, int, int(*)(void*), void*));
|
void (*set_progresscall) __P((DBSQL *, int, int(*)(void*), void*));
|
||||||
#endif
|
#endif
|
||||||
void *(*set_commitcall) __P((DBSQL *, int(*)(void*), void*));
|
void *(*set_commitcall) __P((DBSQL *, int(*)(void*), void*));
|
||||||
void (*set_busycall) __P((DBSQL *, int(*)(DBSQL *, void *, const char *, int),\
|
void (*set_busycall) __P((DBSQL *, int(*)(int, const char *, int),\
|
||||||
void *));
|
void *));
|
||||||
void (*set_timeout) __P((DBSQL *, int ms));
|
void (*set_timeout) __P((DBSQL *, int ms));
|
||||||
|
|
||||||
|
@ -247,9 +249,9 @@ struct __dbsql {
|
||||||
const char ***));
|
const char ***));
|
||||||
|
|
||||||
int (*create_function) __P((DBSQL *, const char *, int, int, void *,\
|
int (*create_function) __P((DBSQL *, const char *, int, int, void *,\
|
||||||
void (*)(dbsql_func_t *, int, const char**), \
|
void (*)(dbsql_func_t *, int, const char**),\
|
||||||
void (*)(dbsql_func_t *, int, const char**), \
|
void (*)(dbsql_func_t *, int, const char**),\
|
||||||
void (*)(dbsql_func_t *)));
|
void (*)(dbsql_func_t *)));
|
||||||
int (*func_return_type) __P((DBSQL *, const char *, int));
|
int (*func_return_type) __P((DBSQL *, const char *, int));
|
||||||
#define DBSQL_NUMERIC (-1)
|
#define DBSQL_NUMERIC (-1)
|
||||||
#define DBSQL_TEXT (-2)
|
#define DBSQL_TEXT (-2)
|
||||||
|
@ -307,8 +309,8 @@ struct __dbsql {
|
||||||
#define DBSQL_DETACH 25 /* Database Name NULL */
|
#define DBSQL_DETACH 25 /* Database Name NULL */
|
||||||
|
|
||||||
/* Non-callback access functions. */
|
/* Non-callback access functions. */
|
||||||
int (*prepare) __P((DBSQL *, const char *, const char **,\
|
int (*prepare) __P((DBSQL *, const char *, const char **, dbsql_stmt_t **,\
|
||||||
dbsql_stmt_t **, char **));
|
char **));
|
||||||
int (*finalize) __P((dbsql_stmt_t *, char **));
|
int (*finalize) __P((dbsql_stmt_t *, char **));
|
||||||
int (*reset) __P((dbsql_stmt_t *, char **));
|
int (*reset) __P((dbsql_stmt_t *, char **));
|
||||||
int (*bind) __P((dbsql_stmt_t *, int, const char *, int, int));
|
int (*bind) __P((dbsql_stmt_t *, int, const char *, int, int));
|
||||||
|
@ -343,7 +345,7 @@ struct __dbsql {
|
||||||
#define DBSQL_Threaded 0x00000800 /* Set when we're expected to be
|
#define DBSQL_Threaded 0x00000800 /* Set when we're expected to be
|
||||||
thread safe. */
|
thread safe. */
|
||||||
u_int8_t want_to_close; /* Close after all VDBEs are deallocated */
|
u_int8_t want_to_close; /* Close after all VDBEs are deallocated */
|
||||||
u_int32_t next_sig; /* Next value of aDb[0].schema_sig */
|
int next_sig; /* Next value of aDb[0].schema_sig */
|
||||||
int nTable; /* Number of tables in the database */
|
int nTable; /* Number of tables in the database */
|
||||||
void *pBusyArg; /* 1st Argument to the busy callback */
|
void *pBusyArg; /* 1st Argument to the busy callback */
|
||||||
int (*xBusyCallback)(DBSQL *, void *, const char*, int);
|
int (*xBusyCallback)(DBSQL *, void *, const char*, int);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,9 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +33,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
#include "dbsql_int.h"
|
|
||||||
#include "dbsql.h"
|
#include "dbsql.h"
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(WIN32)
|
#if !defined(_WIN32) && !defined(WIN32)
|
||||||
|
@ -52,29 +54,29 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct globals {
|
struct globals {
|
||||||
/* The Berkeley DBSQL database manager. */
|
/* The Berkeley DBSQL database manager. */
|
||||||
DBSQL *dbp;
|
DBSQL *dbp;
|
||||||
|
|
||||||
/* The Berkeley DB database environment. */
|
/* The Berkeley DB database environment. */
|
||||||
DB_ENV *dbenv;
|
DB_ENV *dbenv;
|
||||||
|
|
||||||
/* Non-zero if an interrupt (Control-C) has been received. */
|
/* Non-zero if an interrupt (Control-C) has been received. */
|
||||||
int interrupted_p;
|
int interrupted_p;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is the name of our program. It is set in main(), used
|
* This is the name of our program. It is set in main(), used
|
||||||
* in a number of other places, mostly for error messages.
|
* in a number of other places, mostly for error messages.
|
||||||
*/
|
*/
|
||||||
char *progname;
|
char *progname;
|
||||||
|
|
||||||
/* An output stream for error messages, normally stdout. */
|
/* An output stream for error messages, normally stdout. */
|
||||||
FILE *errfp;
|
FILE *errfp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prompt strings. Initialized in main. Settable using the
|
* Prompt strings. Initialized in main. Settable using the
|
||||||
* '.prompt [main] [continuation]' command.
|
* '.prompt [main] [continuation]' command.
|
||||||
*/
|
*/
|
||||||
char prompt[20]; /* First line prompt. default: "SQL> "*/
|
char prompt[20]; /* First line prompt. default: "SQL> "*/
|
||||||
char prompt2[20]; /* Continuation prompt. default: "...> " */
|
char prompt2[20]; /* Continuation prompt. default: "...> " */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,7 +94,9 @@ extern int isatty();
|
||||||
* is done.
|
* is done.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
local_getline(char* prompt, FILE* in)
|
local_getline(prompt, in)
|
||||||
|
char *prompt;
|
||||||
|
FILE *in;
|
||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
int len;
|
int len;
|
||||||
|
@ -144,7 +148,7 @@ local_getline(char* prompt, FILE* in)
|
||||||
* attempt to use "readline" for command-line editing. If "isatty"
|
* attempt to use "readline" for command-line editing. If "isatty"
|
||||||
* is false, use "local_getline" instead of "readline" and issue no prompt.
|
* is false, use "local_getline" instead of "readline" and issue no prompt.
|
||||||
*
|
*
|
||||||
* prior is a string of prior text retrieved. If not the empty
|
* zPrior is a string of prior text retrieved. If not the empty
|
||||||
* string, then issue a continuation prompt.
|
* string, then issue a continuation prompt.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
|
@ -221,6 +225,11 @@ char *modeDescr[MODE_NUM_OF] = {
|
||||||
"insert"
|
"insert"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Number of elements in an array
|
||||||
|
*/
|
||||||
|
#define ARRAY_SIZE(X) (sizeof(X)/sizeof(X[0]))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Output the given string as a quoted string using SQL quoting conventions.
|
* Output the given string as a quoted string using SQL quoting conventions.
|
||||||
*/
|
*/
|
||||||
|
@ -286,7 +295,8 @@ output_html_string(out, z)
|
||||||
** This routine runs when the user presses Ctrl-C
|
** This routine runs when the user presses Ctrl-C
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
interrupt_handler(int NOT_USED)
|
interrupt_handler(NOT_USED)
|
||||||
|
int NOT_USED;
|
||||||
{
|
{
|
||||||
g.interrupted_p = 1;
|
g.interrupted_p = 1;
|
||||||
if (g.dbp)
|
if (g.dbp)
|
||||||
|
@ -298,7 +308,11 @@ interrupt_handler(int NOT_USED)
|
||||||
* for each row of a query result.
|
* for each row of a query result.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
callback(void* arg, int num_args, char* *args, char* *cols)
|
callback(arg, num_args, args, cols)
|
||||||
|
void *arg;
|
||||||
|
int num_args;
|
||||||
|
char **args;
|
||||||
|
char **cols;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct callback_data *p = (struct callback_data*)arg;
|
struct callback_data *p = (struct callback_data*)arg;
|
||||||
|
@ -357,7 +371,7 @@ callback(void* arg, int num_args, char* *args, char* *cols)
|
||||||
w = 10;
|
w = 10;
|
||||||
}
|
}
|
||||||
fprintf(p->out, "%-*.*s%s", w, w,
|
fprintf(p->out, "%-*.*s%s", w, w,
|
||||||
"----------------------------------------------------------"
|
"----------------------------------------------------------"
|
||||||
"-----------------------------------",
|
"-----------------------------------",
|
||||||
(i == num_args - 1) ?
|
(i == num_args - 1) ?
|
||||||
"\n" : " ");
|
"\n" : " ");
|
||||||
|
@ -503,7 +517,11 @@ set_table_name(p, name)
|
||||||
* This routine should print text sufficient to recreate the table.
|
* This routine should print text sufficient to recreate the table.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
dump_callback(void* arg, int num_args, char* *args, char* *cols)
|
dump_callback(arg, num_args, args, cols)
|
||||||
|
void *arg;
|
||||||
|
int num_args;
|
||||||
|
char **args;
|
||||||
|
char **cols;
|
||||||
{
|
{
|
||||||
struct callback_data *p = (struct callback_data *)arg;
|
struct callback_data *p = (struct callback_data *)arg;
|
||||||
if (num_args != 3)
|
if (num_args != 3)
|
||||||
|
@ -579,7 +597,7 @@ open_db(p)
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(g.errfp, "%s\n", dbsql_strerror(rc));
|
fprintf(g.errfp, dbsql_strerror(rc));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
g.dbenv = p->db->get_dbenv(p->db);
|
g.dbenv = p->db->get_dbenv(p->db);
|
||||||
|
@ -681,7 +699,7 @@ do_meta_command(line, p)
|
||||||
p->db->exec_printf(p->db,
|
p->db->exec_printf(p->db,
|
||||||
"SELECT name, type, sql FROM " MASTER_NAME " "
|
"SELECT name, type, sql FROM " MASTER_NAME " "
|
||||||
"WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL "
|
"WHERE tbl_name LIKE '%q' AND type!='meta' AND sql NOT NULL "
|
||||||
"ORDER BY substr(type,2,1), name",
|
"ORDER BY substr(type,2,1), name",
|
||||||
dump_callback, p,
|
dump_callback, p,
|
||||||
&err_msgs, args[i]);
|
&err_msgs, args[i]);
|
||||||
}
|
}
|
||||||
|
@ -769,7 +787,7 @@ do_meta_command(line, p)
|
||||||
}
|
}
|
||||||
p->show_header = val;
|
p->show_header = val;
|
||||||
} else if (c == 'h' && strncmp(args[0], "help", n) == 0) {
|
} else if (c == 'h' && strncmp(args[0], "help", n) == 0) {
|
||||||
fprintf(stderr, "%s\n", help_message);
|
fprintf(stderr, help_message);
|
||||||
} else if(c == 'i' && strncmp(args[0], "indices", n) == 0 &&
|
} else if(c == 'i' && strncmp(args[0], "indices", n) == 0 &&
|
||||||
num_args > 1) {
|
num_args > 1) {
|
||||||
struct callback_data data;
|
struct callback_data data;
|
||||||
|
@ -850,7 +868,6 @@ do_meta_command(line, p)
|
||||||
if (p->db) {
|
if (p->db) {
|
||||||
p->db->close(p->db);
|
p->db->close(p->db);
|
||||||
}
|
}
|
||||||
free(line);
|
|
||||||
g.dbenv->close(g.dbenv, 0);
|
g.dbenv->close(g.dbenv, 0);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (c == 'r' && strncmp(args[0], "read", n) == 0 &&
|
} else if (c == 'r' && strncmp(args[0], "read", n) == 0 &&
|
||||||
|
@ -1120,9 +1137,9 @@ process_input(p, in)
|
||||||
continue;
|
continue;
|
||||||
if (line && line[0] == '.' && line_len == 0) {
|
if (line && line[0] == '.' && line_len == 0) {
|
||||||
int rc = do_meta_command(line, p);
|
int rc = do_meta_command(line, p);
|
||||||
|
free(line);
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
free(line);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (_is_command_terminator(line)) {
|
if (_is_command_terminator(line)) {
|
||||||
|
@ -1180,7 +1197,7 @@ process_input(p, in)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return a pathname which is the user's home directory. A
|
* Return a pathname which is the user's home directory. A
|
||||||
* NULL return indicates an error of some kind. Space to hold the
|
* 0 return indicates an error of some kind. Space to hold the
|
||||||
* resulting string is obtained from malloc(). The calling
|
* resulting string is obtained from malloc(). The calling
|
||||||
* function should free the result.
|
* function should free the result.
|
||||||
*/
|
*/
|
||||||
|
@ -1220,40 +1237,44 @@ find_home_dir(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read input from the file given by 'path'. Or if that
|
* Read input from the file given by rc_override. Or if that
|
||||||
* parameter is NULL, take input from ~/.dbsqlrc
|
* parameter is NULL, take input from ~/.dbsqlrc
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
process_rc(p, path)
|
process_rc(p, rc_override)
|
||||||
struct callback_data *p; /* Configuration data */
|
struct callback_data *p; /* Configuration data */
|
||||||
const char *path; /* Path to custom config file,
|
const char *rc_override; /* Name of config file. NULL to use
|
||||||
NULL to use default '~/.dbsqlrc' */
|
default */
|
||||||
{
|
{
|
||||||
char *home_dir = NULL;
|
char *home_dir = NULL;
|
||||||
|
const char *rc = rc_override;
|
||||||
char *buf;
|
char *buf;
|
||||||
FILE *in = NULL;
|
FILE *in = NULL;
|
||||||
|
|
||||||
if (path == NULL) {
|
if (rc == NULL) {
|
||||||
home_dir = find_home_dir();
|
home_dir = find_home_dir();
|
||||||
|
if (home_dir == 0) {
|
||||||
|
fprintf(stderr,"%s: unable to locate home directory\n",
|
||||||
|
g.progname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
buf = malloc(strlen(home_dir) + 15);
|
buf = malloc(strlen(home_dir) + 15);
|
||||||
if (buf == NULL) {
|
if (buf == 0) {
|
||||||
fprintf(stderr,"%s: out of memory\n", g.progname);
|
fprintf(stderr,"%s: out of memory\n", g.progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
sprintf(buf,"%s/.dbsqlrc", home_dir);
|
sprintf(buf,"%s/.dbsqlrc", home_dir);
|
||||||
free(home_dir);
|
free(home_dir);
|
||||||
path = (const char*)buf;
|
rc = (const char*)buf;
|
||||||
}
|
}
|
||||||
in = fopen(path, "r");
|
in = fopen(rc, "r");
|
||||||
if (in) {
|
if (in) {
|
||||||
if (isatty(fileno(stdout))) {
|
if (isatty(fileno(stdout))) {
|
||||||
printf("Loading resources from %s\n", path);
|
printf("Loading resources from %s\n", rc);
|
||||||
}
|
}
|
||||||
process_input(p, in);
|
process_input(p, in);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
}
|
}
|
||||||
if (buf == path)
|
|
||||||
free(buf);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,9 +1299,10 @@ static const char options[] =
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
usage(int show_detail)
|
usage(show_detail)
|
||||||
|
int show_detail;
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: dbsql [OPTIONS] FILENAME [SQL]\n");
|
fprintf(stderr, "Usage: db_isql [OPTIONS] FILENAME [SQL]\n");
|
||||||
if (show_detail) {
|
if (show_detail) {
|
||||||
fprintf(stderr, "%s", options);
|
fprintf(stderr, "%s", options);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1306,7 +1328,9 @@ main_init(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char* *argv)
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
{
|
{
|
||||||
char *err_msgs = 0;
|
char *err_msgs = 0;
|
||||||
struct callback_data data;
|
struct callback_data data;
|
||||||
|
@ -1441,13 +1465,9 @@ main(int argc, char* *argv)
|
||||||
printf("%s\nEnter \".help\" for instructions\n",
|
printf("%s\nEnter \".help\" for instructions\n",
|
||||||
dbsql_version(&major, &minor, &patch));
|
dbsql_version(&major, &minor, &patch));
|
||||||
home = find_home_dir();
|
home = find_home_dir();
|
||||||
if (home) {
|
if (home &&
|
||||||
history = malloc(strlen(home) + 20);
|
(history = malloc(strlen(home) + 20)) != 0) {
|
||||||
if (history) {
|
sprintf(history, "%s/.dbsql_history", home);
|
||||||
sprintf(history, "%s/.dbsql_history",
|
|
||||||
home);
|
|
||||||
}
|
|
||||||
free(home);
|
|
||||||
}
|
}
|
||||||
if (history)
|
if (history)
|
||||||
read_history(history);
|
read_history(history);
|
||||||
|
@ -1472,26 +1492,26 @@ main(int argc, char* *argv)
|
||||||
int
|
int
|
||||||
version_check()
|
version_check()
|
||||||
{
|
{
|
||||||
int v_major, v_minor, v_patch;
|
int v_major, v_minor, v_patch;
|
||||||
|
|
||||||
/* Make sure we're loaded with the right version of the DB library. */
|
/* Make sure we're loaded with the right version of the DB library. */
|
||||||
(void)dbsql_version(&v_major, &v_minor, &v_patch);
|
(void)dbsql_version(&v_major, &v_minor, &v_patch);
|
||||||
if (v_major != DBSQL_VERSION_MAJOR || v_minor != DBSQL_VERSION_MINOR) {
|
if (v_major != DBSQL_VERSION_MAJOR || v_minor != DBSQL_VERSION_MINOR) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: version %d.%d doesn't match library version %d.%d\n",
|
"%s: version %d.%d doesn't match library version %d.%d\n",
|
||||||
g.progname, DBSQL_VERSION_MAJOR, DBSQL_VERSION_MINOR,
|
g.progname, DBSQL_VERSION_MAJOR, DBSQL_VERSION_MINOR,
|
||||||
v_major, v_minor);
|
v_major, v_minor);
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we're loaded with the right version of the DB library. */
|
/* Make sure we're loaded with the right version of the DB library. */
|
||||||
(void)db_version(&v_major, &v_minor, &v_patch);
|
(void)db_version(&v_major, &v_minor, &v_patch);
|
||||||
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
|
if (v_major != DB_VERSION_MAJOR || v_minor != DB_VERSION_MINOR) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: version %d.%d doesn't match library version %d.%d\n",
|
"%s: version %d.%d doesn't match library version %d.%d\n",
|
||||||
g.progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
|
g.progname, DB_VERSION_MAJOR, DB_VERSION_MINOR,
|
||||||
v_major, v_minor);
|
v_major, v_minor);
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_tclsh.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -23,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
|
||||||
#include "dbsql_int.h"
|
#include "dbsql_int.h"
|
||||||
#include "tcl.h"
|
#include "tcl.h"
|
||||||
|
|
||||||
|
@ -41,9 +44,9 @@ static char main_loop[] =
|
||||||
"append line [gets stdin]\n"
|
"append line [gets stdin]\n"
|
||||||
"if {[info complete $line]} {\n"
|
"if {[info complete $line]} {\n"
|
||||||
"if {[catch {uplevel #0 $line} result]} {\n"
|
"if {[catch {uplevel #0 $line} result]} {\n"
|
||||||
"puts stderr \"Error: $result\"\n"
|
"puts stderr \"Error: $result\"\n"
|
||||||
"} elseif {$result!=\"\"} {\n"
|
"} elseif {$result!=\"\"} {\n"
|
||||||
"puts $result\n"
|
"puts $result\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"set line {}\n"
|
"set line {}\n"
|
||||||
"} else {\n"
|
"} else {\n"
|
||||||
|
@ -56,7 +59,9 @@ static char main_loop[] =
|
||||||
* main --
|
* main --
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
main(int argc, char* *argv)
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const char *info;
|
const char *info;
|
||||||
|
|
|
@ -26,9 +26,6 @@ void __dbsql_err __P((const DBSQL *, const char *, ...)) __attribute__ ((__forma
|
||||||
void __dbsql_errcall __P((const DBSQL *, int, int, const char *, va_list));
|
void __dbsql_errcall __P((const DBSQL *, int, int, const char *, va_list));
|
||||||
void __dbsql_errfile __P((const DBSQL *, int, int, const char *, va_list));
|
void __dbsql_errfile __P((const DBSQL *, int, int, const char *, va_list));
|
||||||
void __error_msg __P((parser_t *, const char *, ...));
|
void __error_msg __P((parser_t *, const char *, ...));
|
||||||
int __dbsql_exists __P((DBSQL *, const char *, int *));
|
|
||||||
int __dbsql_mkdir __P((DBSQL *, const char *, int));
|
|
||||||
int __dbsql_omode __P((DBSQL *, const char *));
|
|
||||||
void __hash_init __P((hash_t *, int, int));
|
void __hash_init __P((hash_t *, int, int));
|
||||||
void __hash_clear __P((hash_t *));
|
void __hash_clear __P((hash_t *));
|
||||||
void *__hash_find __P((const hash_t *, const void *, int));
|
void *__hash_find __P((const hash_t *, const void *, int));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: db_int.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DB_INT_H_
|
#ifndef _DB_INT_H_
|
||||||
|
@ -32,21 +34,21 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int __db_omode__DB_UNIQUE_NAME__ __P((const char *));
|
|
||||||
extern int __os_calloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, size_t, void *));
|
|
||||||
extern int __os_exists__DB_UNIQUE_NAME__ __P((DB_ENV *, const char *, int *));
|
|
||||||
extern int __os_get_errno__DB_UNIQUE_NAME__ __P((void));
|
|
||||||
extern int __os_id__DB_UNIQUE_NAME__ __P((DB_ENV *, pid_t *, db_threadid_t*));
|
|
||||||
extern int __os_malloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
|
||||||
extern int __os_mkdir__DB_UNIQUE_NAME__ __P((DB_ENV *, const char *, int));
|
|
||||||
extern int __os_realloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
|
||||||
extern int __os_strdup__DB_UNIQUE_NAME__ __P((DB_ENV *, const char *, void *));
|
|
||||||
extern int __os_umalloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
|
||||||
extern int __os_urealloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
|
||||||
extern void *__ua_memcpy__DB_UNIQUE_NAME__ __P((void *, const void *, size_t));
|
extern void *__ua_memcpy__DB_UNIQUE_NAME__ __P((void *, const void *, size_t));
|
||||||
extern void __os_free__DB_UNIQUE_NAME__ __P((DB_ENV *, void *));
|
extern int __os_get_errno__DB_UNIQUE_NAME__ __P((void));
|
||||||
extern void __os_set_errno__DB_UNIQUE_NAME__ __P((int));
|
extern void __os_set_errno__DB_UNIQUE_NAME__ __P((int));
|
||||||
|
extern void __os_sleep__DB_UNIQUE_NAME__ __P((DB_ENV *, u_long, u_long));
|
||||||
|
extern void __os_free__DB_UNIQUE_NAME__ __P((DB_ENV *, void *));
|
||||||
|
extern int __os_realloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
||||||
|
extern int __os_malloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
||||||
|
extern int __os_calloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, size_t, void *));
|
||||||
|
extern int __os_strdup__DB_UNIQUE_NAME__ __P((DB_ENV *, const char *, void *));
|
||||||
extern void __os_ufree__DB_UNIQUE_NAME__ __P((DB_ENV *, void *));
|
extern void __os_ufree__DB_UNIQUE_NAME__ __P((DB_ENV *, void *));
|
||||||
|
extern int __os_urealloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
||||||
|
extern int __os_umalloc__DB_UNIQUE_NAME__ __P((DB_ENV *, size_t, void *));
|
||||||
|
extern int __os_exists__DB_UNIQUE_NAME__ __P((const char *, int *));
|
||||||
|
extern int __db_omode__DB_UNIQUE_NAME__ __P((const char *));
|
||||||
|
extern int __os_id__DB_UNIQUE_NAME__ __P((DB_ENV *, pid_t *, db_threadid_t*));
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,8 @@ void __add_idx_key_type __P((vdbe_t *, index_t *));
|
||||||
void __create_foreign_key __P((parser_t *, id_list_t *, token_t *, id_list_t *, int));
|
void __create_foreign_key __P((parser_t *, id_list_t *, token_t *, id_list_t *, int));
|
||||||
void __defer_foreign_key __P((parser_t *, int));
|
void __defer_foreign_key __P((parser_t *, int));
|
||||||
void __create_index __P((parser_t *, token_t *, src_list_t *, id_list_t *, int, token_t *, token_t *));
|
void __create_index __P((parser_t *, token_t *, src_list_t *, id_list_t *, int, token_t *, token_t *));
|
||||||
void __drop_index __P((parser_t *, src_list_t *));
|
|
||||||
id_list_t *__id_list_append __P((id_list_t *, token_t *));
|
id_list_t *__id_list_append __P((id_list_t *, token_t *));
|
||||||
src_list_t *__src_list_append __P((src_list_t *, token_t *, token_t *));
|
src_list_t *__src_list_append __P((src_list_t *, token_t *, token_t *));
|
||||||
void __src_list_assign_cursors __P((parser_t *, src_list_t *));
|
|
||||||
void __src_list_add_alias __P((src_list_t *, token_t *));
|
void __src_list_add_alias __P((src_list_t *, token_t *));
|
||||||
void __id_list_delete __P((id_list_t *));
|
void __id_list_delete __P((id_list_t *));
|
||||||
int __id_list_index __P((id_list_t *, const char *));
|
int __id_list_index __P((id_list_t *, const char *));
|
||||||
|
@ -121,7 +119,6 @@ void __vdbe_delete_trigger __P((trigger_t *));
|
||||||
void __drop_trigger __P((parser_t *, src_list_t *));
|
void __drop_trigger __P((parser_t *, src_list_t *));
|
||||||
void __drop_trigger_ptr __P((parser_t *, trigger_t *, int));
|
void __drop_trigger_ptr __P((parser_t *, trigger_t *, int));
|
||||||
int __triggers_exist __P((parser_t *, trigger_t *, int, int, int, expr_list_t *));
|
int __triggers_exist __P((parser_t *, trigger_t *, int, int, int, expr_list_t *));
|
||||||
int __code_row_trigger __P(());
|
|
||||||
void __update __P((parser_t *, src_list_t *, expr_list_t *, expr_t *, int));
|
void __update __P((parser_t *, src_list_t *, expr_list_t *, expr_t *, int));
|
||||||
void __vacuum __P((parser_t *, token_t *));
|
void __vacuum __P((parser_t *, token_t *));
|
||||||
int __execute_vacuum __P((char **, DBSQL *));
|
int __execute_vacuum __P((char **, DBSQL *));
|
||||||
|
@ -163,7 +160,7 @@ int __sm_get_format_version __P((sm_t *, u_int32_t *));
|
||||||
int __sm_set_schema_sig __P((sm_t *, u_int32_t));
|
int __sm_set_schema_sig __P((sm_t *, u_int32_t));
|
||||||
int __sm_get_schema_sig __P((sm_t *, u_int32_t *));
|
int __sm_get_schema_sig __P((sm_t *, u_int32_t *));
|
||||||
void __register_builtin_funcs __P((DBSQL *));
|
void __register_builtin_funcs __P((DBSQL *));
|
||||||
int __get_keyword_code __P((const char *, int));
|
int get_keyword_code __P((const char *, int));
|
||||||
int __run_sql_parser __P((parser_t *, const char *, char **));
|
int __run_sql_parser __P((parser_t *, const char *, char **));
|
||||||
int __api_step __P((dbsql_stmt_t *, int *, const char ***, const char ***));
|
int __api_step __P((dbsql_stmt_t *, int *, const char ***, const char ***));
|
||||||
int __vdbe_exec __P((vdbe_t *));
|
int __vdbe_exec __P((vdbe_t *));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: dbsql_int.in 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DBSQL_INT_H_
|
#ifndef _DBSQL_INT_H_
|
||||||
|
@ -183,20 +185,20 @@ typedef struct sm_cursor {
|
||||||
* the ATTACH statement during the session.
|
* the ATTACH statement during the session.
|
||||||
*/
|
*/
|
||||||
struct __dbsql_db {
|
struct __dbsql_db {
|
||||||
char *zName; /* Name of this database */
|
char *zName; /* Name of this database */
|
||||||
sm_t *pBt; /* The storage manager for this database */
|
sm_t *pBt; /* The storage manager for this database */
|
||||||
u_int32_t schema_sig; /* Database schema version number for this file */
|
int schema_sig; /* Database schema version number for this file */
|
||||||
hash_t tblHash; /* All tables indexed by name */
|
hash_t tblHash; /* All tables indexed by name */
|
||||||
hash_t idxHash; /* All (named) indices indexed by name */
|
hash_t idxHash; /* All (named) indices indexed by name */
|
||||||
hash_t trigHash; /* All triggers indexed by name */
|
hash_t trigHash; /* All triggers indexed by name */
|
||||||
hash_t aFKey; /* Foreign keys indexed by to-table */
|
hash_t aFKey; /* Foreign keys indexed by to-table */
|
||||||
int inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */
|
int inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */
|
||||||
DBSQL *dbp; /* A reference to our managing DBSQL */
|
DBSQL *dbp; /* A reference to our managing DBSQL */
|
||||||
int flags; /* Flags associated with this database */
|
int flags; /* Flags associated with this database */
|
||||||
/*
|
/*
|
||||||
* The DBSQL_SCHEMA_LOCKED flag is set when the first OP_Transaction or
|
* The DBSQL_SCHEMA_LOCKED flag is set when the first OP_Transaction or
|
||||||
* OP_Checkpoint opcode is emitted for a database. This prevents multiple
|
* OP_Checkpoint opcode is emitted for a database. This prevents multiple
|
||||||
* occurrences of those opcodes for the same database in the same program.
|
* occurances of those opcodes for the same database in the same program.
|
||||||
* TODO: do we need this?
|
* TODO: do we need this?
|
||||||
*
|
*
|
||||||
* Similarly, the DBSQL_COOKIE flag is set when the OP_VerifyCookie opcode
|
* Similarly, the DBSQL_COOKIE flag is set when the OP_VerifyCookie opcode
|
||||||
|
@ -247,7 +249,7 @@ struct __dbsql_db {
|
||||||
/*
|
/*
|
||||||
* Aligning items to particular sizes or in pages or memory.
|
* Aligning items to particular sizes or in pages or memory.
|
||||||
*
|
*
|
||||||
* uintmax_t --
|
* db_align_t --
|
||||||
* Largest integral type, used to align structures in memory. We don't store
|
* Largest integral type, used to align structures in memory. We don't store
|
||||||
* floating point types in structures, so integral types should be sufficient
|
* floating point types in structures, so integral types should be sufficient
|
||||||
* (and we don't have to worry about systems that store floats in other than
|
* (and we don't have to worry about systems that store floats in other than
|
||||||
|
@ -256,29 +258,26 @@ struct __dbsql_db {
|
||||||
* that happen to require alignment. Note: this alignment isn't sufficient for
|
* that happen to require alignment. Note: this alignment isn't sufficient for
|
||||||
* mutexes, which depend on things like cache line alignment. Mutex alignment
|
* mutexes, which depend on things like cache line alignment. Mutex alignment
|
||||||
* is handled separately, in mutex.h.
|
* is handled separately, in mutex.h.
|
||||||
*/
|
|
||||||
@uintmax_t_decl@
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
*
|
||||||
* uintptr_t --
|
* db_alignp_t --
|
||||||
* Integral type that's the same size as a pointer. There are places where
|
* Integral type that's the same size as a pointer. There are places where
|
||||||
* DB modifies pointers by discarding the bottom bits to guarantee alignment.
|
* DB modifies pointers by discarding the bottom bits to guarantee alignment.
|
||||||
* We can't use uintmax_t, it may be larger than the pointer, and compilers
|
* We can't use db_align_t, it may be larger than the pointer, and compilers
|
||||||
* get upset about that. So far we haven't run on any machine where there
|
* get upset about that. So far we haven't run on any machine where there
|
||||||
* isn't an integral type the same size as a pointer -- here's hoping.
|
* isn't an integral type the same size as a pointer -- here's hoping.
|
||||||
*/
|
*/
|
||||||
@uintptr_t_decl@
|
@db_align_t_decl@
|
||||||
|
@db_alignp_t_decl@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a pointer to a small integral value.
|
* Convert a pointer to a small integral value.
|
||||||
*
|
*
|
||||||
* The (u_int16_t)(uintptr_t) cast avoids warnings: the (uintptr_t) cast
|
* The (u_int16_t)(db_alignp_t) cast avoids warnings: the (db_alignp_t) cast
|
||||||
* converts the value to an integral type, and the (u_int16_t) cast converts
|
* converts the value to an integral type, and the (u_int16_t) cast converts
|
||||||
* it to a small integral type so we don't get complaints when we assign the
|
* it to a small integral type so we don't get complaints when we assign the
|
||||||
* final result to an integral type smaller than uintptr_t.
|
* final result to an integral type smaller than db_alignp_t.
|
||||||
*/
|
*/
|
||||||
#define P_TO_UINT32(p) ((u_int32_t)(uintptr_t)(p))
|
#define P_TO_UINT32(p) ((u_int32_t)(db_alignp_t)(p))
|
||||||
|
|
||||||
#define PATH_SEPARATOR "@PATH_SEPARATOR@"
|
#define PATH_SEPARATOR "@PATH_SEPARATOR@"
|
||||||
|
|
||||||
|
@ -292,10 +291,10 @@ struct func_def {
|
||||||
void (*xFunc)(dbsql_func_t*,int,const char**); /* Regular fn */
|
void (*xFunc)(dbsql_func_t*,int,const char**); /* Regular fn */
|
||||||
void (*xStep)(dbsql_func_t*,int,const char**); /* Aggregate fn step */
|
void (*xStep)(dbsql_func_t*,int,const char**); /* Aggregate fn step */
|
||||||
void (*xFinalize)(dbsql_func_t*); /* Aggregate fn finializer */
|
void (*xFinalize)(dbsql_func_t*); /* Aggregate fn finializer */
|
||||||
int nArg; /* Number of arguments */
|
int nArg; /* Number of arguments */
|
||||||
int dataType; /* Datatype of the result */
|
int dataType; /* Datatype of the result */
|
||||||
void *pUserData; /* User data parameter */
|
void *pUserData; /* User data parameter */
|
||||||
func_def_t *pNext; /* Next function with same name. */
|
func_def_t *pNext; /* Next function with same name. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2004
|
* Copyright (c) 1998-2004
|
||||||
* Sleepycat Software. All rights reserved.
|
* Sleepycat Software. All rights reserved.
|
||||||
|
*
|
||||||
|
* $Id: debug.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _DBSQL_DEBUG_H_
|
#ifndef _DBSQL_DEBUG_H_
|
||||||
|
@ -37,16 +39,10 @@ extern "C" {
|
||||||
#define DBSQL_ASSERT(e)
|
#define DBSQL_ASSERT(e)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Purposly ignore return value.
|
|
||||||
*/
|
|
||||||
#define IGNORE_RESULT(x) \
|
|
||||||
(void)!(x)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "Shut that bloody compiler up!"
|
* "Shut that bloody compiler up!"
|
||||||
*
|
*
|
||||||
* Unused, or not-usedyet variable. We need to write and then read the
|
* Unused, or not-used-yet variable. We need to write and then read the
|
||||||
* variable, some compilers are too bloody clever by half.
|
* variable, some compilers are too bloody clever by half.
|
||||||
*/
|
*/
|
||||||
#define COMPQUIET(n, v) \
|
#define COMPQUIET(n, v) \
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1996-2004
|
* Copyright (c) 1996-2004
|
||||||
* Sleepycat Software. All rights reserved.
|
* Sleepycat Software. All rights reserved.
|
||||||
|
*
|
||||||
|
* $Id: globals.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************
|
/*******************************************************
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: hash.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
|
|
@ -7,7 +7,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int __os_jtime __P((double *));
|
int __os_jtime __P((double *));
|
||||||
void __os_sleep __P((u_long secs, u_long usecs));
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: random.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LRAND48_R_H_
|
#ifndef _LRAND48_R_H_
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: str.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1990-2004
|
* Copyright (c) 1990-2004
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: vdbe.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _VDBE_H_
|
#ifndef _VDBE_H_
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: vdbe_int.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _VDBE_INT_H_
|
#ifndef _VDBE_INT_H_
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: xvprintf.h 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XVPRINTF_H_
|
#ifndef _XVPRINTF_H_
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Driver template for the LEMON parser generator.
|
/* Driver template for the LEMON parser generator.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*-
|
/*-
|
||||||
* DBSQL - A SQL database engine.
|
* DBSQL - A SQL database engine.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
* Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or modify
|
* This library is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -16,6 +16,8 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* General Public License for more details.
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* $Id: os_jtime.c 7 2007-02-03 13:34:17Z gburd $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
#include "dbsql_config.h"
|
||||||
|
@ -47,7 +49,8 @@ int _fake_current_time = 0;
|
||||||
* PUBLIC: int __os_jtime __P((double *));
|
* PUBLIC: int __os_jtime __P((double *));
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
__os_jtime(double* result)
|
__os_jtime(result)
|
||||||
|
double *result;
|
||||||
{
|
{
|
||||||
#ifndef DB_WIN32
|
#ifndef DB_WIN32
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*-
|
|
||||||
* DBSQL - A SQL database engine.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* There are special exceptions to the terms and conditions of the GPL as it
|
|
||||||
* is applied to this software. View the full text of the exception in file
|
|
||||||
* LICENSE_EXCEPTIONS in the directory of this software distribution.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dbsql_config.h"
|
|
||||||
|
|
||||||
#ifndef NO_SYSTEM_INCLUDES
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "dbsql_int.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* __os_sleep --
|
|
||||||
* Pause the thread of control.
|
|
||||||
*
|
|
||||||
* PUBLIC: void __os_sleep __P((u_long secs, u_long usecs));
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
__os_sleep(u_long secs, u_long usecs)
|
|
||||||
{
|
|
||||||
/* Calculate the total time in microseconds */
|
|
||||||
u_long total_usecs = secs * 1000000 + usecs;
|
|
||||||
|
|
||||||
/* Convert microseconds to seconds and microseconds */
|
|
||||||
u_long sleep_secs = total_usecs / 1000000;
|
|
||||||
u_long sleep_usecs = total_usecs % 1000000;
|
|
||||||
|
|
||||||
// Sleep using the standard POSIX sleep function
|
|
||||||
struct timespec req;
|
|
||||||
struct timespec rem = { 0 };
|
|
||||||
req.tv_sec = sleep_secs;
|
|
||||||
req.tv_nsec = sleep_usecs * 1000;
|
|
||||||
|
|
||||||
/* Handle potential interruption by signals */
|
|
||||||
while (nanosleep(&req, &rem) != 0 && errno == EINTR) {
|
|
||||||
req = rem;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
# DBSQL - A SQL database engine.
|
# DBSQL - A SQL database engine.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007-2008 The DBSQL Group, Inc. - All rights reserved.
|
# Copyright (C) 2007 The DBSQL Group, Inc. - All rights reserved.
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public
|
# modify it under the terms of the GNU General Public
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue