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
36f67c08
Vérifiée
Valider
36f67c08
rédigé
18 nov. 2021
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
LIB: Add functions to accept string views in other lektor parts
parent
7a01d701
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!177
Add the query to the `update` command to filter karas to update
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
inc/lektor/database.h
+2
-0
2 ajouts, 0 suppression
inc/lektor/database.h
inc/lektor/internal/dbmacro.h
+9
-0
9 ajouts, 0 suppression
inc/lektor/internal/dbmacro.h
src/database/config.c
+32
-0
32 ajouts, 0 suppression
src/database/config.c
avec
43 ajouts
et
0 suppression
inc/lektor/database.h
+
2
−
0
Voir le fichier @
36f67c08
...
...
@@ -8,6 +8,7 @@ extern "C" {
#include
<lektor/common.h>
#include
<lektor/mkv.h>
#include
<lektor/uri.h>
#include
<lektor/lib/strv.h>
#include
<sqlite3.h>
#include
<mpv/client.h>
...
...
@@ -181,6 +182,7 @@ bool database_queue_skip_current(lkt_db *db, char filepath[PATH_MAX]);
/* Set a value in the config table */
bool
database_validate_conf
(
lkt_db
*
db
);
bool
database_config_set
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
const
char
*
value
);
bool
database_config_set_strv_1_2
(
lkt_db
*
db
,
const
char
*
section
,
const
struct
strv
,
const
struct
strv
);
bool
database_config_get_text
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
char
*
value
,
size_t
len
);
bool
database_config_get_text_nospace
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
char
*
value
,
size_t
len
);
bool
database_config_get_int
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
int
*
value
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
inc/lektor/internal/dbmacro.h
+
9
−
0
Voir le fichier @
36f67c08
...
...
@@ -35,6 +35,15 @@ bool database_unprotected_attach(lkt_db *, const char *, const char *);
} \
}
#define SQLITE_BIND_STRV(db, stmt, pos, strv, error) \
{ \
if (sqlite3_bind_text(stmt, pos, (strv).data, (strv).count, 0) != SQLITE_OK) { \
___LOCAL_DEBUG("Failed to bind text " STRV_FMT " at pos %d: %s", STRV_ARG(strv), pos, \
sqlite3_errmsg((sqlite3 *)db)); \
goto error; \
} \
}
#define SQLITE_BIND_INT(db, stmt, pos, integer, error) \
{ \
if (sqlite3_bind_int(stmt, pos, integer) != SQLITE_OK) { \
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/database/config.c
+
32
−
0
Voir le fichier @
36f67c08
#include
<lektor/common.h>
#include
<lektor/database.h>
#include
<lektor/lib/strv.h>
#include
<lektor/internal/dbmacro.h>
bool
database_config_set_strv_1_2
(
lkt_db
*
db
,
const
char
*
section
,
const
struct
strv
key
,
const
struct
strv
value
)
{
static
const
char
*
SQL_STMT
=
"INSERT OR REPLACE INTO"
" config (section, key, value)"
" VALUES (?, ?, ?);
\n
"
;
sqlite3_stmt
*
stmt
=
0
;
bool
ret
=
false
;
int
code
;
SQLITE_PREPARE
(
db
,
stmt
,
SQL_STMT
,
error
);
SQLITE_BIND_TEXT
(
db
,
stmt
,
1
,
section
,
error
);
SQLITE_BIND_STRV
(
db
,
stmt
,
2
,
key
,
error
);
SQLITE_BIND_STRV
(
db
,
stmt
,
3
,
value
,
error
);
code
=
sqlite3_step
(
stmt
);
if
(
code
!=
SQLITE_OK
&&
code
!=
SQLITE_DONE
)
{
LOG_ERROR
(
"DB"
,
"Failed to insert or replace: %s"
,
sqlite3_errmsg
((
sqlite3
*
)
db
));
goto
error
;
}
LOG_DEBUG
(
"CONFIG"
,
"Set [%s/"
STRV_FMT
"] to "
STRV_FMT
,
section
,
STRV_ARG
(
key
),
STRV_ARG
(
value
));
ret
=
true
;
error:
sqlite3_finalize
(
stmt
);
return
ret
;
}
bool
database_config_set
(
lkt_db
*
db
,
const
char
*
section
,
const
char
*
key
,
const
char
*
value
)
{
...
...
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