Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Romain De Laage De Bellefaye
LO21-projet
Commits
d1f25cea
Verified
Commit
d1f25cea
authored
Jun 11, 2021
by
Romain De Laage De Bellefaye
🌳
Browse files
Add more explicits error for database and make init of griffeath works
parent
6e0145ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
application.db
View file @
d1f25cea
No preview for this file type
sql/Griffeath.sql
View file @
d1f25cea
...
...
@@ -432,6 +432,6 @@ INSERT INTO Cellules VALUES(
INSERT
INTO
Cellules
VALUES
(
2
,
3
,
3
,
4
,
4
);
src/autosql.cpp
View file @
d1f25cea
...
...
@@ -48,7 +48,7 @@ void Database::initEnsEtat(Automate& a) const {
query
.
exec
();
if
(
!
query
.
first
())
throw
"Unable to select this object"
;
throw
"Unable to select this object
(ensemble)
"
;
EnsembleEtat
&
ens
=
a
.
getEnsemble
();
ens
.
reset
();
...
...
@@ -75,7 +75,7 @@ Fonction* Database::getFonction(Automate& a) const {
query
.
exec
();
if
(
!
query
.
first
())
throw
"Unable to select this object"
;
throw
"Unable to select this object
(function)
"
;
Fonction
*
fonction
=
new
Fonction
(
a
.
getEnsemble
().
getEtat
(
query
.
value
(
"defaut"
).
toInt
()));
...
...
@@ -162,7 +162,7 @@ RegleVoisinage* Database::getRegleVoisinage(const QString& name) const {
query
.
exec
();
if
(
!
query
.
first
())
throw
"Unable to select this object"
;
throw
"Unable to select this object
(neighbourhood)
"
;
int
type
=
query
.
value
(
"type"
).
toInt
();
...
...
@@ -235,7 +235,7 @@ Reseau& Database::getReseau(int idReseau) const {
reseau
.
bindValue
(
":id"
,
idReseau
);
reseau
.
exec
();
if
(
!
reseau
.
first
())
throw
"Can't select!"
;
throw
"Can't select
(reseau)
!"
;
Reseau
*
r
=
new
Reseau
(
reseau
.
value
(
"h"
).
toUInt
(),
reseau
.
value
(
"l"
).
toUInt
());
//remplissage du réseau
...
...
@@ -250,7 +250,7 @@ Reseau& Database::getReseau(int idReseau) const {
cellule
.
bindValue
(
":j"
,
static_cast
<
int
>
(
j
));
cellule
.
exec
();
if
(
!
cellule
.
first
())
throw
"Can't select!"
;
throw
"Can't select
(cell)
!"
;
while
(
static_cast
<
int
>
(
r
->
getReseau
()[
i
][
j
].
getIndEtat
())
!=
cellule
.
value
(
"etat"
).
toInt
())
r
->
getReseau
()[
i
][
j
].
incrementerEtat
();
}
...
...
@@ -498,7 +498,7 @@ void Database::initSingletonAutomate(const QString& modele) const
reseau
.
exec
();
if
(
!
reseau
.
first
())
throw
"Can't select!"
;
throw
"Can't select
(automaton)
!"
;
Automate
::
getInstance
().
setTitle
(
reseau
.
value
(
0
).
toString
().
toStdString
());
Automate
::
getInstance
().
setAuthor
(
reseau
.
value
(
1
).
toString
().
toStdString
());
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment