-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite: Initial port #417
base: loader
Are you sure you want to change the base?
sqlite: Initial port #417
Changes from 5 commits
a2c3566
cd5b02f
0707a4c
1ea129f
8c79591
9d9dc43
cccfa82
dac0a2b
564b08d
0a8176a
2690e4f
e8581ad
89da24f
dd5410f
0ee4ec1
0adc138
f9914ab
0b7f9e4
2fddd37
f8adc21
e6ea277
7c5069d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[system] | ||
description = "Simple test of sqlite." | ||
|
||
[[components]] | ||
name = "booter" | ||
img = "no_interface.llbooter" | ||
implements = [{interface = "init"}, {interface = "addr"}] | ||
deps = [{srv = "kernel", interface = "init", variant = "kernel"}] | ||
constructor = "kernel" | ||
|
||
[[components]] | ||
name = "capmgr" | ||
img = "capmgr.simple" | ||
deps = [{srv = "booter", interface = "init"}, {srv = "booter", interface = "addr"}] | ||
implements = [{interface = "capmgr"}, {interface = "init"}, {interface = "memmgr"}, {interface = "capmgr_create"}] | ||
constructor = "booter" | ||
|
||
[[components]] | ||
name = "sched" | ||
img = "sched.root_fprr" | ||
deps = [{srv = "capmgr", interface = "init"}, {srv = "capmgr", interface = "capmgr"}, {srv = "capmgr", interface = "memmgr"}] | ||
implements = [{interface = "sched"}, {interface = "init"}] | ||
constructor = "booter" | ||
|
||
[[components]] | ||
name = "sqlite_tests" | ||
img = "tests.sqlite_tests" | ||
deps = [{srv = "sched", interface = "init"}, {srv = "sched", interface = "sched"}, {srv = "capmgr", interface = "capmgr_create"}, {srv = "capmgr", interface = "memmgr"}, {srv = "capmgr", interface = "capmgr"}] | ||
constructor = "booter" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Required variables used to drive the compilation process. It is OK | ||
# for many of these to be empty. | ||
# | ||
# The set of interfaces that this component exports for use by other | ||
# components. This is a list of the interface names. | ||
INTERFACE_EXPORTS = | ||
# The interfaces this component is dependent on for compilation (this | ||
# is a list of directory names in interface/) | ||
INTERFACE_DEPENDENCIES = | ||
# The library dependencies this component is reliant on for | ||
# compilation/linking (this is a list of directory names in lib/) | ||
LIBRARY_DEPENDENCIES = component sqlite | ||
# Note: Both the interface and library dependencies should be | ||
# *minimal*. That is to say that removing a dependency should cause | ||
# the build to fail. The build system does not validate this | ||
# minimality; that's on you! | ||
|
||
include Makefile.subsubdir |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## tests | ||
|
||
This is the skeleton interface used by the `mkcomponent.sh` script to aid in the creation of a new component. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add documentation here, or remove the file. |
||
It provides no functionality, and should never be depended on! | ||
This documentation should be *replaced* in the documentation for a new component. | ||
|
||
### Description | ||
|
||
### Usage and Assumptions |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <cos_component.h> | ||
#include <llprint.h> | ||
#include <sqlite3.h> | ||
#include <cos_defkernel_api.h> | ||
|
||
void | ||
cos_init(void) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you remove this function, it should still work. If you don't have code in it, remove it! |
||
{ | ||
} | ||
|
||
int result_print(void *v, int argc, char **argv, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. your line width wraparound seems too aggressive. I don't think that the argument needs to be on another line. |
||
char **col_name) { | ||
for (int i = 0; i < argc; i++) { | ||
printc("%s = %s\n", col_name[i], argv[i] ? argv[i] : "NULL"); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
int | ||
main(void) | ||
{ | ||
printc("Calling sqlite functions\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inconsistent indentation styules. likely mixing spaces and tabs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. variable definitions should be at the top of the block. |
||
|
||
sqlite3 *db; | ||
char *err_msg = 0; | ||
char *sql = "CREATE TABLE TestTable(Id INTEGER PRIMARY KEY, Value TEXT);" | ||
"INSERT INTO TestTable(Value) VALUES ('TestItem1');" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personal opinion (ignore if you'd like): all strings would look better if the starting "s were aligned. |
||
"INSERT INTO TestTable(Value) VALUES ('TestItem2');" | ||
"INSERT INTO TestTable(Value) VALUES ('TestItem3');" | ||
"INSERT INTO TestTable(Value) VALUES ('TestItem4');" | ||
"INSERT INTO TestTable(Value) VALUES ('TestItem5');"; | ||
|
||
sqlite3_open(":memory:", &db); | ||
|
||
sqlite3_exec(db, sql, 0, 0, &err_msg); | ||
|
||
sql = "SELECT * FROM TestTable WHERE Id == 3"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation again. |
||
sqlite3_exec(db, sql, result_print, 0, &err_msg); | ||
|
||
sqlite3_close(db); | ||
|
||
while(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space after keywords |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
# | ||
# NOTE: libc is special-cased and the compilation is orchestrated | ||
# directly. It should have no dependencies. | ||
LIBRARY_OUTPUT = c crypt m thread resolv rt | ||
LIBRARY_OUTPUT = c crypt m pthread resolv rt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for this!!! |
||
# The .o files that are mandatorily linked into dependents. This is | ||
# rarely used, and only when normal .a linking rules will avoid | ||
# linking some necessary objects. This list is of names (for example, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to move this into gwsystems. Remember, we want the main branch of the repo be unmodifed, and have a
cos
branch that we pull in as a submodule. That way we have a path for updating the code as upstream changes.