Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
usql-manager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
C3SL
usql-manager
Commits
6544c302
Commit
6544c302
authored
Jul 25, 2019
by
Lucas Fernandes de Oliveira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#16
: Add UTF8 encoding
Signed-off-by:
Lucas Fernandes de Oliveira
<
lfoliveira@inf.ufpr.br
>
parent
78d3c885
Pipeline
#21065
passed with stage
in 1 minute and 7 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
20 deletions
+14
-20
src/clean.sh
src/clean.sh
+1
-1
src/create.sh
src/create.sh
+4
-5
src/dbms.sh
src/dbms.sh
+2
-2
src/drop.sh
src/drop.sh
+1
-1
src/fixture.sh
src/fixture.sh
+2
-2
src/load.sh
src/load.sh
+2
-2
src/utils.sh
src/utils.sh
+2
-7
No files found.
src/clean.sh
View file @
6544c302
...
...
@@ -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"
...
...
src/create.sh
View file @
6544c302
...
...
@@ -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.
...
...
src/dbms.sh
View file @
6544c302
...
...
@@ -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
}
...
...
src/drop.sh
View file @
6544c302
...
...
@@ -4,7 +4,7 @@
dropDB
()
{
tables
=
$(
getTables
)
# Create temporary workspace (utility function)
tmpWS
=
$(
createTmpWorkspace
)
tmpWS
=
$(
mktemp
-d
)
# Create transactions files
beginTrans
>
"
$tmpWS
/trans.sql"
...
...
src/fixture.sh
View file @
6544c302
...
...
@@ -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
...
...
src/load.sh
View file @
6544c302
...
...
@@ -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
)
...
...
src/utils.sh
View file @
6544c302
#! /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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment