Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shawn Webb
liblattutil
Commits
4a87ae63
Commit
4a87ae63
authored
Jul 18, 2021
by
Shawn Webb
Browse files
Test 64-bit integers and BLOBs
Signed-off-by:
Shawn Webb
<
shawn.webb@hardenedbsd.org
>
parent
7bb5d70a
Changes
1
Hide whitespace changes
Inline
Side-by-side
lattutil/lattutil.c
View file @
4a87ae63
...
...
@@ -29,11 +29,14 @@
#include
<syslog.h>
#include
<limits.h>
#include
"liblattutil.h"
int
main
(
int
argc
,
char
*
argv
[])
{
const
char
*
blobval
=
"BLOB Value"
;
lattutil_sqlite_query_t
*
query
;
const
ucl_object_t
*
cur
,
*
tmp
;
lattutil_sqlite_ctx_t
*
sqlctx
;
...
...
@@ -56,7 +59,9 @@ main(int argc, char *argv[])
query
=
lattutil_sqlite_prepare
(
sqlctx
,
"CREATE TABLE IF NOT EXISTS test_table ("
" colname TEXT NOT NULL, "
" colval TEXT NOT NULL"
" colval TEXT NOT NULL,"
" colblob BLOB,"
" colint INTEGER"
")"
);
if
(
query
==
NULL
)
{
...
...
@@ -72,7 +77,7 @@ main(int argc, char *argv[])
lattutil_sqlite_query_free
(
&
query
);
query
=
lattutil_sqlite_prepare
(
sqlctx
,
"INSERT INTO test_table (colname, colval) VALUES (?, ?)"
);
"INSERT INTO test_table (colname, colval
, colint, colblob
) VALUES (?,
?, ?,
?)"
);
if
(
query
==
NULL
)
{
logp
->
ll_log_err
(
logp
,
-
1
,
"Unable to create second query"
);
return
(
1
);
...
...
@@ -88,6 +93,16 @@ main(int argc, char *argv[])
return
(
1
);
}
if
(
!
lattutil_sqlite_bind_int
(
query
,
3
,
INT_MAX
+
1
))
{
logp
->
ll_log_err
(
logp
,
-
1
,
"Unable to bind colint"
);
return
(
1
);
}
if
(
!
lattutil_sqlite_bind_blob
(
query
,
4
,
(
void
*
)
blobval
,
sizeof
(
blobval
)))
{
logp
->
ll_log_err
(
logp
,
-
1
,
"Unable to bind colblob"
);
return
(
1
);
}
if
(
!
lattutil_sqlite_exec
(
query
))
{
logp
->
ll_log_err
(
logp
,
-
1
,
"Unable to exec second query"
);
return
(
1
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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