Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pedot Nicola
semint-kprime
Commits
f7a4324d
Commit
f7a4324d
authored
Oct 09, 2020
by
npedot
Browse files
adds if not exists to sql create table
parent
6c223d51
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/unibz.cs.semint.kprime/usecase/common/SQLizeCreateUseCase.kt
View file @
f7a4324d
...
...
@@ -69,10 +69,12 @@ class SQLizeCreateUseCase {
private
fun
createTableCommand
(
createTable
:
CreateTable
):
String
{
var
cols
=
" "
for
(
col
in
createTable
.
columns
)
{
cols
+=
"${col.name} ${col.dbtype} ,"
var
colType
=
col
.
dbtype
if
(
colType
==
null
||
colType
.
trim
().
isEmpty
())
colType
=
"varchar(64)"
cols
+=
"${col.name} ${colType} ,"
}
cols
=
cols
.
dropLast
(
2
)
return
"CREATE TABLE ${createTable.name} ($cols);"
return
"CREATE TABLE
IF NOT EXISTS
${createTable.name} ($cols);"
}
private
fun
createViewCommand
(
createView
:
CreateView
):
String
{
...
...
Write
Preview
Supports
Markdown
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