This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Creeper9207's profile picture

DBTerm, command line database editor [api included]

Started by Creeper9207, 19 February 2015 - 02:02 AM
Creeper9207 #1
Posted 19 February 2015 - 03:02 AM
New! DBTerm, a command line database editor, works with most table databases

commands:
Spoilerdbterm write example.db
-opens example.db for writing (setting values)
dbterm read example.db
-opens example.db for reading (getting values)
Api:
SpoilersetValue(string database-name, int key, string value)
getValue(string database-name, int key)
get dbterm:
Spoilerpastebin run NQyRZMym
get api:
Spoilerpastebin get eQTRCEt9 dbapi
Edited on 19 February 2015 - 02:50 AM
InDieTasten #2
Posted 19 February 2015 - 03:39 AM
I don't know, if you are really willing to call it "database". I would call it something like I don't know. I actually don't know. Perhaps I wouldn't even create an API for that, than just writing this stuff from scratch for everything that needs it^^

Since it includes an interactive application, maybe it's like a table-explorer with decreased key and values types^^

I would definitely suggest you to support more types. So that when you are "writing", you can specify the type bool, string, number or table. Would make this thing much more useful.
Table-explorer. The API itself would still remain pretty much useless to me, but table explorer seems like a thing someone could use, since like everyone uses serialized tables as "file format"
Creeper9207 #3
Posted 19 February 2015 - 03:55 AM
it really just saves 53 lines of code of work, and it just saves some text, nothing really fancy

i made this for my upcoming OS, i just released it to the public

also the "table-explorer" and the api are seperate, but DBTerm uses the api, scince most databases are tables, wallah!

it also mainly uses table.insert

so im not really sure how one would include boolean functions, im kinda new to lua

other note: the program is mainly for writing to databases, the read function was kinda for fun
InDieTasten #4
Posted 19 February 2015 - 03:58 AM
Your api is as far as I remember it totally ok with any type other than threads and functions. But your explorer only allows for numeric indexes for example. You could read in a lua expression to do this. Just add some script padding around it, loadstring and you are good to go to support any input. It would be like lua prompt, but specialized to querying and manipulating tables ;)/>

DBTerm> "19"
to add it as string
DBTerm> 19
to add it as number
DBTerm> {1, 2, {44,6,1,3}, 4, 5}
to add it as table

just as a few examples
Creeper9207 #5
Posted 19 February 2015 - 10:53 PM
i might add that later, currently just working on my os, this program is just to advertise the API