Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
92654cf7
Commit
92654cf7
authored
May 11, 2014
by
Hugo Beauzée-Luyssen
Browse files
SqliteTools: Display the error message when appropriate
parent
f11bda07
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/ShowEpisode.cpp
View file @
92654cf7
...
...
@@ -64,8 +64,8 @@ IShow* ShowEpisode::show()
bool
ShowEpisode
::
createTable
(
sqlite3
*
dbConnection
)
{
const
char
*
req
=
"CREATE TABLE IF NOT EXISTS ("
"id_episode INTEGER PRIMARY KEY AUTO
INCREMENT,"
const
char
*
req
=
"CREATE TABLE IF NOT EXISTS
ShowEpisode
("
"id_episode INTEGER PRIMARY KEY AUTOINCREMENT,"
"artwork_url TEXT,"
"episode_number UNSIGNED INT,"
"last_sync_date UNSIGNED INT,"
...
...
src/SqliteTools.cpp
View file @
92654cf7
...
...
@@ -9,6 +9,7 @@ bool SqliteTools::createTable( sqlite3 *db, const char* request )
if
(
res
!=
SQLITE_OK
)
{
std
::
cerr
<<
"Failed to execute request: "
<<
request
<<
std
::
endl
;
std
::
cerr
<<
sqlite3_errmsg
(
db
)
<<
std
::
endl
;
return
false
;
}
res
=
sqlite3_step
(
stmt
);
...
...
src/SqliteTools.h
View file @
92654cf7
...
...
@@ -4,6 +4,7 @@
#include <sqlite3.h>
#include <string>
#include <vector>
#include <iostream>
class
SqliteTools
{
...
...
@@ -17,7 +18,11 @@ class SqliteTools
sqlite3_stmt
*
stmt
;
int
res
=
sqlite3_prepare_v2
(
dbConnection
,
req
,
-
1
,
&
stmt
,
NULL
);
if
(
res
!=
SQLITE_OK
)
{
std
::
cerr
<<
"Failed to execute request: "
<<
req
<<
std
::
endl
;
std
::
cerr
<<
sqlite3_errmsg
(
dbConnection
)
<<
std
::
endl
;
return
false
;
}
if
(
foreignKey
!=
0
)
sqlite3_bind_int
(
stmt
,
1
,
foreignKey
);
res
=
sqlite3_step
(
stmt
);
...
...
@@ -38,7 +43,11 @@ class SqliteTools
sqlite3_stmt
*
stmt
;
int
res
=
sqlite3_prepare_v2
(
dbConnection
,
req
,
-
1
,
&
stmt
,
NULL
);
if
(
res
!=
SQLITE_OK
)
{
std
::
cerr
<<
"Failed to execute request: "
<<
req
<<
std
::
endl
;
std
::
cerr
<<
sqlite3_errmsg
(
dbConnection
)
<<
std
::
endl
;
return
result
;
}
sqlite3_bind_int
(
stmt
,
1
,
primaryKey
);
if
(
sqlite3_step
(
stmt
)
!=
SQLITE_ROW
)
return
result
;
...
...
Write
Preview
Supports
Markdown
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