Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
2c6d9b90
Vérifiée
Valider
2c6d9b90
rédigé
Il y a 3 ans
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
DB: Use the priority back propagation in the queue prev function
parent
2a7f7198
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!173
Update priority on next/prev operations
Modifications
2
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
2 fichiers modifiés
inc/lektor/internal/dbmacro.h
+5
-3
5 ajouts, 3 suppressions
inc/lektor/internal/dbmacro.h
src/database/queue.c
+17
-7
17 ajouts, 7 suppressions
src/database/queue.c
avec
22 ajouts
et
10 suppressions
inc/lektor/internal/dbmacro.h
+
5
−
3
Voir le fichier @
2c6d9b90
...
@@ -74,8 +74,10 @@
...
@@ -74,8 +74,10 @@
#define SQLITE_BEGIN_TRANSATION(db, error) SQLITE_EXEC(db, "BEGIN TRANSATION;", error)
#define SQLITE_BEGIN_TRANSATION(db, error) SQLITE_EXEC(db, "BEGIN TRANSATION;", error)
#define SQLITE_END_TRANSATION(db, error) SQLITE_EXEC(db, "END TRANSATION;", error)
#define SQLITE_END_TRANSATION(db, error) SQLITE_EXEC(db, "END TRANSATION;", error)
#define SQLITE_DO_ROLLBACK(db) \
#define SQLITE_DO_ROLLBACK(db) \
{ \
LOG_WARN("DB-DEBUG", "DO ROLLBACK \\o/"); \
LOG_WARN("DB-DEBUG", "DO ROLLBACK \\o/"); \
sqlite3_exec((sqlite3 *)db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL);
sqlite3_exec((sqlite3 *)db, "ROLLBACK TRANSACTION;\n", NULL, NULL, NULL); \
}
#define sqlite3_column_chars (const char *)sqlite3_column_text
#define sqlite3_column_chars (const char *)sqlite3_column_text
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/database/queue.c
+
17
−
7
Voir le fichier @
2c6d9b90
...
@@ -608,17 +608,18 @@ database_queue_prev(lkt_db *db, char filepath[PATH_MAX])
...
@@ -608,17 +608,18 @@ database_queue_prev(lkt_db *db, char filepath[PATH_MAX])
" END"
" END"
" ORDER BY position DESC LIMIT 1;"
;
" ORDER BY position DESC LIMIT 1;"
;
char
SQL_UPDATE
[
LKT_MAX_SQLITE_STATEMENT
];
char
SQL_UPDATE
[
LKT_MAX_SQLITE_STATEMENT
];
bool
status
=
false
;
int
code
=
SQLITE_OK
;
int
code
=
SQLITE_OK
,
id
;
sqlite3_stmt
*
stmt
=
NULL
;
sqlite3_stmt
*
stmt
=
NULL
;
SQLITE_BEGIN_TRANSATION
(
db
,
error_failed_to_begin_transaction
);
SQLITE_PREPARE
(
db
,
stmt
,
SQL_STMT
,
error
);
SQLITE_PREPARE
(
db
,
stmt
,
SQL_STMT
,
error
);
code
=
sqlite3_step
(
stmt
);
code
=
sqlite3_step
(
stmt
);
if
(
code
==
SQLITE_ROW
)
{
if
(
code
==
SQLITE_ROW
)
{
i
d
=
MAX
(
1
,
sqlite3_column_int
(
stmt
,
1
));
i
nt
id
=
MAX
(
1
,
sqlite3_column_int
(
stmt
,
1
));
s
afe_snprintf
(
SQL_UPDATE
,
LKT_MAX_SQLITE_STATEMENT
,
"UPDATE queue_state SET current = %d;"
,
s
tatic
const
char
*
SQL_TMPL_UPDATE
=
"UPDATE queue_state SET current = %d;"
;
id
);
safe_snprintf
(
SQL_UPDATE
,
LKT_MAX_SQLITE_STATEMENT
,
SQL_TMPL_UPDATE
,
id
);
if
(
filepath
!=
NULL
)
if
(
filepath
!=
NULL
)
strncpy
(
filepath
,
sqlite3_column_chars
(
stmt
,
0
),
PATH_MAX
-
1
);
strncpy
(
filepath
,
sqlite3_column_chars
(
stmt
,
0
),
PATH_MAX
-
1
);
...
@@ -639,10 +640,19 @@ database_queue_prev(lkt_db *db, char filepath[PATH_MAX])
...
@@ -639,10 +640,19 @@ database_queue_prev(lkt_db *db, char filepath[PATH_MAX])
}
}
SQLITE_EXEC
(
db
,
SQL_UPDATE
,
error
);
SQLITE_EXEC
(
db
,
SQL_UPDATE
,
error
);
status
=
true
;
unless
(
___database_back_propagate_priority
(
db
))
goto
error
;
sqlite3_finalize
(
stmt
);
SQLITE_END_TRANSATION
(
db
,
error
);
return
true
;
error:
error:
SQLITE_DO_ROLLBACK
(
db
);
sqlite3_finalize
(
stmt
);
sqlite3_finalize
(
stmt
);
return
status
;
return
false
;
error_failed_to_begin_transaction:
return
false
;
}
}
bool
bool
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter