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() { ...@@ -5,7 +5,7 @@ cleanDB() {
# Get all deletable tables fron DB # Get all deletable tables fron DB
tables=$(getTables) tables=$(getTables)
# Create temporary workspace (utility function) # Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/trans.sql" beginTrans > "$tmpWS/trans.sql"
......
...@@ -15,21 +15,20 @@ createDB() { ...@@ -15,21 +15,20 @@ createDB() {
schemaFiles="$schemaFiles $workspace/$f" schemaFiles="$schemaFiles $workspace/$f"
done done
# Create temporary workspace (utility function) # Create temporary workspace
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/begin.sql" beginTrans > "$tmpWS/begin.sql"
commitTrans > "$tmpWS/commit.sql" commitTrans > "$tmpWS/commit.sql"
mkfifo "$tmpWS/trans.fifo"
touch $tmpWS/error.out touch $tmpWS/error.out
# Concats the transaction and schema files # Concats the transaction and schema files
cat "$tmpWS/begin.sql"\ cat "$tmpWS/begin.sql"\
$schemaFiles\ $schemaFiles\
"$tmpWS/commit.sql"\ "$tmpWS/commit.sql"\
> "$tmpWS/trans.fifo" > "$tmpWS/trans.fifo"&
tail -n20 "$tmpWS/trans.fifo"
# Performs schema creation. As is in a transaction if fails it will # Performs schema creation. As is in a transaction if fails it will
# NOT leave the database inconsistent. # NOT leave the database inconsistent.
......
...@@ -7,7 +7,7 @@ execFile() { ...@@ -7,7 +7,7 @@ execFile() {
if [[ ${DBMS} == "psql" ]]; then if [[ ${DBMS} == "psql" ]]; then
PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -f $file 2> $error PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -f $file 2> $error
elif [[ ${DBMS} == "monet" ]]; then elif [[ ${DBMS} == "monet" ]]; then
DOTMONETDBFILE=$DOTMONETDBFILE mclient < $file 2> $error DOTMONETDBFILE=$DOTMONETDBFILE mclient -E "UTF8" < $file 2> $error
fi fi
} }
...@@ -18,7 +18,7 @@ execStatement() { ...@@ -18,7 +18,7 @@ execStatement() {
if [[ ${DBMS} == "psql" ]]; then if [[ ${DBMS} == "psql" ]]; then
PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -c "$statement" PGPASSFILE=$PGPASSFILE psql -d ${DB_NAME} -U ${DB_USER} -h ${DB_HOST} -c "$statement"
elif [[ ${DBMS} == "monet" ]]; then elif [[ ${DBMS} == "monet" ]]; then
echo "$statement" | DOTMONETDBFILE=$DOTMONETDBFILE mclient -i echo "$statement" | DOTMONETDBFILE=$DOTMONETDBFILE mclient -i -E "UTF8"
fi fi
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
dropDB() { dropDB() {
tables=$(getTables) tables=$(getTables)
# Create temporary workspace (utility function) # Create temporary workspace (utility function)
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/trans.sql" beginTrans > "$tmpWS/trans.sql"
......
...@@ -11,8 +11,8 @@ fixtureDB() { ...@@ -11,8 +11,8 @@ fixtureDB() {
cleanDB cleanDB
# Create temporary workspace (utility function) # Create temporary workspace
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/trans.sql" beginTrans > "$tmpWS/trans.sql"
i=0 i=0
......
...@@ -6,8 +6,8 @@ loadDB() { ...@@ -6,8 +6,8 @@ loadDB() {
ws=${1:-"./data"} ws=${1:-"./data"}
workspace="$ws/load" workspace="$ws/load"
# Create temporary workspace (utility function) # Create temporary workspace
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/trans.sql" beginTrans > "$tmpWS/trans.sql"
tables=$(ls -1 $workspace | grep ".bz2" | rev | cut -f4- -d\. | rev) tables=$(ls -1 $workspace | grep ".bz2" | rev | cut -f4- -d\. | rev)
......
#! /bin/bash #! /bin/bash
# Creates a temporary workspace directory
createTmpWorkspace() {
mktemp -d
}
# Check if the environment vars are set # Check if the environment vars are set
correctEnv() { correctEnv() {
vars="DB_HOST DB_NAME DB_USER DB_PASSWORD" vars="DB_HOST DB_NAME DB_USER DB_PASSWORD"
...@@ -20,8 +15,8 @@ correctEnv() { ...@@ -20,8 +15,8 @@ correctEnv() {
# Updates the sequence tables. Used to fix serial data after copy # Updates the sequence tables. Used to fix serial data after copy
updateSequences() { updateSequences() {
# Create temporary workspace (utility function) # Create temporary workspace
tmpWS=$(createTmpWorkspace) tmpWS=$(mktemp -d)
# Create transactions files # Create transactions files
beginTrans > "$tmpWS/seq-trans.sql" 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