Issue #16: Add UTF8 encoding

Signed-off-by: Lucas Fernandes de Oliveira's avatarLucas Fernandes de Oliveira <lfoliveira@inf.ufpr.br>
parent 78d3c885
Pipeline #21065 passed with stage
in 1 minute and 7 seconds
......@@ -5,7 +5,7 @@ cleanDB() {
# Get all deletable tables fron DB
tables=$(getTables)
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/trans.sql"
......
......@@ -15,21 +15,20 @@ createDB() {
schemaFiles="$schemaFiles $workspace/$f"
done
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
# Create temporary workspace
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/begin.sql"
commitTrans > "$tmpWS/commit.sql"
mkfifo "$tmpWS/trans.fifo"
touch $tmpWS/error.out
# Concats the transaction and schema files
cat "$tmpWS/begin.sql"\
$schemaFiles\
"$tmpWS/commit.sql"\
> "$tmpWS/trans.fifo"
tail -n20 "$tmpWS/trans.fifo"
> "$tmpWS/trans.fifo"&
# Performs schema creation. As is in a transaction if fails it will
# NOT leave the database inconsistent.
......
......@@ -7,7 +7,7 @@ execFile() {
if [[ ${DBMS} == "psql" ]]; then
PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -f $file 2> $error
elif [[ ${DBMS} == "monet" ]]; then
DOTMONETDBFILE=$DOTMONETDBFILE mclient < $file 2> $error
DOTMONETDBFILE=$DOTMONETDBFILE mclient -E "UTF8" < $file 2> $error
fi
}
......@@ -18,7 +18,7 @@ execStatement() {
if [[ ${DBMS} == "psql" ]]; then
PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -c "$statement"
elif [[ ${DBMS} == "monet" ]]; then
echo "$statement" | DOTMONETDBFILE=$DOTMONETDBFILE mclient -i
echo "$statement" | DOTMONETDBFILE=$DOTMONETDBFILE mclient -i -E "UTF8"
fi
}
......
......@@ -4,7 +4,7 @@
dropDB() {
tables=$(getTables)
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/trans.sql"
......
......@@ -11,8 +11,8 @@ fixtureDB() {
cleanDB
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
# Create temporary workspace
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/trans.sql"
i=0
......
......@@ -6,8 +6,8 @@ loadDB() {
ws=${1:-"./data"}
workspace="$ws/load"
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
# Create temporary workspace
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/trans.sql"
tables=$(ls -1 $workspace | grep ".bz2" | rev | cut -f4- -d\. | rev)
......
#! /bin/bash
# Creates a temporary workspace directory
createTmpWorkspace() {
mktemp -d
}
# Check if the environment vars are set
correctEnv() {
vars="DB_HOST DB_NAME DB_USER DB_PASSWORD"
......@@ -20,8 +15,8 @@ correctEnv() {
# Updates the sequence tables. Used to fix serial data after copy
updateSequences() {
# Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace)
# Create temporary workspace
tmpWS=$(mktemp -d)
# Create transactions files
beginTrans > "$tmpWS/seq-trans.sql"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment