Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CI320
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Wellington Gabriel Vicente de Souza
CI320
Commits
dc7fa39a
Commit
dc7fa39a
authored
7 years ago
by
Wellington Gabriel Vicente de Souza
Browse files
Options
Downloads
Patches
Plain Diff
fix some argument related issues
parent
d24724f6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
T2/steamdb.rb
+26
-8
26 additions, 8 deletions
T2/steamdb.rb
with
26 additions
and
8 deletions
T2/steamdb.rb
+
26
−
8
View file @
dc7fa39a
...
@@ -29,7 +29,7 @@ def parse_input (string)
...
@@ -29,7 +29,7 @@ def parse_input (string)
if
!
begin_quote
if
!
begin_quote
args
[
i
]
=
arg
args
[
i
]
=
arg
els
if
els
e
puts
"Erro de Síntaxe: Aspas não encontradas."
puts
"Erro de Síntaxe: Aspas não encontradas."
args
=
[]
args
=
[]
end
end
...
@@ -264,7 +264,6 @@ def select_rows(tabela, args)
...
@@ -264,7 +264,6 @@ def select_rows(tabela, args)
error
=
true
error
=
true
end
end
else
else
puts
"foi no select"
puts
"Atributo
#{
x
[
0
]
}
não encontrado."
puts
"Atributo
#{
x
[
0
]
}
não encontrado."
error
=
true
error
=
true
end
end
...
@@ -446,8 +445,8 @@ def exclui(tabela, args)
...
@@ -446,8 +445,8 @@ def exclui(tabela, args)
selected
.
each
do
|
d
|
selected
.
each
do
|
d
|
d
.
destroy
d
.
destroy
end
end
puts
"
#{
selected
.
length
}
linha(s) deletada(s) da tabela
#{
tabela
}
!"
end
end
puts
"
#{
selected
.
length
}
linha(s) deletada(s) da tabela
#{
tabela
}
!"
end
end
def
altera
(
tabela
,
args
)
def
altera
(
tabela
,
args
)
...
@@ -662,6 +661,7 @@ def altera(tabela, args)
...
@@ -662,6 +661,7 @@ def altera(tabela, args)
end
end
def
lista
(
tabela
)
def
lista
(
tabela
)
error
=
false
case
tabela
case
tabela
when
"developers"
when
"developers"
lista
=
Developer
.
all
lista
=
Developer
.
all
...
@@ -695,8 +695,9 @@ def lista(tabela)
...
@@ -695,8 +695,9 @@ def lista(tabela)
end
end
else
else
puts
"Tabela
#{
tabela
}
não encontrada."
puts
"Tabela
#{
tabela
}
não encontrada."
error
=
true
end
end
if
(
tabela
)
if
!
error
puts
"Tabela
#{
tabela
}
listada com sucesso!"
puts
"Tabela
#{
tabela
}
listada com sucesso!"
end
end
end
end
...
@@ -708,14 +709,31 @@ while true do
...
@@ -708,14 +709,31 @@ while true do
if
args
.
length
>
0
if
args
.
length
>
0
case
args
[
0
]
case
args
[
0
]
when
"insere"
when
"insere"
if
args
.
length
>
2
insere
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
insere
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
else
puts
"Erro: não há parâmetros o suficiente para inserir um novo elemento."
end
when
"exclui"
when
"exclui"
if
args
.
length
>
1
exclui
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
exclui
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
else
puts
"Erro: não há parâmetros o suficiente para excluir um elemento."
end
when
"altera"
when
"altera"
if
args
.
length
>
3
altera
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
altera
(
args
[
1
],
args
[
2
..
args
.
length
-
1
])
else
puts
"Erro: não há parâmetros o suficiente para atualizar a tabela."
end
when
"lista"
when
"lista"
if
args
.
length
==
2
lista
(
args
[
1
])
lista
(
args
[
1
])
else
puts
"Erro: número inválido de parâmetros."
end
when
"sair"
when
"sair"
puts
"Bye! :)"
exit
()
exit
()
else
else
puts
"Comando não encontrado."
puts
"Comando não encontrado."
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment