miniSQL for all Monkey targets

Monkey Forums/Monkey Programming/miniSQL for all Monkey targets

Lugato(Posted 2013) [#1]
Hi,

I made a little Library, will be transformed in a module in a near future :) .. to work with SQL commands in the Monkey, the project page is here:

https://github.com/llugato/miniSQL

All things are stored in the save state, using the GfK FileSystem library (Thank's guy) in text mode.

For while you can use commands like:
- create table
- Truncate table
- Insert
- Select *, count(*), fields * from table where field<1,field>2,field=10
- Import

Well, I made a little example to demonstrate how the library work. Download the package and give a try.

Please sugestions, errors and etc are welcome :)


Lugato(Posted 2013) [#2]
A little question that Mark can answer .. which the maximum size of a save state in KBs?


muddy_shoes(Posted 2013) [#3]
The actual limit varies across targets.

See: http://www.monkeycoder.co.nz/Community/posts.php?topic=2545


xlsior(Posted 2013) [#4]
Very interesting.


degac(Posted 2013) [#5]
So... the final solution?
Online saving/reading?


CopperCircle(Posted 2013) [#6]
Looks good, will you be adding any search features?


Snader(Posted 2013) [#7]
Interesting indeed! Will be using this in the future!


Why0Why(Posted 2013) [#8]
This is something that Monkey really needs! Thanks!


Lugato(Posted 2013) [#9]
CooperCircle .. you can use the SELECT command for search like this:

SELECT * FROM game
return a string with all data stored in table "game"

SELECT name,stage,points FROM score WHERE stage<10
return a string with registers that match stage<10

The return in booth cases will be a string delimited with "|" for fileds and "~n" for the registers.. You need parse the result of result query like this:
	Local data:String[] = returnData.Split("~n")
	For Local x:Int = 0 To data.Length()-1
			local dataFields:string[] = data[x].Split("|")
			.
			your code
			.
			End			
		End
	End


For while, you can use the Import method to update the data stored.. I'll implement delete and update commands when I get some free time :)


CopperCircle(Posted 2013) [#10]
Thanks Lugato, SELECT is great, I was meaning full text search MATCH()...AGAINST , Delete and Update will be cool additions.