Difference between revisions of "Export Paradox Data"
From reBiND Documentation
(save working copy) |
(complete script added) |
||
Line 58: | Line 58: | ||
//TODO SQL Join script | //TODO SQL Join script | ||
//TODO encoding | //TODO encoding | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang="bash" enclose="pre"> | ||
+ | #!/bin/sh | ||
+ | # parameters: $1=database_name $2=Paradox_File_Encoding | ||
+ | |||
+ | if [ ! -d "sql" ]; then | ||
+ | echo "creating 'sql' directory" | ||
+ | mkdir sql | ||
+ | fi | ||
+ | DBFILES=`find -maxdepth 1 \( -name "*.DB" ! -name "BDS_*" \) ` | ||
+ | |||
+ | for i in $DBFILES | ||
+ | do | ||
+ | echo | ||
+ | echo "#############################" | ||
+ | echo "# Exporting $i" | ||
+ | echo "#############################" | ||
+ | pxsqldump -d mysql -f $i -b $(echo "$i" | sed -e 's/\.DB$/\.MB/') -n $1.$(echo "$i" | tr '[:upper:]' '[:lower:]'| sed -e 's/\.db$//' | sed -e 's/.*\///') > sql/$(echo "$i" | tr '[:upper:]' '[:lower:]'| sed -e 's/\.db$//' | sed -e 's/.*\///').sql | ||
+ | done | ||
+ | |||
+ | cd sql | ||
+ | if [ ! -d "converted" ]; then | ||
+ | mkdir converted | ||
+ | fi | ||
+ | SQLFILES=`find -maxdepth 1 \( -name "*.sql" ! -name "BDS_*" \)` | ||
+ | |||
+ | for i in $SQLFILES | ||
+ | do | ||
+ | echo "Converting $i" | ||
+ | iconv -f $2 -t UTF-8 < $i > converted/$i | ||
+ | done | ||
+ | |||
+ | cd converted | ||
+ | echo | ||
+ | echo "Joining SQL Files" | ||
+ | echo "CREATE DATABASE IF NOT EXISTS $1 ;" > $1.sql.tmp | ||
+ | echo "USE $1 ;" >> $1.sql.tmp | ||
+ | echo >> $1.sql.tmp | ||
+ | echo >> $1.sql.tmp | ||
+ | |||
+ | SQLFILES=`find \( -name "*.sql" ! -name "BDS_*" ! -name "$1.sql" \)` | ||
+ | |||
+ | for i in $SQLFILES | ||
+ | do | ||
+ | cat $i >> $1.sql.tmp | ||
+ | echo >> $1.sql.tmp | ||
+ | echo >> $1.sql.tmp | ||
+ | echo $i | ||
+ | done | ||
+ | echo "" >> $1.sql.tmp | ||
+ | mv $1.sql.tmp ../../$1.sql | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | px2sql-all.sh ornithol CP437 |
Revision as of 13:59, 11 June 2012
This article describes how to export data from Paradox Database files, based on the data set provided by the Museum König.
Contents
Introduction
Further Reading
Viewing the Data
- Paradox dbase Reader
- Paradox Viewer 30 day trial version
Paradox 5.0 and 7.0: jIGGAe
or cupcdvum
Paradox 4.0: nx66ppx
Removing Password Protection
Documenting Table Relations
Exporting the data
Installing PX Tools
tar -zxvf pxtools-0.0.20.tar.gz
cd pxtools-0.0.20/
./configure
sudo make
sudo make install
sudo make clean
pxinfo -f COLEOPTE_DATA.DB
pxsqldump -d mysql -f COLEOPTE_DATA.DB -b COLEOPTE_DATA.MB -d coleopte_data> COLEOPTE_DATA.sql
pxconvert.c.477: Read less than requested pxconvert.c.483: Extract failed: `���A�f,<�� != pxconvert.c.477: Read less than requested Speicherzugriffsfehler (Speicherabzug geschrieben)
#!/bin/sh
if [ ! -d "sql" ]; then
mkdir sql
fi
echo
echo "#############################"
echo "# Exporting $1"
echo "#############################"
pxsqldump -d mysql -f $1 -b $(echo "$1" | sed -e 's/\.DB$/\.MB/') -n $(echo "$1" | tr '[:upper:]' '[:lower:]'| sed -e 's/\.db$//' | sed -e 's/.*\///') > sql/$1.sql
PATH=$PATH:~/bin chmod +x ~/bin/px2sql.sh find -name '*.DB' -exec px2sql.sh {} \;
//TODO SQL Join script //TODO encoding
#!/bin/sh
# parameters: $1=database_name $2=Paradox_File_Encoding
if [ ! -d "sql" ]; then
echo "creating 'sql' directory"
mkdir sql
fi
DBFILES=`find -maxdepth 1 \( -name "*.DB" ! -name "BDS_*" \) `
for i in $DBFILES
do
echo
echo "#############################"
echo "# Exporting $i"
echo "#############################"
pxsqldump -d mysql -f $i -b $(echo "$i" | sed -e 's/\.DB$/\.MB/') -n $1.$(echo "$i" | tr '[:upper:]' '[:lower:]'| sed -e 's/\.db$//' | sed -e 's/.*\///') > sql/$(echo "$i" | tr '[:upper:]' '[:lower:]'| sed -e 's/\.db$//' | sed -e 's/.*\///').sql
done
cd sql
if [ ! -d "converted" ]; then
mkdir converted
fi
SQLFILES=`find -maxdepth 1 \( -name "*.sql" ! -name "BDS_*" \)`
for i in $SQLFILES
do
echo "Converting $i"
iconv -f $2 -t UTF-8 < $i > converted/$i
done
cd converted
echo
echo "Joining SQL Files"
echo "CREATE DATABASE IF NOT EXISTS $1 ;" > $1.sql.tmp
echo "USE $1 ;" >> $1.sql.tmp
echo >> $1.sql.tmp
echo >> $1.sql.tmp
SQLFILES=`find \( -name "*.sql" ! -name "BDS_*" ! -name "$1.sql" \)`
for i in $SQLFILES
do
cat $i >> $1.sql.tmp
echo >> $1.sql.tmp
echo >> $1.sql.tmp
echo $i
done
echo "" >> $1.sql.tmp
mv $1.sql.tmp ../../$1.sql
px2sql-all.sh ornithol CP437