1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00
RetroArch/libretro-db
2015-09-17 09:33:24 +02:00
..
bintree.c (libretro-db) Cleanup bintree.c 2015-09-17 09:25:06 +02:00
bintree.h (libretro-db) Cleanup bintree.c 2015-09-17 09:25:06 +02:00
dat_converter Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00
dat_converter.lua Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00
libretrodb_endian.h Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00
libretrodb_tool.c Revert to last working version of libretro-db 2015-09-17 06:12:57 +02:00
libretrodb.c (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
libretrodb.h (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
lua_common.c Convert C++ comment to C comment 2015-09-17 07:31:22 +02:00
lua_common.h (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
lua_converter.c Revert to last working version of libretro-db 2015-09-17 06:12:57 +02:00
Makefile (libretro-db) Cleanups 2015-09-17 07:01:34 +02:00
query.c (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
query.h (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
README.md Rename libretrodb to libretro-db 2015-02-19 00:47:19 +01:00
rmsgpack_dom.c (libretro-db) Backport C89 fixes 2015-09-17 07:23:36 +02:00
rmsgpack_dom.h (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
rmsgpack_test.c (libretro-db) Cleanups 2015-09-17 07:01:34 +02:00
rmsgpack.c (libretrodb) Backport UINT32_C 2015-09-17 07:18:13 +02:00
rmsgpack.h (libretro-db) Style nits 2015-09-17 09:33:24 +02:00
testlib.c (libretro-db) testlib.c - Cleanups 2015-09-17 07:04:37 +02: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}"