Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dave Griffiths
mongoose-2000
Commits
3a39bd89
Commit
3a39bd89
authored
Sep 24, 2013
by
Dave Griffiths
Browse files
sqlite tested on android
parent
7a76e2dc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
2 deletions
+38
-2
android/assets/starwisp.scm
android/assets/starwisp.scm
+25
-1
android/jni/.sconsign.dblite
android/jni/.sconsign.dblite
+0
-0
android/jni/core/db.cpp
android/jni/core/db.cpp
+1
-1
android/jni/core/db.h
android/jni/core/db.h
+1
-0
android/jni/scheme/opdefines.h
android/jni/scheme/opdefines.h
+1
-0
android/jni/scheme/scheme.cpp
android/jni/scheme/scheme.cpp
+10
-0
No files found.
android/assets/starwisp.scm
View file @
3a39bd89
...
...
@@ -15,12 +15,36 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(
define
db
"test.db"
)
(
define
db
"
/sdcard/mongoose/
test.db"
)
(
display
(
db-open
db
))(
newline
)
(
display
(
db-status
db
))(
newline
)
(
db-exec
db
"CREATE TABLE COMPANY(
ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR(50),
SALARY REAL );"
)
(
display
(
db-status
db
))(
newline
)
(
db-exec
db
"INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (1, 'Paul', 32, 'California', 20000.00 );
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (2, 'Allen', 25, 'Texas', 15000.00 );
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (3, 'Teddy', 23, 'Norway', 20000.00 );
INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
VALUES (4, 'Mark', 25, 'Rich-Mond ', 65000.00 );"
)
(
display
(
db-status
db
))(
newline
)
(
display
(
db-exec
db
"select * from COMPANY"
))(
newline
)
(
display
(
db-status
db
))(
newline
)
(
define
(
mbutton
id
title
fn
)
(
button
(
make-id
id
)
title
20
fillwrap
fn
))
...
...
android/jni/.sconsign.dblite
View file @
3a39bd89
No preview for this file type
android/jni/core/db.cpp
View file @
3a39bd89
...
...
@@ -79,7 +79,7 @@ list *db::exec(const char *sql)
if
(
rc
!=
SQLITE_OK
)
{
snprintf
(
m_status
,
4096
,
"SQL error: %s"
,
err
);
m_running
=
0
;
//
m_running=0;
sqlite3_free
(
err
);
}
else
...
...
android/jni/core/db.h
View file @
3a39bd89
...
...
@@ -27,6 +27,7 @@ public:
~
db
();
list
*
exec
(
const
char
*
sql
);
const
char
*
status
()
{
return
m_status
;
}
class
value_node
:
public
list
::
node
{
...
...
android/jni/scheme/opdefines.h
View file @
3a39bd89
...
...
@@ -194,6 +194,7 @@
_OP_DEF
(
opexe_6
,
"send"
,
1
,
1
,
TST_NONE
,
OP_SEND
)
_OP_DEF
(
opexe_6
,
"db-open"
,
1
,
1
,
TST_NONE
,
OP_OPEN_DB
)
_OP_DEF
(
opexe_6
,
"db-exec"
,
2
,
2
,
TST_NONE
,
OP_EXEC_DB
)
_OP_DEF
(
opexe_6
,
"db-status"
,
1
,
1
,
TST_NONE
,
OP_STATUS_DB
)
#undef _OP_DEF
android/jni/scheme/scheme.cpp
View file @
3a39bd89
...
...
@@ -4286,6 +4286,16 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) {
}
s_return
(
sc
,
sc
->
F
);
}
case
OP_STATUS_DB
:
{
if
(
is_string
(
car
(
sc
->
args
)))
{
db
*
d
=
the_db_container
.
get
(
string_value
(
car
(
sc
->
args
)));
if
(
d
!=
NULL
)
{
s_return
(
sc
,
mk_string
(
sc
,
d
->
status
()));
}
}
s_return
(
sc
,
sc
->
F
);
}
////////////////////
default:
snprintf
(
sc
->
strbuff
,
STRBUFFSIZE
,
"%d: illegal operator"
,
sc
->
op
);
...
...
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