Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
9b633f70
Commit
9b633f70
authored
Sep 22, 2011
by
Sebastian Ramacher
Browse files
implement zathura_db_get_fileinfo
parent
320063f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
database-sqlite.c
View file @
9b633f70
...
...
@@ -200,3 +200,35 @@ zathura_db_set_fileinfo(zathura_database_t* db, const char* file, unsigned int p
sqlite3_finalize
(
stmt
);
return
res
==
SQLITE_OK
;
}
bool
zathura_db_get_fileinfo
(
zathura_database_t
*
db
,
const
char
*
file
,
unsigned
int
*
page
,
int
*
offset
,
float
*
scale
)
{
g_return_val_if_fail
(
db
&&
file
&&
page
&&
ofset
&&
scale
,
false
);
static
const
char
SQL_FILEINFO_GET
[]
=
"SELECT page, offset, scale FROM fileinfo WHERE file = ?;"
;
sqlite3_stmt
*
stmt
=
prepare_statement
(
db
->
session
,
SQL_FILEINFO_GET
);
if
(
stmt
==
NULL
)
{
return
false
;
}
if
(
sqlite3_bind_text
(
stmt
,
1
,
file
,
-
1
,
NULL
)
!=
SQLITE_OK
)
sqlite3_finalize
(
stmt
);
girara_error
(
"Failed to bind arguments."
);
return
false
;
}
if
(
sqlite3_step
(
stmt
)
!=
SQLITE_ROW
)
{
sqlite3_finalize
(
stmt
);
girara_info
(
"No info for file %s available."
,
file
);
return
false
;
}
*
page
=
sqlite3_column_int
(
stmt
,
0
);
*
offset
=
sqlite3_column_int
(
stmt
,
1
);
*
scale
=
sqlite3_column_double
(
stmt
,
2
);
sqlite3_finalize
(
stmt
);
return
true
;
}
database.h
View file @
9b633f70
...
...
@@ -59,4 +59,14 @@ girara_list_t* zathura_db_load_bookmarks(zathura_database_t* db, const char* fil
*/
bool
zathura_db_set_fileinfo
(
zathura_database_t
*
db
,
const
char
*
file
,
unsigned
int
page
,
int
offset
,
float
scale
);
/* Get file info (last site, ...) from the database.
* @param db The database instance
* @param file The file to which the file info belongs to.
* @param page The last page.
* @param offset The last offset.
* @param scale The last scale.
* @return true on success, false otherwise.
*/
bool
zathura_db_get_fileinfo
(
zathura_database_t
*
db
,
const
char
*
file
,
unsigned
int
*
page
,
int
*
offset
,
float
*
scale
);
#endif // DATABASE_H
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