summaryrefslogtreecommitdiffstats
path: root/kexi/tools
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/tools
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/tools')
-rw-r--r--kexi/tools/Makefile.am1
-rw-r--r--kexi/tools/add_column/Makefile.am5
-rwxr-xr-xkexi/tools/add_column/kexi_add_column114
-rw-r--r--kexi/tools/add_column/kexi_add_column_gui99
-rw-r--r--kexi/tools/add_column/kexi_add_column_gui_transl_pl.sh24
-rwxr-xr-xkexi/tools/build_tarball/build_kexi_tarball.sh232
-rw-r--r--kexi/tools/build_tarball/kexi.lsm10
-rw-r--r--kexi/tools/delete_column/Makefile.am5
-rw-r--r--kexi/tools/delete_column/README17
-rwxr-xr-xkexi/tools/delete_column/kexi_delete_column136
-rwxr-xr-xkexi/tools/delete_column/kexi_delete_column_gui82
-rw-r--r--kexi/tools/delete_column/kexi_delete_column_gui_transl_pl.sh10
-rw-r--r--kexi/tools/feedback/create_kexifeedback.sh54
-rw-r--r--kexi/tools/sql_keywords/Makefile30
-rw-r--r--kexi/tools/sql_keywords/kexi_reserved58
-rwxr-xr-xkexi/tools/sql_keywords/sql_keywords.sh299
16 files changed, 1176 insertions, 0 deletions
diff --git a/kexi/tools/Makefile.am b/kexi/tools/Makefile.am
new file mode 100644
index 00000000..7c35ef5a
--- /dev/null
+++ b/kexi/tools/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS=add_column delete_column
diff --git a/kexi/tools/add_column/Makefile.am b/kexi/tools/add_column/Makefile.am
new file mode 100644
index 00000000..74e150d1
--- /dev/null
+++ b/kexi/tools/add_column/Makefile.am
@@ -0,0 +1,5 @@
+
+bin_SCRIPTS = kexi_add_column kexi_add_column_gui
+
+message_pldir = $(kde_locale)/pl/LC_MESSAGES
+message_pl_DATA = kexi_add_column_gui_transl_pl.sh
diff --git a/kexi/tools/add_column/kexi_add_column b/kexi/tools/add_column/kexi_add_column
new file mode 100755
index 00000000..02d03de6
--- /dev/null
+++ b/kexi/tools/add_column/kexi_add_column
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# Copyright (C) 2006 Jaroslaw Staniek <js@iidea.pl>
+#
+# This program 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 2 of the License, or (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+usage {
+ echo "This script adds a new empty column to a table in a .kexi (SQLite 3)
+ database file without removing data from the table.
+
+Usage:
+ $0 database_name table_name new_column_name new_column_type
+ [new_column_caption]
+
+- {database_name}.old backup file is created before proceeding
+- database_name and table_name must exist
+- new_column_name must not exist and should be valid idetifier
+- new_column_type must be one of:
+ Byte, ShortInteger, Integer, BigInteger, Boolean, Date, DateTime, Time,
+ Float, Double, Text, LongText, BLOB (for images)
+- new_column_caption can be any text; enclose it in \" \" if you want to use
+ spaces there
+
+Example: to append a column 'photo' of type BLOB to the table 'cars', type
+ $0 db.kexi cars photo BLOB Photo"
+}
+
+exit_with_error {
+ rm -f "$temp_db"
+ echo $*
+ echo "Error."
+ exit 1
+}
+
+check {
+ [ -n "$*" ] && exit_with_error "$*"
+}
+
+ksqlite="ksqlite -noheader"
+
+if [ $# -lt 4 ] ; then
+ usage
+ exit 0
+fi
+database_name=$1
+table_name=$2
+new_column_name=$3
+new_column_type=$4
+new_column_caption=$5
+
+# get numeric value for the data type
+case $new_column_type in
+ Byte) typenum=1;;
+ ShortInteger) typenum=2;;
+ Integer) typenum=3;;
+ BigInteger) typenum=4;;
+ Boolean) typenum=5;;
+ Date) typenum=6;;
+ DateTime) typenum=7;;
+ Time) typenum=8;;
+ Float) typenum=9;;
+ Double) typenum=10;;
+ Text) typenum=11;;
+ LongText) typenum=12;;
+ BLOB) typenum=13;;
+ *) echo "Unknown type name '$new_column_type'"; exit 1;;
+esac
+
+temp_db=`mktemp "$database_name"XXXXXXXX` || exit_with_error
+cp "$database_name" "$temp_db" || exit_with_error
+msg=`echo "DROP TABLE '$table_name';" | $ksqlite "$temp_db"`
+check "$msg"
+
+# 1. Recreate table with new field appended
+msg=`echo ".schema '$table_name';" | $ksqlite "$database_name" | grep "^CREATE TABLE $table_name " | \
+ sed -e "s/);/, $new_column_name $new_column_type);/g" | $ksqlite "$temp_db"`
+check "$msg"
+
+# 2.1. Get table's ID
+table_id=`echo "SELECT o_id FROM kexi__objects WHERE o_type=1 AND o_name='$table_name';" | \
+ $ksqlite "$temp_db" || exit_with_error`
+
+# 2.2. Get the new field's order
+order=`echo "SELECT MAX(f_order)+1 FROM kexi__fields WHERE t_id=$table_id;" | $ksqlite "$temp_db" || exit_with_error`
+
+# 2.3. Add the new column information to kexi__fields metadata table
+msg=`echo "INSERT INTO kexi__fields (t_id, f_type, f_name, f_length, f_precision, f_constraints, \
+ f_options, f_default, f_order, f_caption, f_help) \
+ VALUES ($table_id, $typenum, '$new_column_name', \
+ 0, 0, 0, 0, NULL, $order, '$new_column_caption', NULL);" | $ksqlite "$temp_db"`
+check "$msg"
+
+# 3. Copy the old data
+msg=`echo ".dump '$table_name';" | $ksqlite "$database_name" | grep -v "^CREATE TABLE " | \
+ sed -e "s/\(^INSERT.*\));$/\\1, NULL);/g" | $ksqlite "$temp_db"`
+check "$msg"
+
+# 4. Copy the original database file to .old file and replace the original with the new one
+cp "$database_name" "$database_name.old" || exit_with_error
+mv "$temp_db" "$database_name" || exit_with_error
diff --git a/kexi/tools/add_column/kexi_add_column_gui b/kexi/tools/add_column/kexi_add_column_gui
new file mode 100644
index 00000000..29731d69
--- /dev/null
+++ b/kexi/tools/add_column/kexi_add_column_gui
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# Copyright (C) 2006 Jaroslaw Staniek <js@iidea.pl>
+#
+# This program 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 2 of the License, or (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+basedir=`dirname "$0"`
+
+setup_messages {
+ lang=`grep Language= ~/.kde/share/config/kdeglobals | head -n 1 | \
+ sed -e 's/Language=\(.*\):.*/\1/'`
+ if [ -z "$lang" ] ; then lang="en" ; fi
+
+ IFS=:
+ for dir in `kde-config --expandvars --path locale` ; do
+ transl_file="$dir"$lang"/LC_MESSAGES/kexi_add_column_gui_transl_$lang.sh";
+ if [ -f "$transl_file" ] ; then
+ source "$transl_file"
+ break
+ else
+ transl_file=;
+ fi
+ done
+ IFS=" "
+ if [ -z "$transl_file" ] ; then
+ transl_file="$basedir/kexi_add_column_gui_transl_$lang.sh";
+ if [ ! -f "$transl_file" ] ; then source "$transl_file"; else transl_file=; fi
+ fi
+echo $transl_file
+ if [ -z "$transl_file" ] ; then
+ # default: english messages:
+ msg_filters="*.kexi|Kexi Project stored in a file
+*.*|All files"
+ msg_select_db_file="Select database file"
+ msg_enter_table_name="Table name (without spaces):"
+ msg_enter_new_column_name="New column's name (without spaces):"
+ msg_enter_new_column_type="New column's type:"
+ msg_byte="Byte"
+ msg_short_integer="Short integer"
+ msg_integer="Integer"
+ msg_big_integer="Big integer"
+ msg_yes_no="Yes/No"
+ msg_date="Date"
+ msg_date_time="Date/Time"
+ msg_time="Time"
+ msg_float="Single precision number"
+ msg_double="Double precision number"
+ msg_text="Text"
+ msg_long_text="Long text"
+ msg_object="Object (image)"
+ msg_enter_new_column_caption="New column's caption (optional):"
+ fi
+} # /setup_messages
+
+setup_messages
+
+database_name=`kdialog --title "$msg_select_db_file" --getopenfilename . "$msg_filters"` || exit 1
+
+table_name=`kdialog --inputbox "$msg_enter_table_name"` || exit 1
+
+new_column_name=`kdialog --inputbox "$msg_enter_new_column_name"` || exit 1
+
+new_column_type=`kdialog --radiolist "$msg_enter_new_column_type " \
+Byte "$msg_byte" off \
+ShortInteger "$msg_short_integer" off \
+Integer "$msg_integer" off \
+BigInteger "$msg_big_integer" off \
+Boolean "$msg_yes_no" off \
+Date "$msg_date" off \
+DateTime "$msg_date_time" off \
+Time "$msg_time" off \
+Float "$msg_float" off \
+Double "$msg_double" off \
+Text "$msg_text" off \
+LongText "$msg_long_text" off \
+BLOB "$msg_object" off ` || exit 1
+new_column_caption=`kdialog --inputbox "$msg_enter_new_column_caption"`
+
+msg=`sh kexi_add_column "$database_name" "$table_name" "$new_column_name" \
+ "$new_column_type" "$new_column_caption" 2>&1`
+
+[ -z "$msg" ] && exit 0
+
+kdialog --error "$msg"
+exit 1
diff --git a/kexi/tools/add_column/kexi_add_column_gui_transl_pl.sh b/kexi/tools/add_column/kexi_add_column_gui_transl_pl.sh
new file mode 100644
index 00000000..974b79cf
--- /dev/null
+++ b/kexi/tools/add_column/kexi_add_column_gui_transl_pl.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Translation file for kexi_add_column_gui
+
+msg_filters="*.kexi|Projekt Kexi zapisany w pliku
+*.*|Wszystkie pliki"
+msg_select_db_file="Wybierz plik bazy danych"
+msg_enter_table_name="Nazwa tabeli (bez spacji):"
+msg_enter_new_column_name="Nazwa nowej kolumny (bez spacji):"
+msg_enter_new_column_type="Typ nowej kolumny:"
+msg_byte="Bajt"
+msg_short_integer="Liczba calkowita krotka"
+msg_integer="Liczba calkowita"
+msg_big_integer="Liczba calkowita wielka"
+msg_yes_no="Tak/Nie"
+msg_date="Data"
+msg_date_time="Data/Czas"
+msg_time="Czas"
+msg_float="Liczba zmiennoprzecinkowa krotka"
+msg_double="Liczba zmiennoprzecinkowa dluga"
+msg_text="Tekst"
+msg_long_text="Dlugi tekst"
+msg_object="Obiekt (obraz)"
+msg_enter_new_column_caption="Tytul nowej kolumny (opcjonalnie):"
diff --git a/kexi/tools/build_tarball/build_kexi_tarball.sh b/kexi/tools/build_tarball/build_kexi_tarball.sh
new file mode 100755
index 00000000..6e5a6f34
--- /dev/null
+++ b/kexi/tools/build_tarball/build_kexi_tarball.sh
@@ -0,0 +1,232 @@
+#!/bin/sh
+#
+# This script prepares & uploads tarballs
+# Usage within KDE svn tree.
+# Based on cvs2pack
+# Copyright 2002 Nikolas Zimmermann <wildfox@kde.org>
+# Copyright 2004-2006 Jaroslaw Staniek <js@iidea.pl>
+# Copyright 2005 Martin Ellis <martin.ellis@kdemail.net>
+# License: GPL (http://www.gnu.org/)
+
+DIRNAME=`pwd`/`dirname $0`
+cd $DIRNAME
+
+# General
+MODULE=koffice
+PROJECT=kexi
+PROJECT_TITLE=Kexi
+MODULE_PATH=trunk/$MODULE
+
+# Admin from branch as trunk in for KDE4.
+# Bump to 3.5 when that branch is stable?
+KDESOURCEDIR=branches/KDE/3.5
+KDEADMIN_PATH=$KDESOURCEDIR/kde-common/admin
+
+PROJECT_PATH=koffice/kexi
+#For versions in a branch:
+PROJECT_VER=1.0
+#PROJECT_PATH=branches/kexi/$PROJECT_VER
+SVN2DIST_OPTIONS=--no-i18n #set --no-i18n for version being outside the trunk
+
+# Make sure these are all directories - see Makefile creation below
+EXC="3rdparty/uuid plugins/importwizard scriptingcore scriptingplugins"
+
+# Uploading
+UPLOAD_USER=user # CHANGE
+UPLOAD_PASS=pass # CHANGE
+UPLOAD_HOST=host # CHANGE
+DO_UPLOAD=0 # 1 = Yes; 0 = No
+
+# SVN'ing
+SVN_USER=staniek # CHANGE
+SVN_PASS= # CHANGE
+SVN_HOST=https://svn.kde.org/home/kde
+
+# Dist-settings
+# set empty if this is snapshot
+DIST_VER=`grep "# define KEXI_VERSION_STRING" ../../kexi_version.h | \
+ sed -e 's/.*\"\(.*\)\"/\1/;s/ //g;y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;'`
+
+# Pick kexi_stable.lsm or kexi.lsm as a LSM file template
+echo $DIST_VER | grep -e "beta" -e "rc" \
+ > /dev/null && lsmsrcfile=kexi.lsm || lsmsrcfile=kexi_stable.lsm
+
+fixAppSpecific()
+{
+ rm -f ../changes-* #remove koffice-specific changelog
+ mv CHANGES ../
+ echo "For complete list of authors see kexi/main/kexiaboutdata.h file or use \"Help->About Kexi\" menu command." > ../AUTHORS
+}
+
+# Paths
+mkdir -p /tmp/kexi-dist
+DESTINATION=/tmp/kexi-dist/$DIST_VER # CHANGE TO A NON-EXISTING DIR, WHICH WILL BE CREATED LATER!!!
+CONFIGURE_PREFIX=`kde-config --prefix` # CHANGE
+EXPECT_PROGRAM=`which expect` # CHANGE
+ED_LOCATION=/bin # CHANGE
+
+# Work around for stupid Subversion bug on Martin's machine
+SVN_PROGRAM="strace -o /dev/null "`which svn`
+
+DATE_PROGRAM=`which date` # CHANGE
+PERL_PROGRAM=`which perl` # CHANGE
+SVN2DIST_PROGRAM=`which svn2dist` # CHANGE
+test -z $SVN2DIST_PROGRAM && exit 1
+NCFTPPUT_PROGRAM=`which ncftpput` # CHANGE
+CONF= # CANGE OR LEAVE EMPTY IF NO SPECIAL configure.in.in should be copied
+
+# --- end of configuration area ---
+
+# Main program
+if [ -z "$DIST_VER" ]; then
+ today=`$DATE_PROGRAM +%d-%m-%y`
+ snapshot="-snapshot"
+else
+ today=$DIST_VER
+ snapshot=
+fi
+
+echo "*** Creating $PROJECT-$today$snaphshot ***"
+
+if ! [ -e $DESTINATION ]; then
+ echo "*** Setup-Mode: Creating..."
+ echo " -> $DESTINATION..."
+ mkdir $DESTINATION
+ echo " -> $DESTINATION/source..."
+ mkdir $DESTINATION/source
+ echo " -> $DESTINATION/archive..."
+ mkdir $DESTINATION/archive
+fi
+
+if [ -e $DESTINATION ]; then
+# rm -f $DESTINATION/expect_script
+
+# touch $DESTINATION/expect_script
+# chmod +x $DESTINATION/expect_script
+
+# echo "#!$EXPECT_PROGRAM
+# spawn $SVN_PROGRAM -d :pserver:$SVN_USER@$CVS_HOST:/home/kde login
+# expect -re \"SVN password: \"
+# send \"$SVN_PASS\\r\"
+# expect eof" >> $DESTINATION/expect_script
+
+ rm -f $DESTINATION/LOG
+fi
+
+echo $DESTINATION/source/$MODULE
+if ! [ -e $DESTINATION/source/$MODULE ]; then
+ echo "*** Setup-Mode: Checking $MODULE/$PROJECT out from SVN..."
+ cd $DESTINATION/source
+
+ # Get admin dir
+ echo "$SVN_PROGRAM co $SVN_HOST/$KDEADMIN_PATH" >> $DESTINATION/LOG
+ $SVN_PROGRAM co $SVN_HOST/$KDEADMIN_PATH >> $DESTINATION/LOG 2>&1 || exit 1
+
+ # Get KOffice top-level dir
+ echo "$SVN_PROGRAM co -N $SVN_HOST/$MODULE_PATH" >> $DESTINATION/LOG
+ $SVN_PROGRAM co -N $SVN_HOST/$MODULE_PATH >> $DESTINATION/LOG 2>&1 || exit 1
+
+ # Get KoProperty, KOffice{Core|UI} and KROSS from lib
+ echo "cd $MODULE && $SVN_PROGRAM up -N lib ; cd .. " >> $DESTINATION/LOG
+ (cd $MODULE && $SVN_PROGRAM up -N lib ; cd .. ) >> $DESTINATION/LOG 2>&1 || exit 1
+ echo "cd $MODULE/lib && $SVN_PROGRAM up koproperty ; cd .." >> $DESTINATION/LOG
+ (cd $MODULE/lib && $SVN_PROGRAM up koproperty ; cd ..) >> $DESTINATION/LOG 2>&1 || exit 1
+ echo "cd $MODULE/lib && $SVN_PROGRAM up kofficecore ; cd .." >> $DESTINATION/LOG
+ (cd $MODULE/lib && $SVN_PROGRAM up kofficecore ; cd ..) >> $DESTINATION/LOG 2>&1 || exit 1
+ echo "cd $MODULE/lib && $SVN_PROGRAM up kofficeui ; cd .." >> $DESTINATION/LOG
+ (cd $MODULE/lib && $SVN_PROGRAM up kofficeui ; cd ..) >> $DESTINATION/LOG 2>&1 || exit 1
+ echo "cd $MODULE/lib && $SVN_PROGRAM up kross ; cd .." >> $DESTINATION/LOG
+ (cd $MODULE/lib && $SVN_PROGRAM up kross ; cd ..) >> $DESTINATION/LOG 2>&1 || exit 1
+
+ # Get Kexi
+ echo "cd $MODULE && $SVN_PROGRAM up $PROJECT ; cd .." >> $DESTINATION/LOG
+ (cd $MODULE && $SVN_PROGRAM up $PROJECT ; cd ..) >> $DESTINATION/LOG 2>&1 || exit 1
+
+ #mv $PROJECT_VER/$MODULE/$PROJECT $MODULE/ || exit 1
+ #rm -rf $PROJECT_VER || exit 1
+
+ cd $MODULE || exit 1
+
+ ln -s ../admin admin
+ cd ..
+fi
+
+
+echo "1. Cleaning up..."
+cd $DESTINATION/source/$MODULE || exit 1
+rm -fr acinclude.m4 aclocal.m4 Makefile.in Makefile libtool $PROJECT/config.h \
+config.h.in stamp-h.in subdirs configure configure.in configure.files stamp-h \
+inst-apps autom4te-2.5x.cache autom4te.cache .autoconf_trace MakeVars.in \
+Makefile.am Makefile.rules.in
+
+find . -name \*~ | xargs rm -f
+
+
+echo "2. Updating from SVN..."
+#$DESTINATION/expect_script >> $DESTINATION/LOG 2>&1
+cd admin || exit 1
+$SVN_PROGRAM up >> $DESTINATION/LOG 2>&1 || exit 1
+cd ../kexi || exit 1
+$SVN_PROGRAM up >> $DESTINATION/LOG 2>&1 || exit 1
+
+
+cd $DESTINATION/archive || exit 1
+rm -f *
+#rm -f $DESTINATION/expect_script
+
+echo "3. Makefile creation..."
+export UNSERMAKE="no"
+if [ -n "$CONF" ]; then
+ cp $CONF $DESTINATION/source/$MODULE
+fi
+cd $DESTINATION/source/$MODULE/$PROJECT
+
+for dir in $EXC; do
+ rm -rf $dir
+ # Avoid Makefile.cvs complaining about missing dirs
+ mkdir $dir
+done
+#fix exectutable bits for sources:
+find . -name \*.h -o -name \*.cpp -o -name \*.c -o -name \*.cc -o -name \*.1 | xargs chmod a-x
+
+#other app-specific fixes:
+fixAppSpecific
+
+#--svn2dist will do this
+#cd $DESTINATION/source/$MODULE
+#make -f Makefile.cvs >> $DESTINATION/LOG 2>&1
+#cd ..
+cd $DESTINATION/source
+echo "4. Building tarballs..."
+$SVN2DIST_PROGRAM $MODULE $PROJECT -v $today \
+ --svn-root "$SVN_HOST/trunk" \
+ $SVN2DIST_OPTIONS \
+ --log="$DESTINATION/LOG.SVN2DIST" >> $DESTINATION/LOG 2>&1 || exit 1
+cat "svn2dist-$PROJECT.log" >> $DESTINATION/LOG
+rm -Rf $PROJECT-$today
+rm -f $PROJECT-$today.tar
+mv $PROJECT-$today.* ../archive
+cd ../archive
+
+#create .lsm file
+lsmfile=$PROJECT"-"$DIST_VER".lsm"
+echo "Begin4
+Title: $PROJECT_TITLE
+Version: "$DIST_VER"
+Entered-date: "`date +%Y-%m-%d` > $lsmfile
+cat $DIRNAME/$lsmsrcfile >> $lsmfile
+
+if [ -n "$snapshot" ] ; then
+ mv $PROJECT-$today.tar.bz2 $PROJECT-$today$snapshot.tar.bz2
+ mv $PROJECT-$today.tar.gz $PROJECT-$today$snapshot.tar.gz
+fi
+
+if [ $DO_UPLOAD -eq 1 ]; then
+ echo "5. Uploading tarballs..."
+ $NCFTPPUT_PROGRAM -u $UPLOAD_USER -p $UPLOAD_PASS $UPLOAD_HOST $PROJECT $DESTINATION/archive/* >> $DESTINATION/LOG 2>&1
+ cd ..
+ echo "6. Done!"
+ exit
+fi
+
+echo "5. Won't upload. Done!"
diff --git a/kexi/tools/build_tarball/kexi.lsm b/kexi/tools/build_tarball/kexi.lsm
new file mode 100644
index 00000000..98399347
--- /dev/null
+++ b/kexi/tools/build_tarball/kexi.lsm
@@ -0,0 +1,10 @@
+Description: Integrated data management application
+Keywords: database KDE KOffice desktop Qt
+Author: http://www.kexi-project.org (Kexi Team)
+Maintained-by: js@iidea.pl (Jaroslaw Staniek)
+Primary-site: http://download.kde.org/download.php?url=unstable/apps/KDE3.x/database/
+Home-Page: http://www.kexi-project.org
+Original-site: None
+Platforms: Unix, Qt
+Copying-policy: LGPL
+End \ No newline at end of file
diff --git a/kexi/tools/delete_column/Makefile.am b/kexi/tools/delete_column/Makefile.am
new file mode 100644
index 00000000..1f019ae8
--- /dev/null
+++ b/kexi/tools/delete_column/Makefile.am
@@ -0,0 +1,5 @@
+
+bin_SCRIPTS = kexi_delete_column kexi_delete_column_gui
+
+message_pldir = $(kde_locale)/pl/LC_MESSAGES
+message_pl_DATA = kexi_delete_column_gui_transl_pl.sh
diff --git a/kexi/tools/delete_column/README b/kexi/tools/delete_column/README
new file mode 100644
index 00000000..3e263591
--- /dev/null
+++ b/kexi/tools/delete_column/README
@@ -0,0 +1,17 @@
+== "Delete column" utility for Kexi ==
+
+This script deletes a single table column from a .kexi (SQLite 3)
+database file without removing data from the table.
+
+Rationale:
+Kexi 1.x does not offer deleting columns from a table
+without removing its data. The kexi_delete_column script does exactly this.
+
+Usage:
+Type kexi_delete_column for list of arguments.
+
+GUI tool:
+There is also a GUI tool 'kexi_delete_column_gui' that is basically
+a wrapper running on top of kexi_delete_column
+The tool works without arguments - it uses KDE dialogs instead ('kdialog').
+
diff --git a/kexi/tools/delete_column/kexi_delete_column b/kexi/tools/delete_column/kexi_delete_column
new file mode 100755
index 00000000..22566c61
--- /dev/null
+++ b/kexi/tools/delete_column/kexi_delete_column
@@ -0,0 +1,136 @@
+#!/bin/sh
+#
+# Copyright (C) 2006-2007 Jaroslaw Staniek <js@iidea.pl>
+#
+# This program 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 2 of the License, or (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+usage {
+ echo "This script deletes a single table column from a .kexi (SQLite 3)
+database file without removing data from the table.
+
+Usage:
+ $0 database_name table_name column_name
+
+- {database_name}.old backup file is created before proceeding
+- database_name, table_name, column_name must exist
+- note that queries, forms and other objects referencing
+ to the altered table can become invalid and have to be
+ fixed by hand
+
+Example: to delete 'price' column from table 'products', type
+ $0 db.kexi products price"
+}
+
+exit_with_error {
+ rm -f "$temp_db"
+ echo $*
+ echo "Error."
+ exit 1
+}
+
+check {
+ [ -n "$*" ] && exit_with_error "$*"
+}
+
+ksqlite="ksqlite -noheader"
+ksqlite_header="ksqlite -header"
+
+if [ $# -lt 3 ] ; then
+ usage
+ exit 0
+fi
+database_name=$1
+table_name=$2
+column_name=$3
+
+temp_db=`mktemp "$database_name"XXXXXXXX` || exit_with_error
+cp "$database_name" "$temp_db" || exit_with_error
+
+# 1. alter the table physically
+
+prepare_new_create_table_statement {
+ # possible problems: typename ( number , number ) may contain ","
+
+ schema=`echo ".schema '$table_name';" | $ksqlite "$database_name" | \
+ grep "^CREATE TABLE $table_name " | \
+ sed -e "s/[^(]*(\(.*\));/\1/" || exit_with_error`
+
+ IFS=","
+ for coldef in $schema ; do
+ col=`echo $coldef | sed "s/^[ ]*\([^ ]*\) .*$/\1/"`
+ if [ "$col" != "$column_name" ] ; then
+ echo -n ,$coldef
+ fi
+ done | cut -c2-
+ IFS=" "
+}
+
+get_sql_column_names {
+ names=`$ksqlite_header "$temp_db" "SELECT * FROM '$temp_table_name' LIMIT 1;" | \
+ head -n 1 || exit_with_error`
+ IFS="|"
+ for col in $names ; do
+ if [ "$col" != "$column_name" ] ; then
+ echo -n ", $col"
+ fi
+ done | cut -c3-
+ IFS=" "
+}
+
+# 1.1. rename the original table to a temp name
+temp_table_name=`mktemp "$table_name"XXXXXXXX`
+msg=`$ksqlite "$temp_db" "ALTER TABLE '$table_name' RENAME TO '$temp_table_name';"`
+check "$msg"
+
+# 1.2. create a new table without the removed column and copy the data
+new_create_table_statement=`prepare_new_create_table_statement`
+msg=`$ksqlite "$temp_db" "CREATE TABLE '$table_name' ($new_create_table_statement);"`
+check "$msg"
+
+sql_column_names=`get_sql_column_names`
+msg=`$ksqlite "$temp_db" "INSERT INTO '$table_name' SELECT $sql_column_names FROM '$temp_table_name';"`
+check "$msg"
+
+# 1.3. drop the temporary table
+msg=`$ksqlite "$temp_db" "DROP TABLE '$temp_table_name';"`
+check "$msg"
+
+
+# 2. alter information in the kexi__fields system table (schema)
+
+# 2.1. Get table's ID
+table_id=`$ksqlite "$temp_db" "SELECT o_id FROM kexi__objects WHERE o_type=1 AND o_name='$table_name';" || exit_with_error`
+
+# 2.1. Get column's number
+column_order=`$ksqlite "$temp_db" "SELECT f_order FROM kexi__fields WHERE t_id=$table_id AND f_name='$column_name';" || exit_with_error`
+
+$ksqlite "$temp_db" "DELETE FROM kexi__fields WHERE t_id=$table_id AND f_name='$column_name';"
+
+for fname in `$ksqlite "$temp_db" \
+ "SELECT f_name FROM kexi__fields WHERE t_id=$table_id AND f_order>=$column_order ORDER BY f_order DESC;"` ; do
+ msg=`$ksqlite "$temp_db" "UPDATE kexi__fields SET f_order=$column_order WHERE t_id=$table_id AND f_name='$fname';"`
+ check "$msg"
+ column_order=`expr $column_order + 1`
+done
+
+# 3. Copy the original database file to .old file and replace
+# the original with the new one
+cp "$database_name" "$database_name.old" || exit_with_error
+mv "$temp_db" "$database_name" || exit_with_error
+
+exit 1
+
diff --git a/kexi/tools/delete_column/kexi_delete_column_gui b/kexi/tools/delete_column/kexi_delete_column_gui
new file mode 100755
index 00000000..0a87091c
--- /dev/null
+++ b/kexi/tools/delete_column/kexi_delete_column_gui
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# Copyright (C) 2006-2007 Jaroslaw Staniek <js@iidea.pl>
+#
+# This program 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 2 of the License, or (at your option) any later version.
+#
+# This program 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+#
+
+basedir=`dirname "$0"`
+
+setup_messages {
+ lang=`grep Language= ~/.kde/share/config/kdeglobals | head -n 1 | \
+ sed -e 's/Language=\(.*\):.*/\1/'`
+ if [ -z "$lang" ] ; then lang="en" ; fi
+
+ IFS=:
+ for dir in `kde-config --expandvars --path locale` ; do
+ transl_file="$dir"$lang"/LC_MESSAGES/kexi_delete_column_gui_transl_$lang.sh";
+ if [ -f "$transl_file" ] ; then
+ source "$transl_file"
+ break
+ else
+ transl_file=;
+ fi
+ done
+ IFS=" "
+ if [ -z "$transl_file" ] ; then
+ transl_file="$basedir/kexi_delete_column_gui_transl_$lang.sh";
+ if [ -f "$transl_file" ] ; then source "$transl_file"; else transl_file=; fi
+ fi
+echo $transl_file
+ if [ -z "$transl_file" ] ; then
+ # default: english messages:
+ msg_filters="*.kexi|Kexi Project stored in a file
+*.*|All files"
+ msg_select_db_file="Select database file"
+ msg_enter_table_name="Table name (not caption):"
+ msg_enter_column_name="Column name (not caption):"
+ fi
+} # /setup_messages
+
+setup_messages
+
+ksqlite="ksqlite -noheader"
+
+database_name=`kdialog --title "$msg_select_db_file" --getopenfilename . "$msg_filters"` || exit 1
+
+table_name=`kdialog --inputbox "$msg_enter_table_name"` || exit 1
+
+# show list of columns and ask for one
+
+msg=`$ksqlite "$database_name" "SELECT f_name FROM kexi__objects o, kexi__fields f WHERE o.o_id=f.t_id AND o.o_name='$table_name' AND o_type=1 ORDER BY f_order;" || exit 1`
+
+command_file=`mktemp "$database_name"XXXXXXXX`".sh"
+echo -n "kdialog --radiolist \"$msg_enter_column_name\"" > $command_file
+echo $msg | while read f ; do
+ echo -n " $f $f off" >> $command_file
+done
+
+column_name=`. $command_file || exit 1`
+rm -f $command_file
+
+# call the command line tool
+
+msg=`sh kexi_delete_column "$database_name" "$table_name" "$column_name" 2>&1`
+
+[ -z "$msg" ] && exit 0
+
+kdialog --error "$msg"
+exit 1
diff --git a/kexi/tools/delete_column/kexi_delete_column_gui_transl_pl.sh b/kexi/tools/delete_column/kexi_delete_column_gui_transl_pl.sh
new file mode 100644
index 00000000..ba46b949
--- /dev/null
+++ b/kexi/tools/delete_column/kexi_delete_column_gui_transl_pl.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Translation file for kexi_delete_column_gui
+
+msg_filters="*.kexi|Projekt Kexi zapisany w pliku
+*.*|Wszystkie pliki"
+
+msg_select_db_file="Wybierz plik bazy danych"
+msg_enter_table_name="Nazwa tabeli (nie tytuł):"
+msg_enter_column_name="Nazwa kolumny (nie tytuł):"
diff --git a/kexi/tools/feedback/create_kexifeedback.sh b/kexi/tools/feedback/create_kexifeedback.sh
new file mode 100644
index 00000000..074b5e3f
--- /dev/null
+++ b/kexi/tools/feedback/create_kexifeedback.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Small, simple and stupid script.
+# It grabs a local copy of kfeedbackwizard from anonsvn
+# and refactors KFeedbackWizard to KexiFeedbackWizard.
+# The files will be placed in the correct directory
+# so one can immediately use them.
+#
+# Copyright(C) 2005 by Christian Nitschkowski <segfault_ii@web.de>
+
+cd ../../3rdparty
+[ -d kexifeedbackwizard ] && echo "kexifeedbackwizard/ already exists: giving up" && exit 0
+
+echo Fetching kfeedbackwizard from anonsvn...
+
+svn checkout svn://anonsvn.kde.org/home/kde/trunk/playground/utils/kfeedbackwizard
+
+echo Refactoring KFeedbackWizard to KexiFeedbackWizard...
+
+cd kfeedbackwizard
+rm -rf .svn
+rm -rf po/.svn
+rm -rf lib/.svn
+cat configure.in.in | sed -e s/kfeedbackwizard/kexifeedbackwizard/ >configure.in.in.tmp
+mv configure.in.in.tmp configure.in.in
+cat Makefile.am | sed -e "s/SUBDIRS = po lib src/SUBDIRS = po lib/" >Makefile.am.tmp
+mv Makefile.am.tmp Makefile.am
+rm po/kfeedbackwizard.pot
+rm -rf src
+rm -rf templates
+rm kfeedbackwizard.kdevelop
+rm Doxyfile
+rm INSTALL
+rm NEWS
+cd lib
+for i in `ls -1 kfeedback*`; do
+ cat ${i} | sed -e "s/KFeedback/KexiFeedback/g;s/KFEEDBACK/KEXIFEEDBACK/g;s/kfeedback/kexifeedback/g" \
+ >$(echo ${i} | sed -e s/kfeedback/kexifeedback/)
+ rm ${i}
+done
+cat Makefile.am | sed -e s/kfeedback/kexifeedback/g >Makefile.am.tmp
+mv Makefile.am.tmp Makefile.am
+cd ../..
+mv kfeedbackwizard kexifeedbackwizard
+
+# Test if Makefile.am already contains a reference to the feedbackdir
+# If it's already there, stop here
+cat Makefile.am | grep FEEDBACKDIR && echo Done && cd ../tools/feedback && exit 0
+echo Adding kexifeedbackwizard to Makefile.am...
+echo -e "if use_kexifeedback\nFEEDBACKDIR = kexifeedbackwizard\nendif\n" >Makefile.am.tmp
+cat Makefile.am | sed -e "s/SUBDIRS = */SUBDIRS = \$(FEEDBACKDIR) /" >>Makefile.am.tmp
+mv Makefile.am Makefile.am.nofw
+mv Makefile.am.tmp Makefile.am
+cd ../tools/feedback
+echo Done
diff --git a/kexi/tools/sql_keywords/Makefile b/kexi/tools/sql_keywords/Makefile
new file mode 100644
index 00000000..353b5b1d
--- /dev/null
+++ b/kexi/tools/sql_keywords/Makefile
@@ -0,0 +1,30 @@
+KEXI_SQL_KEYWORDS=../../kexidb/keywords.cpp
+MYSQL_KEYWORDS=../../kexidb/drivers/mySQL/mysqlkeywords.cpp
+SQLITE3_KEYWORDS=../../kexidb/drivers/sqlite/sqlitekeywords.cpp
+PQXX_KEYWORDS=../../kexidb/drivers/pqxx/pqxxkeywords.cpp
+
+all: build
+
+build:
+ ./sql_keywords.sh
+
+install: ${KEXI_SQL_KEYWORDS} ${SQLITE3_KEYWORDS} \
+ ${MYSQL_KEYWORDS} ${PQXX_KEYWORDS}
+
+${MYSQL_KEYWORDS}: mysqlkeywords.cpp
+ cp mysqlkeywords.cpp ${MYSQL_KEYWORDS}
+
+
+${KEXI_SQL_KEYWORDS}: keywords.cpp
+ cp keywords.cpp ${KEXI_SQL_KEYWORDS}
+
+
+${SQLITE3_KEYWORDS}: sqlitekeywords.cpp
+ cp sqlitekeywords.cpp ${SQLITE3_KEYWORDS}
+
+${PQXX_KEYWORDS}: pqxxkeywords.cpp
+ cp pqxxkeywords.cpp ${PQXX_KEYWORDS}
+
+clean:
+ rm -f *.new *.all *.cpp *~
+.PHONY: clean kexi
diff --git a/kexi/tools/sql_keywords/kexi_reserved b/kexi/tools/sql_keywords/kexi_reserved
new file mode 100644
index 00000000..7b6a9d2e
--- /dev/null
+++ b/kexi/tools/sql_keywords/kexi_reserved
@@ -0,0 +1,58 @@
+# This file contains keywords that are resevered for use in Kexi SQL
+# They should be escaped when used as identifiers in databases.
+AFTER
+ALL
+ASC
+BEFORE
+BEGIN
+BETWEEN
+BY
+CASCADE
+CASE
+CHECK
+COLLATE
+COMMIT
+CONSTRAINT
+CROSS
+DATABASE
+DEFAULT
+DELETE
+DESC
+DISTINCT
+DROP
+END
+ELSE
+EXPLAIN
+FOR
+FOREIGN
+FULL
+GROUP
+HAVING
+IGNORE
+INDEX
+INNER
+INSERT
+INTO
+KEY
+LIMIT
+MATCH
+NATURAL
+OFFSET
+ORDER
+OUTER
+PRIMARY
+REFERENCES
+REPLACE
+RESTRICT
+ROLLBACK
+ROW
+SET
+TEMPORARY
+THEN
+TRANSACTION
+UNION
+UNIQUE
+UPDATE
+USING
+VALUES
+WHEN
diff --git a/kexi/tools/sql_keywords/sql_keywords.sh b/kexi/tools/sql_keywords/sql_keywords.sh
new file mode 100755
index 00000000..6a6cb003
--- /dev/null
+++ b/kexi/tools/sql_keywords/sql_keywords.sh
@@ -0,0 +1,299 @@
+#!/bin/bash
+################################################################################
+# sql_keywords.sh
+#
+# Generate sets of driver-specific keywords.
+# This program generates files that can be used as part of KexiDB drivers
+# that list keywords specific to that driver, i.e. words that have to be
+# escaped if they are to be used as identifiers in the database.
+#
+# It extracts keywords from the lexer of the DB sources, deletes keywords that
+# are already going to be escaped because they are part of Kexi's SQL dialect,
+# and writes the resulting keywords to a "char *keywords[]" construct in a .cpp
+# file that can then be used in the driver.
+#
+# To use:
+# Put the DB source tarballs (e.g. mysql-4.1.7.tar.gz,
+# postgresql-base-7.4.6.tar.gz) in the current directory
+# then run. (Makefile provided for installs)
+#
+# Sed, awk, grep have been used without much thought -
+# CHECK THE OUTPUT BEFORE INCLUDING IT IN A DRIVER!
+#
+# Martin Ellis <martin.ellis@kdemail.net>
+# 11/2004
+
+set -e
+progname="sql_keywords.sh"
+
+################################################################################
+# C++ file generator
+# params : array - scoped name of the array to generate
+# include - a file to include (or "" if none)
+# inFile - file containing raw keywords
+# outfile - file to write
+header () {
+ local array="$1"
+ local include="$2"
+ local inFile="$3"
+ local outFile="$4"
+ echo "Writing keywords in $inFile to $outFile"
+ cat <<EOF1 > "$outFile";
+ /*
+ * This file has been automatically generated from
+ * koffice/kexi/tools/sql_keywords/$progname and
+ * $inFile.
+ *
+ * Please edit the $progname, not this file!
+ */
+EOF1
+ if [ "$include" != "" ] ; then
+ echo "#include <$include>" >> "$outFile"
+ fi
+ cat <<EOF2 >> "$outFile";
+
+namespace KexiDB {
+ const char* ${array}[] = {
+EOF2
+}
+
+body() {
+ local inFile="$1"
+ local outFile="$2"
+ awk '/^[a-zA-Z_0-9]*/ { print "\t\t\""$$1"\","; } ' "$inFile" >> "$outFile"
+}
+
+footer() {
+ local outFile="$1"
+ cat <<EOF >> "$outFile";
+ 0
+ };
+}
+EOF
+
+}
+
+################################################################################
+# Keyword comparison functions
+# Globals: keywords
+
+# readKeywords
+# params: filename - file of keywords to read
+# sets: keywords - array of keywords in the file
+readKeywords () {
+ local filename="$1"
+ local kexiSQL="$2"
+ i=0
+ while read keyword ; do
+ keywords[$i]="$keyword"
+ (( i++ ))
+ done < "$filename"
+}
+
+# compareKeywords
+# reads: kexiSQL -
+# driverSQL
+# sets: keywords - driver keywords that are not keywords in Kexi
+compareKeywords () {
+ numFound=0
+ for(( i=0; i < ${#driverSQL[@]}; i++ )) ; do
+ found="no"
+ for(( j=0; j < ${#kexiSQL[@]}; j++ )) ; do
+ if [ "${driverSQL[$i]}" == "${kexiSQL[$j]}" ] ; then
+ found="yes"
+ fi
+ done
+ if [ "$found" == "no" ] ; then
+ keywords[$numFound]="${driverSQL[$i]}"
+ (( numFound++ ))
+ fi
+ done
+}
+
+
+# getDriverKeywords
+# params : kexi -
+# driver -
+# outFile -
+getDriverKeywords () {
+ local kexi="$1"
+ local driver="$2"
+ local outFile="$3"
+
+ declare -a kexiSQL
+ declare -a driverSQL
+
+ echo "Looking for driver-specific keywords in \"$driver\""
+ readKeywords $kexi
+ for(( i=0; i < ${#keywords[@]}; i++ )) ; do
+ kexiSQL[$i]=${keywords[$i]}
+ done
+ unset keywords
+
+ readKeywords $driver
+ for(( i=0; i < ${#keywords[@]}; i++ )) ; do
+ driverSQL[$i]=${keywords[$i]}
+ done
+ unset keywords
+
+ compareKeywords
+ echo "Writing driver-specific keywords for \"$driver\" to \"$outFile\""
+ rm -f $outFile
+ for(( i=0; i < ${#keywords[@]}; i++ )) ; do
+ echo ${keywords[$i]} >> $outFile
+ done
+ unset keywords
+}
+################################################################################
+
+
+################################################################################
+# Kexi lexer
+
+checkKexiKeywords () {
+ local scanner="../../kexidb/parser/sqlscanner.l"
+ if [ ! -r kexi.all -o "$scanner" -nt "kexi.all" ] ; then
+ echo "Getting Kexi keywords"
+ grep '^(\?"[a-zA-Z_0-9]' "$scanner" | \
+ sed 's/(\?"\([^"]*\)"[^"]*/\1\n/g' | \
+ awk '/^[a-zA-Z_0-9]+$/ {print $1;}' |
+ sort | uniq > "kexi.all"
+ awk '/^[a-zA-Z_0-9]+$/ {print $1;}' kexi_reserved >> "kexi.all"
+ fi
+}
+
+################################################################################
+# DB lexer functions
+# These functions munge the extracted lexers from DBs and write the collected
+# keywords to file
+
+# getSQLiteKeywords
+# params : inFile - SQLite3 lexer file
+# outFile - all SQLite3 keywords
+getSQLiteKeywords () {
+ local inFile="$1"
+ local outFile="$2"
+
+ echo "Getting SQLite keywords ($inFile -> $outFile)"
+ sed -n '/^static Keyword aKeywordTable/,/};/p' $inFile | \
+ awk '/ { "[a-zA-Z_0-9]*"/ { print $2;}' | \
+ sed 's/"\(.*\)".*/\1/g' > $outFile
+}
+
+getPostgreSQLKeywords () {
+ local inFile="$1"
+ local outFile="$2"
+
+ echo "Getting PostgreSQL keywords ($inFile -> $outFile)"
+ sed -n '/^static const ScanKeyword ScanKeywords/,/};/p' $inFile | \
+ awk '/\t{"[a-zA-Z_0-9]*"/ { print $1;}' | \
+ sed 's/.*"\(.*\)".*/\1/g' | tr 'a-z' 'A-Z' > $outFile
+}
+
+# getMySQLKeywords
+# params : inFile - MySQL lexer file
+# outFile - all MySQL keywords
+getMySQLKeywords () {
+ local inFile="$1"
+ local outFile="$2"
+
+ echo "Getting MySQL keywords ($inFile -> $outFile)"
+ sed -n '/^static SYMBOL symbols/,/};/p' $inFile | \
+ awk '/ { "[a-zA-Z_0-9]*"/ { print $2;}' | \
+ sed 's/"\(.*\)".*/\1/g' > $outFile
+}
+
+################################################################################
+# DB tarball functions
+# These functions extract the lexer files from the DB source tarballs
+
+# checkExtracted
+# params : tarball - tarball containing backend DB source
+# file - file in tarball containing DB's lexer
+checkExtracted () {
+ local tarball="$1"
+ local file="$2"
+
+ if [ ! -r "$file" ] ; then
+ echo "Getting file \"$file\" from \"$tarball\""
+ tar -zxf "$tarball" "$file"
+ fi
+}
+
+# checkTarballs
+checkTarballs () {
+ local pathInTar
+ local appName
+ local appVer
+
+ # SQLite (native DB backend) keywords
+ appName="SQLite"
+ appVer=sqlite
+ inFile="../../3rdparty/kexisql3/src/tokenize.c"
+ filePrefix="sqlite"
+ if [ ! -r "$appVer.all" ] || [ ! -r "$appVer.new" ] ; then
+ getSQLiteKeywords "$inFile" "$appVer.all"
+ fi
+ if [ "$appVer.all" -nt "$appVer.new" ] ; then
+ getDriverKeywords "kexi.all" "$appVer.all" "$appVer.new"
+ header "${appName}Driver::keywords" "${filePrefix}driver.h" "$inFile" "${filePrefix}keywords.cpp"
+ body "$appVer.new" "${filePrefix}keywords.cpp"
+ footer "${filePrefix}keywords.cpp"
+ fi
+
+ ls mysql-*.tar.gz postgresql-*.tar.gz 2>/dev/null | while read tarball ; do
+ case "$tarball" in
+ mysql-4.1.[0-9\.]*.tar.gz)
+ pathInTar="sql/lex.h"
+ appName="MySql"
+ filePrefix="mysql"
+ appVer="${tarball%.tar.gz}"
+ if [ ! -r "$appVer.all" ] || [ ! -r "$appVer.new" ] ; then
+ checkExtracted "$tarball" "$appVer/$pathInTar"
+ getMySQLKeywords "$appVer/$pathInTar" "$appVer.all"
+ rm -rf "$appVer"
+ fi
+
+ if [ "$appVer.all" -nt "$appVer.new" ] ; then
+ getDriverKeywords "kexi.all" "$appVer.all" "$appVer.new"
+ header "${appName}Driver::keywords" "${filePrefix}driver.h" "$appVer/$pathInTar" "${filePrefix}keywords.cpp"
+ body "$appVer.new" "${filePrefix}keywords.cpp"
+ footer "${filePrefix}keywords.cpp"
+ fi
+ ;;
+
+ postgresql-base-7.4.[0-9\.]*.tar.gz)
+ pathInTar="src/backend/parser/keywords.c"
+ appName="pqxxSql"
+ filePrefix="pqxx"
+ appVer=`echo "${tarball%.tar.gz}" | sed 's/-base//'`
+ if [ ! -r "$appVer.all" ] || [ ! -r "$appVer.new" ] ; then
+ checkExtracted "$tarball" "$appVer/$pathInTar"
+ getPostgreSQLKeywords "$appVer/$pathInTar" "$appVer.all"
+ rm -rf "$appVer"
+ fi
+
+ if [ "$appVer.all" -nt "$appVer.new" ] ; then
+ getDriverKeywords "kexi.all" "$appVer.all" "$appVer.new"
+ header "${appName}Driver::keywords" "${filePrefix}driver.h" "$appVer/$pathInTar" "${filePrefix}keywords.cpp"
+ body "$appVer.new" "${filePrefix}keywords.cpp"
+ footer "${filePrefix}keywords.cpp"
+ fi
+ ;;
+
+ *)
+ echo "Don't know how to deal with $tarball - ignoring"
+ ;;
+ esac
+ done
+}
+
+checkKexiKeywords
+src=`printf "koffice/kexi/kexidb/parser/sqlscanner.l\n"\
+" * and koffice/kexi/tools/sql_keywords/kexi__reserved"`
+header "DriverPrivate::kexiSQLKeywords" "driver_p.h" "$src" "keywords.cpp"
+body "kexi.all" "keywords.cpp"
+footer "keywords.cpp"
+
+checkTarballs
+wc -l *.all *.new | awk '{print $2" "$1}' |sort|awk '{print $1"\t"$2}'