RetroArch/libretrodb
2015-01-20 22:36:51 +01:00
..
compat Update libretroDB 2015-01-20 22:11:00 +01:00
.ycm_extra_conf.py Switch to libretrodb 2015-01-19 22:47:09 +01:00
bintree.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
bintree.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
check_style Switch to libretrodb 2015-01-19 22:47:09 +01:00
compat_fnmatch.c Update libretroDB 2015-01-20 01:05:45 +01:00
crustydiff Switch to libretrodb 2015-01-19 22:47:09 +01:00
dat_converter Switch to libretrodb 2015-01-19 22:47:09 +01:00
dat_converter.lua (LibretroDB) Update 2015-01-20 19:36:36 +01:00
lua_common.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
lua_common.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
lua_converter.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
Makefile Update libretroDB 2015-01-20 01:05:45 +01:00
query.c Get rid of warning in query.c 2015-01-20 22:36:51 +01:00
query.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
rarchdb_endian.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
rarchdb_tool.c Update libretroDB and bake in compat_fnmatch.c 2015-01-20 01:00:17 +01:00
rarchdb.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
rarchdb.h (MSVC) Build fixes for libretroDB 2015-01-20 03:34:00 +01:00
README.md (LibretroDB) Update 2015-01-20 19:36:36 +01:00
retro_endianness.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
retro_inline.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
rmsgpack_dom.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
rmsgpack_dom.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
rmsgpack_test.c Update libretroDB 2015-01-20 22:11:00 +01:00
rmsgpack.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
rmsgpack.h Switch to libretrodb 2015-01-19 22:47:09 +01:00
testlib.c Switch to libretrodb 2015-01-19 22:47:09 +01:00
tests.lua Update libretroDB and bake in compat_fnmatch.c 2015-01-20 01:00:17 +01:00
uncrustify Switch to libretrodb 2015-01-19 22:47:09 +01:00
uncrustify.cfg Update libretroDB and bake in compat_fnmatch.c 2015-01-20 01:00:17 +01:00

rarchdb

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 rarchdb_tool <db file> list To create an index rarchdb_tool <db file> create-index <index name> <field name> To find an entry with an index rarchdb_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 shuold 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 rarchdbtool:

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

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

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

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