DB Lib Goes Open Source with GPL
Posted
DB Lib is a minimalistic database library for LiveCode that works on Desktop and Mobile and allows you to build database-savvy apps without writing SQL directly. For example consider the following code:
dbWhere "country", "Brazil"
put dbGet("contacts") into tDataA
set the dgdata of control "contacts" to tDataA
It picks all records from the contacts table that have the country field equals to Brazil and set a datagrid to it. It’s very easy to use. A more involved example:
on mouseUp
-- assemble array
put dbCardToArray("contacts") into tDataA
-- check if we're adding a new record
-- or updating an existing one.
--
-- this check depends on the record id being present.
if field "id" is empty then
get dbInsert("contacts", tDataA)
if it is not a number then
answer error it
else
answer "New Record Saved"
end if
go card "contact list"
else
dbWhere "id", field "id"
get dbUpdate("contacts", tDataA)
if it is not a number then
answer error it
else
answer "Record Updated"
end if
go card "contact list"
end if
end mouseUp
In this code first we pick the data from a card using dbCardToArray(), a function that magically picks data from fields, buttons and other controls, and assemble an array that is used to insert or update a given record depending on the presence of an id field.
This is just a quick glimpse of what you can do with DB Lib. It is basically a ORM for LiveCode.
more!HTML-COMMENT>
Dual License
Inspired by the current LiveCode open source edition, I decided to dual license this library using GPL, so all you LiveCode Community Edition users can use this cool library on your GPL projects.
If you want to release closed source software, you still need a commercial license but for open source stuff, you’re free to go.
You can learn more about the library and download the GPL version by going to the DB Lib page.
Support & Feedback
Those that have questions or feedback, just hop by the forums. If you purchased DB Lib less than 30 days ago and feel you’ve been cheated by me going open source with GPL, you can get a refund by sending me an email at my usual address.
Please be aware that building this library takes time and that time is paid thru commercial licenses and donations, so if you think this library is useful, consider a donation or purchasing a commercial license. Each license buy a couple hours of work!
I hope you guys liked this initiative!
Did you enjoyed reading this content? Want to support me?
You can buy me a coffee at ko-fi.
Comments? Questions? Feedback?
You can reach out to me on Twitter, or Mastodon, Secure Scuttlebutt, or through WebMentions.