RetroArch/libretro-db
aliaspider 77e22e9a79 (libretro-db) c_converter: merge list entries sharing the same key
instead of overwriting the old ones.
2016-01-26 06:28:34 +01:00
..
bintree.c CLeanups/fixes 2015-09-17 20:24:49 +02:00
bintree.h (libretro-db) Cleanup bintree.c 2015-09-17 09:25:06 +02:00
c_converter_test.sh (libretro-db) c_converter: implement a binary search tree, improves 2016-01-24 03:16:25 +01:00
c_converter.c (libretro-db) c_converter: merge list entries sharing the same key 2016-01-26 06:28:34 +01:00
dat_converter Add back lua_converter.c 2015-10-25 09:15:36 +01:00
dat_converter.lua fixed plain converter; added lua converter back until we're sure the plain converter is working 2015-10-07 19:28:38 -03:00
lexer.c fixed plain converter; added lua converter back until we're sure the plain converter is working 2015-10-07 19:28:38 -03:00
lexer.h fixed plain converter; added lua converter back until we're sure the plain converter is working 2015-10-07 19:28:38 -03:00
libretrodb_tool.c (libretro-db) libretrodb.c - cleanups 2015-09-17 09:46:26 +02:00
libretrodb.c (libretro-db) plug memory leak. 2016-01-23 01:25:09 +01:00
libretrodb.h (libretro-db) Cleanup some headers 2015-09-21 15:31:00 +02:00
lua_common.c nit. 2016-01-23 04:26:19 +01:00
lua_common.h fixed plain converter; added lua converter back until we're sure the plain converter is working 2015-10-07 19:28:38 -03:00
lua_converter.c Add back lua_converter.c 2015-10-25 09:15:36 +01:00
Makefile nit. 2016-01-24 05:46:52 +01:00
parser.c parser.c - symbol namespace alterations 2015-10-10 10:49:34 +02:00
parser.h fixed plain converter; added lua converter back until we're sure the plain converter is working 2015-10-07 19:28:38 -03:00
plain_converter.c (libretrodb) Silence some warnings 2016-01-23 15:23:45 +01:00
query.c Backports/rewrites wmarquesr pt. 2 2015-12-04 10:35:33 +01:00
query.h (MSVC) Buildfixes 2015-10-02 17:57:37 +02:00
README.md Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00
rmsgpack_dom.c (libretrodb) Silence warnings 2015-09-17 20:10:04 +02:00
rmsgpack_dom.h Create retro_file, and have libretrodb use it 2015-09-17 19:58:06 +02:00
rmsgpack_test.c (libretro-db) test-lib buildfix. 2016-01-23 01:33:44 +01:00
rmsgpack.c (rmsgpack.c) Silence warning 2015-11-18 02:28:47 +01:00
rmsgpack.h Create retro_file, and have libretrodb use it 2015-09-17 19:58:06 +02:00
testlib.c (libretro-db) test-lib buildfix. 2016-01-23 01:33:44 +01:00
tests.lua Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00

libretrodb

A small read only database Mainly to be used by retroarch

Usage

Files specified later in the chain will override earlier ones if the same key exists multiple times.

To list out the content of a db libretrodb_tool <db file> list To create an index libretrodb_tool <db file> create-index <index name> <field name> To find an entry with an index libretrodb_tool <db file> find <index name> <value>

lua converters

In order to write you own converter you must have a lua file that implements the following functions:

-- this function gets called before the db is created and should validate the
-- arguments and set up the ground for db insertion
function init(...)
	local args = {...}
	local script_name = args[1]
end

-- this is in iterator function. It is called before each insert.
-- the function should return a table for insertion or nil when there are no
-- more records to insert.
function get_value()
	return {
		key = "value", -- will be saved as string
		num = 3, -- will be saved as int
		bin = binary("some string"), -- will be saved as binary
		unum = uint(3), -- will be saved as uint
		some_bool = true, -- will be saved as bool
	}
end

dat file converter

To convert a dat file use:

dat_converter <db file> <dat file>

If you want to merge multiple dat files you need to run:

dat_converter <db file> <match key> <dat file> ...

for example:

dat_converter snes.rdb rom.crc snes1.dat snes2.dat

Query examples

Some examples of queries you can use with libretrodbtool:

  1. Glob pattern matching Usecase : Search for all games starting with 'Street Fighter' in the 'name' field (glob pattern matching)

libretrodb_tool <db file> find "{'name':glob('Street Fighter*')}"

  1. Combined number matching query Usecase: Search for all games released on October 1995.

libretrodb_tool <db file> find "{'releasemonth':10,'releaseyear':1995}"