From Stefan.Manegold@cwi.nl Mon Sep 24 02:19:20 2007 From: Stefan Manegold To: developers-list@monetdb.org Subject: Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/src/sqlhelpers/db2tools common.inc, XQuery_0-20, NONE, 1.1.2.1 load, XQuery_0-20, NONE, 1.1.2.1 table, XQuery_0-20, NONE, 1.1.2.1 Date: Mon, 24 Sep 2007 11:19:09 +0200 Message-ID: <20070924091909.GA15291@cwi.nl> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8346253239392813104==" --===============8346253239392813104== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To ensure a smooth finalization of our combined effort to get the upcoming release out "as fast as possible" and without any self-made hurdles, I assume that adding these new "feature(s)" in the *release branch* has been coordinated with Sjoerd, right? (In particular wrt. how/where they need to be added to the source and in particular binary packages, documentation, and which platforms they are targeted for (Windows??).) Greetings from Vienna, Stefan On Mon, Sep 24, 2007 at 09:10:33AM +0000, Manuel Mayr wrote: > Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/db2tools > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18874 >=20 > Added Files: > Tag: XQuery_0-20 > common.inc load table=20 > Log Message: >=20 >=20 > Shell scripts to create tables, and load content for SQL-backend >=20 >=20 > --- NEW FILE: load --- > #!/bin/sh >=20 > THIS=3D${0} > THISDIR=3D${0%/*} > THISFILE=3D${0##*/} > DB2=3D`which db2` >=20 > source common.inc >=20 > ################################################ > # FUNCTIONS >=20 > function load_table { > #check parameter list > if [ ${#} -ne 3 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${2} > FILE=3D${1} > TABLE=3D${3} > =20 > # set schema to ours=20 > ${DB2} "set current schema ${SCHEMA}" >=20 > # create the names-table=20 > ${DB2} -t< LOAD FROM ${FILE} OF DEL > MODIFIED BY DELPRIORITYCHAR=20 > REPLACE INTO ${TABLE}=20 > NONRECOVERABLE > INDEXING MODE rebuild; > EOT >=20 > ${DB2} "SET INTEGRITY FOR ${TABLE} IMMEDIATE CHECKED"=20 > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function print_help () { > out "Pathfinder XQuery" > out "(c) Database Group, Technische Universitaet Muenchen" > out ""=20 > out "Usage: ${THISFILE} (create|drop) " > out "" > out -e "\t:\t\tName of the Database the content should be placed/re= moved." > out -e "\t:\tName of the Schema the content should be placed/re= moved." > out -e "\t:\tNames file" > out -e "\t:\tEncoded document" > } >=20 > ################################################ > # MAIN >=20 > if [ $# -ne 4 ]; then > print_help; > exit 0; > fi =20 >=20 > DATABASE=3D${1} > SCHEMA=3D${2} > NFILE=3D${3} > LFILE=3D${4} >=20 > ${DB2} "connect to ${DATABASE}" >=20 > EFLAG=3D${?} > out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >=20 > test ${EFLAG} -ne 0 && exit 1; >=20 > load_table "${NFILE}" "${SCHEMA}" "${TAB_NAMES}"; > EFLAG=3D${?}; > out -ne "Loading ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >=20 > load_table ${LFILE} "${SCHEMA}" "${TAB_DOC}"; > EFLAG=3D${?}; > out -ne "Loading ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >=20 > ${DB2} "terminate" >=20 > --- NEW FILE: table --- > #!/bin/sh >=20 > THIS=3D${0} > THISDIR=3D${0%/*} > THISFILE=3D${0##*/} > DB2=3D`which db2` >=20 > source common.inc >=20 > ################################################ > # FUNCTIONS >=20 > function create_names { > #check parameter list > if [ ${#} -ne 2 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} > TABNAME=3D${2} > =20 > # set schema to ours=20 > ${DB2} "set current schema ${SCHEMA}" >=20 > # create the names-table=20 > ${DB2} -t< CREATE TABLE ${TABNAME}(nameid INT NOT NULL PRIMARY KEY, > name VARCHAR(32) NOT NULL); > EOT > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function create_doc { > #check parameter list > if [ ${#} -ne 3 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} > TABNAME=3D${2} > NAMESNAME=3D${3} >=20 > ${DB2} "set current schema ${SCHEMA}" > =20 > ${DB2} -t< CREATE TABLE ${TABNAME}(pre INT NOT NULL PRIMARY KEY, > size INT NOT NULL, > level SMALLINT NOT NULL, > kind SMALLINT, > nameid INT, > value VARCHAR(100), > guide INT NOT NULL, > FOREIGN KEY (nameid) references ${NAMESNAME}(nameid)); > EOT > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function create_xmldoc { > #check parameter list > if [ ${#} -ne 4 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} > TABNAME=3D${2} > DOCNAME=3D${3} > NAMENAME=3D${4} >=20 > ${DB2} "set current schema ${SCHEMA}" >=20 > ${DB2} -t< CREATE VIEW ${TABNAME}(pre, size, level, kind, guide, > nameid, value, name) AS > (SELECT pre, size, level, kind, guide, > doc.nameid, value, name > FROM ${DOCNAME} AS doc > LEFT OUTER JOIN > ${NAMESNAME} AS names > ON doc.nameid =3D names.nameid); > EOT > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function drop_table { > #check parameter list > if [ ${#} -ne 1 ]; then > error "Usage: ${0}
" > fi >=20 > TABLE=3D${1} >=20 > ${DB2} "drop table ${TABLE}"=20 > } >=20 > function drop_names { > #check parameter list > if [ ${#} -ne 1 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} >=20 > ${DB2} "set current schema ${SCHEMA}" > drop_table "${TAB_NAMES}"=20 > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function drop_doc { > #check parameter list > if [ ${#} -ne 1 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} >=20 > ${DB2} "set current schema ${SCHEMA}" > drop_table "${TAB_DOC}" > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function drop_xmldoc { > #check parameter list > if [ ${#} -ne 1 ]; then > error "Usage: ${0} " > fi >=20 > SCHEMA=3D${1} >=20 > ${DB2} "set current schema ${SCHEMA}" > ${DB2} "drop view xmldoc" > EFLAG=3D${?} > return ${EFLAG} > } >=20 > function print_help () { > out "Pathfinder XQuery" > out "(c) Database Group, Technische Universitaet Muenchen" > out ""=20 > out "Usage: $THISFILE (create|drop) "=20 > out "" > out -e "\t(create|drop):\teither create or drop the tables " > out -e "\t:\t\tName of the Database the tables should be placed/rem= oved." > out -e "\t:\tName of the Schema the tables should be placed/rem= oved." > } >=20 > ################################################ > # MAIN >=20 > if [ $# -ne 3 ]; then > print_help; > exit 0; > fi =20 >=20 > OPTION=3D${1} > DATABASE=3D${2} > SCHEMA=3D${3} >=20 > ${DB2} "connect to ${DATABASE}" > EFLAG=3D$? > out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 > test $EFLAG -ne 0 && exit 1; >=20 > case ${OPTION} in > create) create_names ${SCHEMA} ${TAB_NAMES}; > EFLAG=3D${?}; > out -ne "Creating ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >=20 > create_doc ${SCHEMA} ${TAB_DOC} ${TAB_NAMES}; > EFLAG=3D${?}; > out -ne "Creating ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >=20 > create_xmldoc ${SCHEMA} ${TAB_XMLDOC} ${TAB_DOC} ${TAB_NAMES}; > EFLAG=3D${?}; > out -ne "Creating ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; > ;; >=20 > drop) drop_xmldoc ${SCHEMA} > EFLAG=3D${?} > out -ne "Dropping ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >=20 > drop_doc ${SCHEMA} > EFLAG=3D${?} > out -ne "Dropping ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >=20 > drop_names ${SCHEMA} > EFLAG=3D${?} > out -ne "Dropping ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; > ;; > *) print_help;=20 > exit 1; > ;; > esac > ${DB2} "terminate" >=20 > --- NEW FILE: common.inc --- > DEBUG=3D0 >=20 > TAB_NAMES=3D"names" > TAB_DOC=3D"doc" > TAB_XMLDOC=3D"xmldoc" >=20 > DB2=3D`which db2` >=20 > function fail { > if [ ${#} -ne 1 ]; then > error "Wrong use of fail" > fi >=20 > if [ ${1} -eq 0 ]; then > out "Success" > return 0; > else > out "Failed" > return 0; > fi > } >=20 > function error { > if [ ${#} -ne 1 ]; then > echo "Wrong use of error" > exit 1; > fi > echo -e "Error: ${1}" > exit 1 > } >=20 > function warning > { > if [ ${#} -ne 1 ]; then > error "Wrong use of debug" > fi > echo -e "Warning: ${1}" > } >=20 > function out { > if [ ${#} -eq 1 ]; then > echo -e "${1}" > return 0; > fi > if [ ${#} -eq 2 ]; then > echo "${1}" "${2}" > else > error "wrong use of out" > fi > } >=20 > function debug { > if [ ${#} -ne 1 ]; then > error "Wrong use of debug" > fi > test ${DEBUG} -eq 1 && echo -e "Debug: ${1}" > } >=20 > function LOG1 { > prompt=3D"\n# `date +%H:%M:%S` > "; { echo -en "$prompt$prompt" ; echo= -n "$*" ; echo -en "$prompt\n\n" ; } >&2; > } >=20 > function getAbsolutePath { > if [ -z ${1} ]; then > error "Wrong use of ${0}"; > fi >=20 > PATH_=3D${1%/*} > FILE_=3D${1##*/} >=20 > echo `cd ${PATH_} 2> /dev/null && pwd || echo ${PATH_}`/${FILE_} > } >=20 > test -z $DB2 && error "DB2 not available"; >=20 >=20 > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Monetdb-pf-checkins mailing list > Monetdb-pf-checkins(a)lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins >=20 --=20 | Dr. Stefan Manegold | mailto:Stefan.Manegold(a)cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 | --===============8346253239392813104==-- From mayrm@in.tum.de Mon Sep 24 03:03:58 2007 From: Manuel Mayr To: developers-list@monetdb.org Subject: Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/src/sqlhelpers/db2tools common.inc, XQuery_0-20, NONE, 1.1.2.1 load, XQuery_0-20, NONE, 1.1.2.1 table, XQuery_0-20, NONE, 1.1.2.1 Date: Mon, 24 Sep 2007 12:05:23 +0200 Message-ID: <46F78BE3.4060700@in.tum.de> In-Reply-To: <20070924091909.GA15291@cwi.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1981191601871586743==" --===============1981191601871586743== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable First of all those scripts don't offer new features or functionality. They only provide facilities to create tables and content for the SQL backend. We want to add them to the bindir, only for unix like platforms, since both are shell scripts. Best regards, Manuel Stefan Manegold wrote: > To ensure a smooth finalization of our combined effort to get the upcoming > release out "as fast as possible" and without any self-made hurdles, I > assume that adding these new "feature(s)" in the *release branch* has been > coordinated with Sjoerd, right? > (In particular wrt. how/where they need to be added to the source and > in particular binary packages, documentation, and which platforms they are > targeted for (Windows??).) > > Greetings from Vienna, > > Stefan > > On Mon, Sep 24, 2007 at 09:10:33AM +0000, Manuel Mayr wrote: > =20 >> Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/db2tools >> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18874 >> >> Added Files: >> Tag: XQuery_0-20 >> common.inc load table=20 >> Log Message: >> >> >> Shell scripts to create tables, and load content for SQL-backend >> >> >> --- NEW FILE: load --- >> #!/bin/sh >> >> THIS=3D${0} >> THISDIR=3D${0%/*} >> THISFILE=3D${0##*/} >> DB2=3D`which db2` >> >> source common.inc >> >> ################################################ >> # FUNCTIONS >> >> function load_table { >> #check parameter list >> if [ ${#} -ne 3 ]; then >> error "Usage: ${0}
" >> fi >> >> SCHEMA=3D${2} >> FILE=3D${1} >> TABLE=3D${3} >> =20 >> # set schema to ours=20 >> ${DB2} "set current schema ${SCHEMA}" >> >> # create the names-table=20 >> ${DB2} -t<> LOAD FROM ${FILE} OF DEL >> MODIFIED BY DELPRIORITYCHAR=20 >> REPLACE INTO ${TABLE}=20 >> NONRECOVERABLE >> INDEXING MODE rebuild; >> EOT >> >> ${DB2} "SET INTEGRITY FOR ${TABLE} IMMEDIATE CHECKED"=20 >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function print_help () { >> out "Pathfinder XQuery" >> out "(c) Database Group, Technische Universitaet Muenchen" >> out ""=20 >> out "Usage: ${THISFILE} (create|drop) " >> out "" >> out -e "\t:\t\tName of the Database the content should be placed/r= emoved." >> out -e "\t:\tName of the Schema the content should be placed/r= emoved." >> out -e "\t:\tNames file" >> out -e "\t:\tEncoded document" >> } >> >> ################################################ >> # MAIN >> >> if [ $# -ne 4 ]; then >> print_help; >> exit 0; >> fi =20 >> >> DATABASE=3D${1} >> SCHEMA=3D${2} >> NFILE=3D${3} >> LFILE=3D${4} >> >> ${DB2} "connect to ${DATABASE}" >> >> EFLAG=3D${?} >> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >> >> test ${EFLAG} -ne 0 && exit 1; >> >> load_table "${NFILE}" "${SCHEMA}" "${TAB_NAMES}"; >> EFLAG=3D${?}; >> out -ne "Loading ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >> >> load_table ${LFILE} "${SCHEMA}" "${TAB_DOC}"; >> EFLAG=3D${?}; >> out -ne "Loading ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >> >> ${DB2} "terminate" >> >> --- NEW FILE: table --- >> #!/bin/sh >> >> THIS=3D${0} >> THISDIR=3D${0%/*} >> THISFILE=3D${0##*/} >> DB2=3D`which db2` >> >> source common.inc >> >> ################################################ >> # FUNCTIONS >> >> function create_names { >> #check parameter list >> if [ ${#} -ne 2 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> TABNAME=3D${2} >> =20 >> # set schema to ours=20 >> ${DB2} "set current schema ${SCHEMA}" >> >> # create the names-table=20 >> ${DB2} -t<> CREATE TABLE ${TABNAME}(nameid INT NOT NULL PRIMARY KEY, >> name VARCHAR(32) NOT NULL); >> EOT >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function create_doc { >> #check parameter list >> if [ ${#} -ne 3 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> TABNAME=3D${2} >> NAMESNAME=3D${3} >> >> ${DB2} "set current schema ${SCHEMA}" >> =20 >> ${DB2} -t<> CREATE TABLE ${TABNAME}(pre INT NOT NULL PRIMARY KEY, >> size INT NOT NULL, >> level SMALLINT NOT NULL, >> kind SMALLINT, >> nameid INT, >> value VARCHAR(100), >> guide INT NOT NULL, >> FOREIGN KEY (nameid) references ${NAMESNAME}(nameid)); >> EOT >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function create_xmldoc { >> #check parameter list >> if [ ${#} -ne 4 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> TABNAME=3D${2} >> DOCNAME=3D${3} >> NAMENAME=3D${4} >> >> ${DB2} "set current schema ${SCHEMA}" >> >> ${DB2} -t<> CREATE VIEW ${TABNAME}(pre, size, level, kind, guide, >> nameid, value, name) AS >> (SELECT pre, size, level, kind, guide, >> doc.nameid, value, name >> FROM ${DOCNAME} AS doc >> LEFT OUTER JOIN >> ${NAMESNAME} AS names >> ON doc.nameid =3D names.nameid); >> EOT >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function drop_table { >> #check parameter list >> if [ ${#} -ne 1 ]; then >> error "Usage: ${0}
" >> fi >> >> TABLE=3D${1} >> >> ${DB2} "drop table ${TABLE}"=20 >> } >> >> function drop_names { >> #check parameter list >> if [ ${#} -ne 1 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> >> ${DB2} "set current schema ${SCHEMA}" >> drop_table "${TAB_NAMES}"=20 >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function drop_doc { >> #check parameter list >> if [ ${#} -ne 1 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> >> ${DB2} "set current schema ${SCHEMA}" >> drop_table "${TAB_DOC}" >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function drop_xmldoc { >> #check parameter list >> if [ ${#} -ne 1 ]; then >> error "Usage: ${0} " >> fi >> >> SCHEMA=3D${1} >> >> ${DB2} "set current schema ${SCHEMA}" >> ${DB2} "drop view xmldoc" >> EFLAG=3D${?} >> return ${EFLAG} >> } >> >> function print_help () { >> out "Pathfinder XQuery" >> out "(c) Database Group, Technische Universitaet Muenchen" >> out ""=20 >> out "Usage: $THISFILE (create|drop) "=20 >> out "" >> out -e "\t(create|drop):\teither create or drop the tables " >> out -e "\t:\t\tName of the Database the tables should be placed/re= moved." >> out -e "\t:\tName of the Schema the tables should be placed/re= moved." >> } >> >> ################################################ >> # MAIN >> >> if [ $# -ne 3 ]; then >> print_help; >> exit 0; >> fi =20 >> >> OPTION=3D${1} >> DATABASE=3D${2} >> SCHEMA=3D${3} >> >> ${DB2} "connect to ${DATABASE}" >> EFLAG=3D$? >> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >> test $EFLAG -ne 0 && exit 1; >> >> case ${OPTION} in >> create) create_names ${SCHEMA} ${TAB_NAMES}; >> EFLAG=3D${?}; >> out -ne "Creating ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >> >> create_doc ${SCHEMA} ${TAB_DOC} ${TAB_NAMES}; >> EFLAG=3D${?}; >> out -ne "Creating ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >> >> create_xmldoc ${SCHEMA} ${TAB_XMLDOC} ${TAB_DOC} ${TAB_NAMES}; >> EFLAG=3D${?}; >> out -ne "Creating ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >> ;; >> >> drop) drop_xmldoc ${SCHEMA} >> EFLAG=3D${?} >> out -ne "Dropping ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >> >> drop_doc ${SCHEMA} >> EFLAG=3D${?} >> out -ne "Dropping ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >> >> drop_names ${SCHEMA} >> EFLAG=3D${?} >> out -ne "Dropping ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >> ;; >> *) print_help;=20 >> exit 1; >> ;; >> esac >> ${DB2} "terminate" >> >> --- NEW FILE: common.inc --- >> DEBUG=3D0 >> >> TAB_NAMES=3D"names" >> TAB_DOC=3D"doc" >> TAB_XMLDOC=3D"xmldoc" >> >> DB2=3D`which db2` >> >> function fail { >> if [ ${#} -ne 1 ]; then >> error "Wrong use of fail" >> fi >> >> if [ ${1} -eq 0 ]; then >> out "Success" >> return 0; >> else >> out "Failed" >> return 0; >> fi >> } >> >> function error { >> if [ ${#} -ne 1 ]; then >> echo "Wrong use of error" >> exit 1; >> fi >> echo -e "Error: ${1}" >> exit 1 >> } >> >> function warning >> { >> if [ ${#} -ne 1 ]; then >> error "Wrong use of debug" >> fi >> echo -e "Warning: ${1}" >> } >> >> function out { >> if [ ${#} -eq 1 ]; then >> echo -e "${1}" >> return 0; >> fi >> if [ ${#} -eq 2 ]; then >> echo "${1}" "${2}" >> else >> error "wrong use of out" >> fi >> } >> >> function debug { >> if [ ${#} -ne 1 ]; then >> error "Wrong use of debug" >> fi >> test ${DEBUG} -eq 1 && echo -e "Debug: ${1}" >> } >> >> function LOG1 { >> prompt=3D"\n# `date +%H:%M:%S` > "; { echo -en "$prompt$prompt" ; ech= o -n "$*" ; echo -en "$prompt\n\n" ; } >&2; >> } >> >> function getAbsolutePath { >> if [ -z ${1} ]; then >> error "Wrong use of ${0}"; >> fi >> >> PATH_=3D${1%/*} >> FILE_=3D${1##*/} >> >> echo `cd ${PATH_} 2> /dev/null && pwd || echo ${PATH_}`/${FILE_} >> } >> >> test -z $DB2 && error "DB2 not available"; >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Monetdb-pf-checkins mailing list >> Monetdb-pf-checkins(a)lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins >> >> =20 > > =20 --=20 Manuel Mayr, Dipl. Inf. Institut fuer Informatik, TU Muenchen Tel.: +49 89 289-17259 --===============1981191601871586743==-- From sjoerd@acm.org Mon Sep 24 04:09:40 2007 From: Sjoerd Mullender To: developers-list@monetdb.org Subject: Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/src/sqlhelpers/db2tools common.inc, XQuery_0-20, NONE, 1.1.2.1 load, XQuery_0-20, NONE, 1.1.2.1 table, XQuery_0-20, NONE, 1.1.2.1 Date: Mon, 24 Sep 2007 13:01:49 +0200 Message-ID: <46F7991D.3050302@acm.org> In-Reply-To: <46F78BE3.4060700@in.tum.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5135236988719110913==" --===============5135236988719110913== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Manuel Mayr wrote: > First of all those scripts don't offer new features or functionality. > They only provide facilities to create tables and content for the > SQL backend. Having the script is by itself already a new feature. > We want to add them to the bindir, only for unix like platforms, since > both are shell scripts. So Windows users aren't allowed to have this convenience? > Best regards, > Manuel >=20 > Stefan Manegold wrote: >> To ensure a smooth finalization of our combined effort to get the upcoming >> release out "as fast as possible" and without any self-made hurdles, I >> assume that adding these new "feature(s)" in the *release branch* has been >> coordinated with Sjoerd, right? >> (In particular wrt. how/where they need to be added to the source and >> in particular binary packages, documentation, and which platforms they are >> targeted for (Windows??).) >> >> Greetings from Vienna, >> >> Stefan >> >> On Mon, Sep 24, 2007 at 09:10:33AM +0000, Manuel Mayr wrote: >> =20 >>> Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/db2tools >>> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18874 >>> >>> Added Files: >>> Tag: XQuery_0-20 >>> common.inc load table=20 >>> Log Message: >>> >>> >>> Shell scripts to create tables, and load content for SQL-backend >>> >>> >>> --- NEW FILE: load --- >>> #!/bin/sh >>> >>> THIS=3D${0} >>> THISDIR=3D${0%/*} >>> THISFILE=3D${0##*/} >>> DB2=3D`which db2` >>> >>> source common.inc >>> >>> ################################################ >>> # FUNCTIONS >>> >>> function load_table { >>> #check parameter list >>> if [ ${#} -ne 3 ]; then >>> error "Usage: ${0}
" >>> fi >>> >>> SCHEMA=3D${2} >>> FILE=3D${1} >>> TABLE=3D${3} >>> =20 >>> # set schema to ours=20 >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> # create the names-table=20 >>> ${DB2} -t<>> LOAD FROM ${FILE} OF DEL >>> MODIFIED BY DELPRIORITYCHAR=20 >>> REPLACE INTO ${TABLE}=20 >>> NONRECOVERABLE >>> INDEXING MODE rebuild; >>> EOT >>> >>> ${DB2} "SET INTEGRITY FOR ${TABLE} IMMEDIATE CHECKED"=20 >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function print_help () { >>> out "Pathfinder XQuery" >>> out "(c) Database Group, Technische Universitaet Muenchen" >>> out ""=20 >>> out "Usage: ${THISFILE} (create|drop) " >>> out "" >>> out -e "\t:\t\tName of the Database the content should be placed/= removed." >>> out -e "\t:\tName of the Schema the content should be placed/= removed." >>> out -e "\t:\tNames file" >>> out -e "\t:\tEncoded document" >>> } >>> >>> ################################################ >>> # MAIN >>> >>> if [ $# -ne 4 ]; then >>> print_help; >>> exit 0; >>> fi =20 >>> >>> DATABASE=3D${1} >>> SCHEMA=3D${2} >>> NFILE=3D${3} >>> LFILE=3D${4} >>> >>> ${DB2} "connect to ${DATABASE}" >>> >>> EFLAG=3D${?} >>> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >>> >>> test ${EFLAG} -ne 0 && exit 1; >>> >>> load_table "${NFILE}" "${SCHEMA}" "${TAB_NAMES}"; >>> EFLAG=3D${?}; >>> out -ne "Loading ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> >>> load_table ${LFILE} "${SCHEMA}" "${TAB_DOC}"; >>> EFLAG=3D${?}; >>> out -ne "Loading ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> ${DB2} "terminate" >>> >>> --- NEW FILE: table --- >>> #!/bin/sh >>> >>> THIS=3D${0} >>> THISDIR=3D${0%/*} >>> THISFILE=3D${0##*/} >>> DB2=3D`which db2` >>> >>> source common.inc >>> >>> ################################################ >>> # FUNCTIONS >>> >>> function create_names { >>> #check parameter list >>> if [ ${#} -ne 2 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> =20 >>> # set schema to ours=20 >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> # create the names-table=20 >>> ${DB2} -t<>> CREATE TABLE ${TABNAME}(nameid INT NOT NULL PRIMARY KEY, >>> name VARCHAR(32) NOT NULL); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function create_doc { >>> #check parameter list >>> if [ ${#} -ne 3 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> NAMESNAME=3D${3} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> =20 >>> ${DB2} -t<>> CREATE TABLE ${TABNAME}(pre INT NOT NULL PRIMARY KEY, >>> size INT NOT NULL, >>> level SMALLINT NOT NULL, >>> kind SMALLINT, >>> nameid INT, >>> value VARCHAR(100), >>> guide INT NOT NULL, >>> FOREIGN KEY (nameid) references ${NAMESNAME}(nameid)); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function create_xmldoc { >>> #check parameter list >>> if [ ${#} -ne 4 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> DOCNAME=3D${3} >>> NAMENAME=3D${4} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> ${DB2} -t<>> CREATE VIEW ${TABNAME}(pre, size, level, kind, guide, >>> nameid, value, name) AS >>> (SELECT pre, size, level, kind, guide, >>> doc.nameid, value, name >>> FROM ${DOCNAME} AS doc >>> LEFT OUTER JOIN >>> ${NAMESNAME} AS names >>> ON doc.nameid =3D names.nameid); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_table { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0}
" >>> fi >>> >>> TABLE=3D${1} >>> >>> ${DB2} "drop table ${TABLE}"=20 >>> } >>> >>> function drop_names { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> drop_table "${TAB_NAMES}"=20 >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_doc { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> drop_table "${TAB_DOC}" >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_xmldoc { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> ${DB2} "drop view xmldoc" >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function print_help () { >>> out "Pathfinder XQuery" >>> out "(c) Database Group, Technische Universitaet Muenchen" >>> out ""=20 >>> out "Usage: $THISFILE (create|drop) "=20 >>> out "" >>> out -e "\t(create|drop):\teither create or drop the tables " >>> out -e "\t:\t\tName of the Database the tables should be placed/r= emoved." >>> out -e "\t:\tName of the Schema the tables should be placed/r= emoved." >>> } >>> >>> ################################################ >>> # MAIN >>> >>> if [ $# -ne 3 ]; then >>> print_help; >>> exit 0; >>> fi =20 >>> >>> OPTION=3D${1} >>> DATABASE=3D${2} >>> SCHEMA=3D${3} >>> >>> ${DB2} "connect to ${DATABASE}" >>> EFLAG=3D$? >>> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >>> test $EFLAG -ne 0 && exit 1; >>> >>> case ${OPTION} in >>> create) create_names ${SCHEMA} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> >>> create_doc ${SCHEMA} ${TAB_DOC} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> create_xmldoc ${SCHEMA} ${TAB_XMLDOC} ${TAB_DOC} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >>> ;; >>> >>> drop) drop_xmldoc ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >>> >>> drop_doc ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> drop_names ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> ;; >>> *) print_help;=20 >>> exit 1; >>> ;; >>> esac >>> ${DB2} "terminate" >>> >>> --- NEW FILE: common.inc --- >>> DEBUG=3D0 >>> >>> TAB_NAMES=3D"names" >>> TAB_DOC=3D"doc" >>> TAB_XMLDOC=3D"xmldoc" >>> >>> DB2=3D`which db2` >>> >>> function fail { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of fail" >>> fi >>> >>> if [ ${1} -eq 0 ]; then >>> out "Success" >>> return 0; >>> else >>> out "Failed" >>> return 0; >>> fi >>> } >>> >>> function error { >>> if [ ${#} -ne 1 ]; then >>> echo "Wrong use of error" >>> exit 1; >>> fi >>> echo -e "Error: ${1}" >>> exit 1 >>> } >>> >>> function warning >>> { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of debug" >>> fi >>> echo -e "Warning: ${1}" >>> } >>> >>> function out { >>> if [ ${#} -eq 1 ]; then >>> echo -e "${1}" >>> return 0; >>> fi >>> if [ ${#} -eq 2 ]; then >>> echo "${1}" "${2}" >>> else >>> error "wrong use of out" >>> fi >>> } >>> >>> function debug { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of debug" >>> fi >>> test ${DEBUG} -eq 1 && echo -e "Debug: ${1}" >>> } >>> >>> function LOG1 { >>> prompt=3D"\n# `date +%H:%M:%S` > "; { echo -en "$prompt$prompt" ; ec= ho -n "$*" ; echo -en "$prompt\n\n" ; } >&2; >>> } >>> >>> function getAbsolutePath { >>> if [ -z ${1} ]; then >>> error "Wrong use of ${0}"; >>> fi >>> >>> PATH_=3D${1%/*} >>> FILE_=3D${1##*/} >>> >>> echo `cd ${PATH_} 2> /dev/null && pwd || echo ${PATH_}`/${FILE_} >>> } >>> >>> test -z $DB2 && error "DB2 not available"; >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Monetdb-pf-checkins mailing list >>> Monetdb-pf-checkins(a)lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins >>> >>> =20 >> =20 >=20 >=20 --=20 Sjoerd Mullender --===============5135236988719110913== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjEuNC43IChHTlUv TGludXgpCkNvbW1lbnQ6IFVzaW5nIEdudVBHIHdpdGggTW96aWxsYSAtIGh0dHA6Ly9lbmlnbWFp bC5tb3pkZXYub3JnCgppUUNWQXdVQlJ2ZVpJajdnMDRBanZJUXBBUUlBY1FQOUdFdEt5cVdlWmNk KzV3djNMazE0bDVkQzc5TFFpb0luCkUxUE8wNE5JTGNSWTRQV3JvZVNOamJuNHlwcjNPWWVOVkpo VktXd2haL1lsQ0tGOFNEZUZrcHJ3Ti8yK1FjcloKSTBzYy9UZWkzYkZoVUNYdTJWUThSMlo0R2Jp S1ZEeWdHTXBJTlFDVEk0VDNXc1owY2psYWh5S3lkbDVxb2hkegp5VUw4UC9KUHU2TT0KPWdxQTEK LS0tLS1FTkQgUEdQIFNJR05BVFVSRS0tLS0tCg== --===============5135236988719110913==-- From Martin.Kersten@cwi.nl Mon Sep 24 04:59:55 2007 From: Martin Kersten To: developers-list@monetdb.org Subject: Re: [Monetdb-developers] [Monetdb-pf-checkins] pathfinder/src/sqlhelpers/db2tools common.inc, XQuery_0-20, NONE, 1.1.2.1 load, XQuery_0-20, NONE, 1.1.2.1 table, XQuery_0-20, NONE, 1.1.2.1 Date: Mon, 24 Sep 2007 13:59:38 +0200 Message-ID: <46F7A6AA.5080307@cwi.nl> In-Reply-To: <46F78BE3.4060700@in.tum.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8887276003606421833==" --===============8887276003606421833== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Do I read this scripts correctly that they are targeted to DB2? The syntax is certainly not processibleby MonetDB/SQL This alone is already a showstopper. It should not be included. Producing a multitarget PF with is beyond the MonetDB distribution,. Manuel Mayr wrote: > First of all those scripts don't offer new features or functionality. > They only provide facilities to create tables and content for the > SQL backend. > > We want to add them to the bindir, only for unix like platforms, since > both are shell scripts. > > Best regards, > Manuel > > Stefan Manegold wrote: > =20 >> To ensure a smooth finalization of our combined effort to get the upcoming >> release out "as fast as possible" and without any self-made hurdles, I >> assume that adding these new "feature(s)" in the *release branch* has been >> coordinated with Sjoerd, right? >> (In particular wrt. how/where they need to be added to the source and >> in particular binary packages, documentation, and which platforms they are >> targeted for (Windows??).) >> >> Greetings from Vienna, >> >> Stefan >> >> On Mon, Sep 24, 2007 at 09:10:33AM +0000, Manuel Mayr wrote: >> =20 >> =20 >>> Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/db2tools >>> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18874 >>> >>> Added Files: >>> Tag: XQuery_0-20 >>> common.inc load table=20 >>> Log Message: >>> >>> >>> Shell scripts to create tables, and load content for SQL-backend >>> >>> >>> --- NEW FILE: load --- >>> #!/bin/sh >>> >>> THIS=3D${0} >>> THISDIR=3D${0%/*} >>> THISFILE=3D${0##*/} >>> DB2=3D`which db2` >>> >>> source common.inc >>> >>> ################################################ >>> # FUNCTIONS >>> >>> function load_table { >>> #check parameter list >>> if [ ${#} -ne 3 ]; then >>> error "Usage: ${0}
" >>> fi >>> >>> SCHEMA=3D${2} >>> FILE=3D${1} >>> TABLE=3D${3} >>> =20 >>> # set schema to ours=20 >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> # create the names-table=20 >>> ${DB2} -t<>> LOAD FROM ${FILE} OF DEL >>> MODIFIED BY DELPRIORITYCHAR=20 >>> REPLACE INTO ${TABLE}=20 >>> NONRECOVERABLE >>> INDEXING MODE rebuild; >>> EOT >>> >>> ${DB2} "SET INTEGRITY FOR ${TABLE} IMMEDIATE CHECKED"=20 >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function print_help () { >>> out "Pathfinder XQuery" >>> out "(c) Database Group, Technische Universitaet Muenchen" >>> out ""=20 >>> out "Usage: ${THISFILE} (create|drop) " >>> out "" >>> out -e "\t:\t\tName of the Database the content should be placed/= removed." >>> out -e "\t:\tName of the Schema the content should be placed/= removed." >>> out -e "\t:\tNames file" >>> out -e "\t:\tEncoded document" >>> } >>> >>> ################################################ >>> # MAIN >>> >>> if [ $# -ne 4 ]; then >>> print_help; >>> exit 0; >>> fi =20 >>> >>> DATABASE=3D${1} >>> SCHEMA=3D${2} >>> NFILE=3D${3} >>> LFILE=3D${4} >>> >>> ${DB2} "connect to ${DATABASE}" >>> >>> EFLAG=3D${?} >>> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >>> >>> test ${EFLAG} -ne 0 && exit 1; >>> >>> load_table "${NFILE}" "${SCHEMA}" "${TAB_NAMES}"; >>> EFLAG=3D${?}; >>> out -ne "Loading ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> >>> load_table ${LFILE} "${SCHEMA}" "${TAB_DOC}"; >>> EFLAG=3D${?}; >>> out -ne "Loading ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> ${DB2} "terminate" >>> >>> --- NEW FILE: table --- >>> #!/bin/sh >>> >>> THIS=3D${0} >>> THISDIR=3D${0%/*} >>> THISFILE=3D${0##*/} >>> DB2=3D`which db2` >>> >>> source common.inc >>> >>> ################################################ >>> # FUNCTIONS >>> >>> function create_names { >>> #check parameter list >>> if [ ${#} -ne 2 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> =20 >>> # set schema to ours=20 >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> # create the names-table=20 >>> ${DB2} -t<>> CREATE TABLE ${TABNAME}(nameid INT NOT NULL PRIMARY KEY, >>> name VARCHAR(32) NOT NULL); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function create_doc { >>> #check parameter list >>> if [ ${#} -ne 3 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> NAMESNAME=3D${3} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> =20 >>> ${DB2} -t<>> CREATE TABLE ${TABNAME}(pre INT NOT NULL PRIMARY KEY, >>> size INT NOT NULL, >>> level SMALLINT NOT NULL, >>> kind SMALLINT, >>> nameid INT, >>> value VARCHAR(100), >>> guide INT NOT NULL, >>> FOREIGN KEY (nameid) references ${NAMESNAME}(nameid)); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function create_xmldoc { >>> #check parameter list >>> if [ ${#} -ne 4 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> TABNAME=3D${2} >>> DOCNAME=3D${3} >>> NAMENAME=3D${4} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> >>> ${DB2} -t<>> CREATE VIEW ${TABNAME}(pre, size, level, kind, guide, >>> nameid, value, name) AS >>> (SELECT pre, size, level, kind, guide, >>> doc.nameid, value, name >>> FROM ${DOCNAME} AS doc >>> LEFT OUTER JOIN >>> ${NAMESNAME} AS names >>> ON doc.nameid =3D names.nameid); >>> EOT >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_table { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0}
" >>> fi >>> >>> TABLE=3D${1} >>> >>> ${DB2} "drop table ${TABLE}"=20 >>> } >>> >>> function drop_names { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> drop_table "${TAB_NAMES}"=20 >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_doc { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> drop_table "${TAB_DOC}" >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function drop_xmldoc { >>> #check parameter list >>> if [ ${#} -ne 1 ]; then >>> error "Usage: ${0} " >>> fi >>> >>> SCHEMA=3D${1} >>> >>> ${DB2} "set current schema ${SCHEMA}" >>> ${DB2} "drop view xmldoc" >>> EFLAG=3D${?} >>> return ${EFLAG} >>> } >>> >>> function print_help () { >>> out "Pathfinder XQuery" >>> out "(c) Database Group, Technische Universitaet Muenchen" >>> out ""=20 >>> out "Usage: $THISFILE (create|drop) "=20 >>> out "" >>> out -e "\t(create|drop):\teither create or drop the tables " >>> out -e "\t:\t\tName of the Database the tables should be placed/r= emoved." >>> out -e "\t:\tName of the Schema the tables should be placed/r= emoved." >>> } >>> >>> ################################################ >>> # MAIN >>> >>> if [ $# -ne 3 ]; then >>> print_help; >>> exit 0; >>> fi =20 >>> >>> OPTION=3D${1} >>> DATABASE=3D${2} >>> SCHEMA=3D${3} >>> >>> ${DB2} "connect to ${DATABASE}" >>> EFLAG=3D$? >>> out -ne "Connecting to database ${DATABASE} ... "; fail $EFLAG;=20 >>> test $EFLAG -ne 0 && exit 1; >>> >>> case ${OPTION} in >>> create) create_names ${SCHEMA} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> >>> create_doc ${SCHEMA} ${TAB_DOC} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> create_xmldoc ${SCHEMA} ${TAB_XMLDOC} ${TAB_DOC} ${TAB_NAMES}; >>> EFLAG=3D${?}; >>> out -ne "Creating ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >>> ;; >>> >>> drop) drop_xmldoc ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_XMLDOC} ... "; fail ${EFLAG}; >>> >>> drop_doc ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_DOC} ... "; fail ${EFLAG}; >>> >>> drop_names ${SCHEMA} >>> EFLAG=3D${?} >>> out -ne "Dropping ${SCHEMA}.${TAB_NAMES} ... "; fail ${EFLAG}; >>> ;; >>> *) print_help;=20 >>> exit 1; >>> ;; >>> esac >>> ${DB2} "terminate" >>> >>> --- NEW FILE: common.inc --- >>> DEBUG=3D0 >>> >>> TAB_NAMES=3D"names" >>> TAB_DOC=3D"doc" >>> TAB_XMLDOC=3D"xmldoc" >>> >>> DB2=3D`which db2` >>> >>> function fail { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of fail" >>> fi >>> >>> if [ ${1} -eq 0 ]; then >>> out "Success" >>> return 0; >>> else >>> out "Failed" >>> return 0; >>> fi >>> } >>> >>> function error { >>> if [ ${#} -ne 1 ]; then >>> echo "Wrong use of error" >>> exit 1; >>> fi >>> echo -e "Error: ${1}" >>> exit 1 >>> } >>> >>> function warning >>> { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of debug" >>> fi >>> echo -e "Warning: ${1}" >>> } >>> >>> function out { >>> if [ ${#} -eq 1 ]; then >>> echo -e "${1}" >>> return 0; >>> fi >>> if [ ${#} -eq 2 ]; then >>> echo "${1}" "${2}" >>> else >>> error "wrong use of out" >>> fi >>> } >>> >>> function debug { >>> if [ ${#} -ne 1 ]; then >>> error "Wrong use of debug" >>> fi >>> test ${DEBUG} -eq 1 && echo -e "Debug: ${1}" >>> } >>> >>> function LOG1 { >>> prompt=3D"\n# `date +%H:%M:%S` > "; { echo -en "$prompt$prompt" ; ec= ho -n "$*" ; echo -en "$prompt\n\n" ; } >&2; >>> } >>> >>> function getAbsolutePath { >>> if [ -z ${1} ]; then >>> error "Wrong use of ${0}"; >>> fi >>> >>> PATH_=3D${1%/*} >>> FILE_=3D${1##*/} >>> >>> echo `cd ${PATH_} 2> /dev/null && pwd || echo ${PATH_}`/${FILE_} >>> } >>> >>> test -z $DB2 && error "DB2 not available"; >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2005. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> Monetdb-pf-checkins mailing list >>> Monetdb-pf-checkins(a)lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins >>> >>> =20 >>> =20 >> =20 >> =20 > > > =20 --===============8887276003606421833==--