LuaSQLite3

Check-in [29da4fe833]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:New rockspec for 0.9.4 with second module 'lsqlite3complete' that statically links sqlite.c
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 29da4fe8335a31b1a157858943b848e791acee99
User & Date: e 2016-11-03 22:31:27
Context
2016-11-05
19:12
Update sqlite_open to sqlite_open_v2, with relevant flags defined; update wiki doc. check-in: 301059d037 user: e tags: trunk
2016-11-03
22:31
New rockspec for 0.9.4 with second module 'lsqlite3complete' that statically links sqlite.c check-in: 29da4fe833 user: e tags: trunk
21:41
Handle backup_init returning NULL, and add unit test for it. check-in: 3a1789e967 user: e tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to HISTORY.

1
2
3
4
5





6
7
8
9
10
11
12
13
14
15
16
2016-November-??

Version "0.9.4"

Since the "0.9.3-devel" release of this Lua library...






Added unit tests for NULs in BLOBs and TEXT columns. (Refute defect report.)

Use lua_createtable() in lieu of lua_newtable() when number of table elements is know.
This will improve performance.
Thanks to Egil Hjelmeland for the suggestion.

2015-January-06

Version "0.9.3"






>
>
>
>
>



|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2016-November-??

Version "0.9.4"

Since the "0.9.3-devel" release of this Lua library...

Added second module 'lsqlite3complete' that statically links sqlite.c. Continue to use 
'lsqlite3' for dynamic linking to 'sqlite3.so' or 'sqlite3.dll'.

Added Online Backup API

Added unit tests for NULs in BLOBs and TEXT columns. (Refute defect report.)

Use lua_createtable() in lieu of lua_newtable() when number of table elements is known.
This will improve performance.
Thanks to Egil Hjelmeland for the suggestion.

2015-January-06

Version "0.9.3"

Changes to Makefile.

9
10
11
12
13
14
15
16

17
18
all: install

install:
	luarocks make $(ROCKSPEC)

test: 
	$(LUAEXE) test/test.lua
	$(LUAEXE) test/tests-sqlite3.lua


.PHONY: all test install







|
>


9
10
11
12
13
14
15
16
17
18
19
all: install

install:
	luarocks make $(ROCKSPEC)

test: 
	$(LUAEXE) test/test.lua
	$(LUAEXE) test/tests-sqlite3.lua lsqlite3
	$(LUAEXE) test/tests-sqlite3.lua lsqlite3complete

.PHONY: all test install

Added lsqlite3-0.9.4-0.rockspec.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package = "lsqlite3"
version = "0.9.4-0"
source = {
    url = "http://lua.sqlite.org/index.cgi/zip/lsqlite3_fsl09x.zip?uuid=fsl_9x",
    file = "lsqlite3_fsl09x.zip"
}
description = {
    summary = "A binding for Lua to the SQLite3 database library",
    detailed = [[
        lsqlite3 is a thin wrapper around the public domain SQLite3 database engine. 
        The lsqlite3 module supports the creation and manipulation of SQLite3 databases. 
        After a require('lsqlite3') the exported functions are called with prefix sqlite3. 
        However, most sqlite3 functions are called via an object-oriented interface to 
        either database or SQL statement objects.
    ]],
    license = "MIT/X11",
    homepage = "http://lua.sqlite.org/"
}
dependencies = {
    "lua >= 5.1, < 5.4"
}
external_dependencies = {
    SQLITE = {
        header = "sqlite3.h"
    }
}
build = {
    type = "builtin",
    modules = {
        lsqlite3 = {
            sources = { "lsqlite3.c" },
            defines = {'LSQLITE_VERSION="0.9.4"'},
            libraries = { "sqlite3" },
            incdirs = { "$(SQLITE_INCDIR)" },
            libdirs = { "$(SQLITE_LIBDIR)" }
        },
        lsqlite3complete = {
            sources = { "lsqlite3.c", "sqlite3.c" },
            defines = {'LSQLITE_VERSION="0.9.4"', 'luaopen_lsqlite3=luaopen_lsqlite3complete'}
        }
    },
	copy_directories = { 'doc', 'examples' }
}

Added sqlite3.c.

more than 10,000 changes

Added sqlite3.h.

more than 10,000 changes

Changes to test/tests-sqlite3.lua.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
57
58
59
60
61
62
63







64
65
66
67
68
69
70
....
1193
1194
1195
1196
1197
1198
1199
1200
1201

--]]--------------------------------------------------------------------------

-- extended for LuaSQLite3, and for Lua 5.2 (using lunitx)
-- Copyright (c) 2005-13 Doug Currie
-- Same license as above

local sqlite3 = require "lsqlite3"

local os = os

--local lunit = require "lunitx"
local lunit = require "lunit"

local tests_sqlite3
................................................................................
   tests_sqlite3['test_o_'..name] = fcn
end

function lunit_TestCase (name)
   return lunit.module(name,'seeall')
end








-------------------------------
-- Basic open and close test --
-------------------------------

lunit_wrap("open_memory", function()
  local db = assert_userdata( sqlite3.open_memory() )
  assert( db:close() )
................................................................................

function db_bu_null.test()

  local bu = assert_nil( sqlite3.backup_init(db_bu_null.db, 'main', db_bu_null.db, 'main') )

end

lunit.main(arg)








|







 







>
>
>
>
>
>
>







 







|

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
....
1200
1201
1202
1203
1204
1205
1206
1207
1208

--]]--------------------------------------------------------------------------

-- extended for LuaSQLite3, and for Lua 5.2 (using lunitx)
-- Copyright (c) 2005-13 Doug Currie
-- Same license as above

local sqlite3 = require(arg[1]) -- "lsqlite3complete" or "lsqlite3"

local os = os

--local lunit = require "lunitx"
local lunit = require "lunit"

local tests_sqlite3
................................................................................
   tests_sqlite3['test_o_'..name] = fcn
end

function lunit_TestCase (name)
   return lunit.module(name,'seeall')
end

-------------------------------
-- Print library versions    --
-------------------------------

print ("SQLite v", sqlite3.version())
print ("lsqlite v", sqlite3.lversion())

-------------------------------
-- Basic open and close test --
-------------------------------

lunit_wrap("open_memory", function()
  local db = assert_userdata( sqlite3.open_memory() )
  assert( db:close() )
................................................................................

function db_bu_null.test()

  local bu = assert_nil( sqlite3.backup_init(db_bu_null.db, 'main', db_bu_null.db, 'main') )

end

lunit.main()