Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 15.5 ('Touch Bar')
Instant purchase and download via GumRoad!

COLUMN

SQLBuilder and ActiveRecord

Open Source code for Xojo

Issue: 15.5 (September/October 2017)
Author: Scott Boss
Author Bio: Scott Boss is the founder of Nocturnal Coding Monkeys, Llc, who specialize in writing custom software. Scott has been a developer, system administrator, storage engineer, consultant, and architect to businesses from startup to global 100.
Article Description: No description available.
Article Length (in bytes): 7,077
Starting Page Number: 81
Article Number: 15510
Related Web Link(s):

http://www.bkeeney.com/rbinto/activerecord/

Excerpt of article text...

This month we are going to discuss an issue most of us Xojo programmers run into. That most of us are not database gurus. I can admit that I fall into that category. Now most of us have to do the work of the DBA (Database Administrator) as we don't have a seperate person on staff to do that work. And this is where the issue for us arises, we have to deal with using the database for data, but in a safe manner. So this month we are going to take a look at two projects. The first project is SQLBuilder (https://github.com/ktekinay/XOJO-SQLBuilder) by Kem Tekinay and the second is ActiveRecord (http://www.bkeeney.com/rbinto/activerecord/) by BKeeney Software.

I know you are saying that they are different products. You are right. One is a SQL command builder and the other is an ORM (Object Relational Mapper). But let's explore them.

SQLBuilder

First we will talk about Kem's SQLBuilder. SQLBuilder is designed to work on building the correct SQL syntax. But it does it in a way that makes sense to a Xojo programmer. We just cascade the various parts (like From, Where, etc) in an object-oriented way. In the following code listing, see how we cascaded the From, Where, and Prepare methods on the SQLSelect to get the right SQL statement.

// does a "SELECT * FROM table WHERE i = 1" in a recordset.

...End of Excerpt. Please purchase the magazine to read the full article.