Merge pull request #2341 from koreader/houqp-master

minor: add doc_home_display_name setting
pull/2362/head v2016.11.20-nightly
Frans de Jonge 8 years ago committed by GitHub
commit 6b4f48f29f

@ -283,7 +283,7 @@ http://ccache.samba.org
[base-readme]:https://github.com/koreader/koreader-base/blob/master/README.md
[nb-script]:https://github.com/koreader/koreader-misc/blob/master/koreader-nightlybuild/koreader-nightlybuild.sh
[nb-script]:https://gitlab.com/koreader/nightly-builds/blob/master/build_release.sh
[travis-badge]:https://travis-ci.org/koreader/koreader.svg?branch=master
[travis-link]:https://travis-ci.org/koreader/koreader
[travis-conf]:https://github.com/koreader/koreader-base/blob/master/.travis.yml

@ -0,0 +1,73 @@
Data Store
==========
LuaSettings
-----------
TODO
DocSettings
-----------
TODO
SQLite3
-------
KOReader ships with the SQLite3 library, which is a great embedded database for
desktop and mobile applications.
[lua-ljsqlite3][ljsq3] is used to export SQLite3 C interfaces as LUA functions.
Following is a quick example:
```lua
local SQ3 = require("lua-ljsqlite3/init")
local conn = SQ3.open("/path/to/database.sqlite3")
-- Execute SQL commands separated by the ';' character:
conn:exec([[
-- time is in unit of seconds
CREATE TABLE IF NOT EXISTS page_read_time(page INTEGER, time INTEGER);
CREATE TABLE IF NOT EXISTS book_property(title TEXT, author TEXT, language TEXT);
]])
-- Prepared statements are supported, with this you can bind different values
-- to the same statement. Let's set the read time for the first 10 pages in the
-- book to 5 seconds
local stmt = conn:prepare("INSERT INTO page_read_time VALUES(?, ?)")
for i=1,10 do
stmt:reset():bind(i, 5):step()
end
-- Now we can retrieve all read time stats for the first 10 pages:
local results = conn:exec("SELECT * FROM page_read_time") -- Records are by column.
-- Access to results via column numbers or names:
assert(results[1] == results.page)
assert(results[2] == results.time)
-- Nested indexing corresponds to the record(row) number, access value for 4th page:
assert(results[1][4] == 4)
assert(results[2][4] == 5)
-- access value for 2nd page:
assert(results.page[2] == 2)
assert(results.time[2] == 5)
-- Convenience function returns multiple values for one record:
local page, time = conn:rowexec("SELECT * FROM page_read_time WHERE page==3")
print(page, time) --> 3 5
-- We can also use builtin aggregate functions to do simple analytic task
local total_time = conn:rowexec("SELECT SUM(time) FROM page_read_time")
print(total_time) --> 50
conn:close() -- Do not forget to close stmt after you are done
```
For more information on supported SQL quries, check out [SQLite3's official
documentation][sq3-doc].
[ljsq3]:http://scilua.org/ljsqlite3.html
[sq3-doc]:https://www.sqlite.org/docs.html

@ -5,7 +5,7 @@ title = 'KOReader Documentation'
dir = 'html'
style = '!fixed'
use_markdown_titles = true
topics = {'../README.md', './Hacking.md', './Events.md'}
topics = {'../README.md', './Hacking.md', './Events.md', './DataStore.md'}
package = ''
format = 'markdown'
sort_modules = true

@ -40,7 +40,7 @@ local function getDefaultDir()
end
local function abbreviate(path)
local home_dir_name = G_reader_settings:readSetting("home_dir_name")
local home_dir_name = G_reader_settings:readSetting("home_dir_display_name")
if home_dir_name ~= nil then
local home_dir = G_reader_settings:readSetting("home_dir") or getDefaultDir()
local len = home_dir:len()

@ -1,7 +1,7 @@
--[[--
ImageWidget shows an image from a file
ImageWidget shows an image from a file or memory
Example:
Show image from file example:
UIManager:show(ImageWidget:new{
file = "resources/info-i.png",
@ -9,6 +9,15 @@ Example:
-- alpha = true,
})
Show image from memory example:
UIManager:show(ImageWidget:new{
-- bitmap_buffer should be a block of memory that holds the raw
-- uncompressed bitmap.
image = bitmap_buffer,
})
]]
local Widget = require("ui/widget/widget")

@ -6,7 +6,6 @@ local VerticalScrollBar = Widget:new{
enable = true,
low = 0,
high = 1,
width = 6,
height = 50,
bordersize = 1,

@ -1,5 +1,6 @@
#!/bin/sh
# PATH export is only needed if you run this script manually from a shell
export PATH=$PATH:/sbin
# Release IP and shutdown udhcpc.

Loading…
Cancel
Save