[REBOL] ANN: RebolBase (db.r)
From: cribbsj:oakwood at: 7-Sep-2001 10:49
RebolBase is a simple DBMS written in Rebol.
I have uploaded the script to RT's website under the filename db.r, but I
noticed that when I view it there, it has eaten my explanatory text that I
had before the Rebol header. So I am going to reproduce that info here:
Features:
* Stores data in plain, newline delimited text files.
* Built in auto-increment field.
* Insert, update, delete, select functions.
* Uses regular parse syntax for string queries.
To-do:
* Add db-flush so you can write changes to disk without having to db-close
then db-open.
* Add ability to include sort criteria in db-select.
* Improve db-select query criteria syntax and processing.
* Add ability to specify which fields to return from db-select.
* Speed improvements for larger tables.
Example session:
do %db.r
plane: make-table
plane/db-open/new %plane.tbl [["name" "string"]["country" "string"]["speed"
integer
]["range" "integer"]]
plane/db-insert ["P-51" "USA" 403 1255]
plane/db-insert ["Spitfire" "Great Britain" 333 556]
foreach record plane/db-select [["country" ["Great Britain" to end]]] [
poke record 3 "England"
recno: first head record
record: next head record
plane/db-update recno record
]
plane/db-close
*Note: No changes are saved to disk until you db-close.
Final Thoughts:
As I mentioned yesterday, I am submitting this script now for two reasons:
1. Since it is currently usable, I don't want to wait until I think it is
perfect (whatever that means) and has every feature I can think of.
Hopefully, it will prove useful to others.
2. I am hoping to greatly improve my programming and Rebol skills by
learning from any feedback I get from others who look at my code.
I am certain that there are a lot of things that can be greatly improved in
the script. My Rebol skills are pretty rudimentary. There are still a lot
of things that I don't quite understand. So, any constructive criticism
would be greatly appreciated.
Jamey Cribbs
[cribbsj--oakwood--org]