Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
c88d5616
Commit
c88d5616
authored
Apr 25, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sticker/Database: move sticker_prepare() to lib/sqlite/Util.hxx
parent
34d483a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
Util.hxx
src/lib/sqlite/Util.hxx
+12
-0
Database.cxx
src/sticker/Database.cxx
+1
-13
No files found.
src/lib/sqlite/Util.hxx
View file @
c88d5616
...
@@ -28,6 +28,18 @@
...
@@ -28,6 +28,18 @@
namespace
Sqlite
{
namespace
Sqlite
{
static
inline
sqlite3_stmt
*
Prepare
(
sqlite3
*
db
,
const
char
*
sql
)
{
sqlite3_stmt
*
stmt
;
int
ret
=
sqlite3_prepare_v2
(
db
,
sql
,
-
1
,
&
stmt
,
nullptr
);
if
(
ret
!=
SQLITE_OK
)
throw
SqliteError
(
db
,
ret
,
"sqlite3_prepare_v2() failed"
);
return
stmt
;
}
/**
/**
* Throws #SqliteError on error.
* Throws #SqliteError on error.
*/
*/
...
...
src/sticker/Database.cxx
View file @
c88d5616
...
@@ -83,18 +83,6 @@ static const char sticker_sql_create[] =
...
@@ -83,18 +83,6 @@ static const char sticker_sql_create[] =
static
sqlite3
*
sticker_db
;
static
sqlite3
*
sticker_db
;
static
sqlite3_stmt
*
sticker_stmt
[
ARRAY_SIZE
(
sticker_sql
)];
static
sqlite3_stmt
*
sticker_stmt
[
ARRAY_SIZE
(
sticker_sql
)];
static
sqlite3_stmt
*
sticker_prepare
(
const
char
*
sql
)
{
sqlite3_stmt
*
stmt
;
int
ret
=
sqlite3_prepare_v2
(
sticker_db
,
sql
,
-
1
,
&
stmt
,
nullptr
);
if
(
ret
!=
SQLITE_OK
)
throw
SqliteError
(
sticker_db
,
ret
,
"sqlite3_prepare_v2() failed"
);
return
stmt
;
}
void
void
sticker_global_init
(
Path
path
)
sticker_global_init
(
Path
path
)
{
{
...
@@ -125,7 +113,7 @@ sticker_global_init(Path path)
...
@@ -125,7 +113,7 @@ sticker_global_init(Path path)
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
sticker_sql
);
++
i
)
{
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
sticker_sql
);
++
i
)
{
assert
(
sticker_sql
[
i
]
!=
nullptr
);
assert
(
sticker_sql
[
i
]
!=
nullptr
);
sticker_stmt
[
i
]
=
sticker_prepare
(
sticker_sql
[
i
]);
sticker_stmt
[
i
]
=
Prepare
(
sticker_db
,
sticker_sql
[
i
]);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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