Fix for Postgres 7.0 -- insert verion values after table is created.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5439 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-28 11:57:53 +00:00
parent dacb6a0671
commit 40792644bf
6 changed files with 34 additions and 6 deletions

View File

@ -12,3 +12,4 @@ kvp-autogen.c
table-audit.c
table-create.c
table-drop.c
table-version.c

View File

@ -1,4 +1,4 @@
SUBDIRS=test
SUBDIRS = . test
pkglib_LTLIBRARIES = libgncmod-backend-postgres.la
libgncmod_backend_postgres_la_LDFLAGS =-module -lpq -L../../engine -L../../engine/.libs -lgncmod-engine ${GLIB_LIBS}
@ -45,6 +45,7 @@ EXTRA_DIST = \
table-audit.sql \
table-create.sql \
table-drop.sql \
table-version.sql \
demo.c
INCLUDES = -I.. -I../.. -I../../engine -I../../gnc-module
@ -53,8 +54,8 @@ CFLAGS = @CFLAGS@ ${GLIB_CFLAGS}
# Some of the required C files are built with the m4 pre-processor
# As a result, we need to manually specify dependencies, clean targets.
PostgresBackend.o: base-autogen.c table-audit.c table-create.c table-drop.c functions.c
PostgresBackend.lo: base-autogen.c table-audit.c table-create.c table-drop.c functions.c
PostgresBackend.o: base-autogen.c table-audit.c table-create.c table-version.c table-drop.c functions.c
PostgresBackend.lo: base-autogen.c table-audit.c table-create.c table-version.c table-drop.c functions.c
checkpoint.o: check-autogen.c
checkpoint.lo: check-autogen.c
@ -95,8 +96,13 @@ table-drop.c: table-drop.sql
cat table-drop.sql >> table-drop.c
echo \" >> table-drop.c
table-version.c: table-version.sql
echo \" > table-version.c
echo "-- DO NOT EDIT THIS FILE. IT IS AUTOGENERATED." >> table-version.c
cat table-version.sql >> table-version.c
echo \" >> table-version.c
clean:
-rm -f base-autogen.c check-autogen.c kvp-autogen.c
-rm -f table-drop.c table-create.c functions.c
-rm -f table-drop.c table-create.c table-version.c functions.c

View File

@ -215,6 +215,10 @@ static const char *table_create_str =
#include "table-create.c"
;
static const char *table_version_str =
#include "table-version.c"
;
static const char *sql_functions_str =
#include "functions.c"
;
@ -1647,6 +1651,8 @@ pgend_session_begin (Backend *backend, GNCBook *book, const char * sessionid,
*/
SEND_QUERY (be,table_create_str, );
FINISH_QUERY(be->connection);
SEND_QUERY (be,table_version_str, );
FINISH_QUERY(be->connection);
SEND_QUERY (be,table_audit_str, );
FINISH_QUERY(be->connection);
SEND_QUERY (be,sql_functions_str, );

View File

@ -29,8 +29,6 @@ CREATE TABLE gncVersion (
name TEXT UNIQUE NOT NULL CHECK (name <> ''),
date DATETIME DEFAULT 'NOW'
);
INSERT INTO gncVersion (major,minor,rev,name) VALUES (1,0,0,'Version Table');
INSERT INTO gncVersion (major,minor,rev,name) VALUES (1,1,1,'iGUID in Main Tables');
-- Commodity structure
-- Store currency, security types. Namespace includes

View File

@ -0,0 +1,16 @@
--
-- FILE:
-- table-version.sql
--
-- FUNCTION:
-- Insert the latest version information into the gncVersion table.
--
-- Inserting in the same query as creating the table does not
-- work under Postgres 7.0
--
-- HISTORY:
-- Copyright (C) 2001 Linux Developers Group
--
INSERT INTO gncVersion (major,minor,rev,name) VALUES (1,0,0,'Version Table');
INSERT INTO gncVersion (major,minor,rev,name) VALUES (1,1,1,'iGUID in Main Tables');

View File

@ -17,6 +17,7 @@ LDADD = -L${top_srcdir}/src/gnc-module -L${top_srcdir}/src/gnc-module/.libs \
${top_srcdir}/src/gnc-module/libgncmodule.la \
${top_srcdir}/src/engine/libgncmod-engine.la \
${top_srcdir}/src/engine/test-core/libgncmod-test-engine.la \
${top_srcdir}/src/backend/postgres/libgncmod-backend-postgres.la \
-lltdl
CFLAGS = ${GLIB_CFLAGS}