Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
bluejoyq
2019-11-20 23:59:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e2f7182b58c01b1449f260873930d691d56c9f1e
e2f7182b
1 parent
288169d3
add sqlite module and database manage module
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
searchGuide/components/RateBar/RateBar.js
searchGuide/lib/sqlite.js
searchGuide/package.json
searchGuide/components/RateBar/RateBar.js
View file @
e2f7182
...
...
@@ -93,7 +93,7 @@ const styles = StyleSheet.create({
},
infoContainer
:{
flexDirection
:
'row'
,
justifyContent
:
'
space-around
'
,
justifyContent
:
'
center
'
,
alignItems
:
'center'
,
width
:
'100%'
},
...
...
searchGuide/lib/sqlite.js
0 → 100644
View file @
e2f7182
import
*
as
SQLite
from
'expo-sqlite'
;
import
{
Modal
}
from
'react-native'
;
import
{
openDatabase
,
transaction
,
executeSql
}
from
'expo-sqlite'
;
import
{
rejects
}
from
'assert'
;
let
sqlite
=
{};
let
db
=
openDatabase
(
"score.db"
);
db
.
transaction
(
(
tx
)
=>
{
tx
.
executeSql
(
`CREATE TABLE IF NOT EXISTS district (id int AUTO_INCREMENT,score int, PRIMARY KEY (id));`
);
});
sqlite
.
insert
=
(
score
)
=>
{
db
.
transaction
(
(
tx
)
=>
{
tx
.
executeSql
(
`INSERT INTO district (score) VALUES (
${
score
}
);`
);
});
}
sqlite
.
select
=
(
)
=>
{
return
new
Promise
(
(
resolve
,
rejects
)
=>
{
db
.
transaction
(
(
tx
)
=>
{
tx
.
executeSql
(
`SELECT score FROM district WHERE 1 ORDER BY id DESC LIMIT 5;`
,
[],
(
tx
,
result
)
=>
{
resolve
(
result
.
rows
.
_array
);
},
(
err
)
=>
{
console
.
log
(
"err -> "
,
err
);
});
});
})
}
module
.
exports
=
sqlite
;
\ No newline at end of file
searchGuide/package.json
View file @
e2f7182
...
...
@@ -31,7 +31,8 @@
"react-redux"
:
"^7.1.3"
,
"react-thunk"
:
"^1.0.0"
,
"redux"
:
"^4.0.4"
,
"redux-thunk"
:
"^2.3.0"
"redux-thunk"
:
"^2.3.0"
,
"expo-sqlite"
:
"~7.0.0"
},
"devDependencies"
:
{
"babel-preset-expo"
:
"^7.1.0"
,
...
...
Please
register
or
login
to post a comment