An easy-to-use lightweight SQLite 3 library written in Objective-C for Mac OS and iOS 4+ that will build SQL statements and manage database connections, plus an active record based ORM.
This Objective-C SQLite project is a lightweight library that offers more than just a set of SQLite
wrapper classes. It is divided up into five parts. The first part consists of a set of Objective-C classes that handle
communications with an SQLite database. Inside the “src” folder, these Objective-C classes are further subdivided into five
folders. The “db” folder (formerly, the “dao” folder) contains an SQLite wrapper class that easily manages the database
connection. The “ext” folder contains some class extensions. The “sql” folder contains a collection of SQL builder classes
that can be used to construct well-formed SQL statements for SQLite via a plethora of convenience methods similar to those
found in LINQ. Likewise, the “orm” folder has an assortment of classes that can control and manipulate data within an SQLite
database via the Active Record design pattern. And, the “util” folder contains a set of various helper classes. The
second part consists of an easy-to-read API, which both documents and diagrams each Objective-C class and XML/DTD file.
The third part consists of a BASH script that can be used to generate the necessary ORM models using the SQLite’s database
schema. The fourth part consists of the database configuration files for the SQLite database connection. The final part
has the schema for handling XML to DDL.
All classes are designed to be used in iPhone/iOS applications. The classes in the “ARC” branches are compliant with iOS 5’s
automatic reference counting. For projects still using Retains,
Releases, and Autoreleases (i.e. Pre-ARC) use the classes in the “RRA” branches.
The goal of this project is to make these classes the “de facto” standard for communicating with SQLite databases on
iPhone/iOS devices.
With the abundance of third-party libraries for Objective-C, it was apparent that a successful SQLite library needs to
be simple to learn and intuitive. It must also be cleanly written with clear naming conventions and must be well-documented
for too many SQLite libraries are hard to understand and are not user-friendly. For these reasons, this SQLite library was
written.
The following is a short-list of some of the features:
Using these classes in an Xcode project is easy to do. Here is how:
Carthage is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods.
To install with Carthage, follow the instruction on Carthage
Cartfile
github "ziminji/objective-c-sql-query-builder"
A lot of work has gone into making the classes in this repository as independent as possible; however, a few
dependencies just can’t be avoided. To make life easier, the following SDK import files have been created to
make the implementation process as painless as possible:
Based on which SDK is needed, only those classes listed (i.e. imported) in the SDK import file are needed to be
added to the respective Xcode project.
To use these Objective-C classes in an Xcode project, add the following framework:
All classes are heavily documented using HeaderDoc.
You can get familiar with each class by simply looking at the API or by opening its respective “.h” file. Similarly,
all XML/DTD files are documented using DTDDoc. You can also find more information on
this repository’s Wiki.
Checkout this SQLite repository’s Wiki for a handful of examples. There, you will find examples on how to make
an SQLite database connection and how to build DCL, DDL, DML, and TCL commands
(including Create, Read, Update, and Delete (CRUD) statements). The Wiki also has tutorials on how to use Object
Relational Mapping (ORM) and how to generate the necessary models (i.e. active records).
If you need further assistance in implementing these classes, you can always send an email to [email protected] with
any questions that you may have about this repository. Any frequently asked questions (FAQ) will be posted on this
repository’s Wiki.
You can also seek assistance via the blogs. A great Web site for community assistance is Stack Overflow.
Help debug the code in repository by reporting any bugs. The more detailed the report the better. If you have a bug-fix
or a unit-test, please create an issue under the “Issues” tab of this repository and someone will follow-up with it as
soon as possible.
Likewise, if you would like to make a recommendation on how to improve the code in this repository, take the time to send
a message so that it can be considered for an upcoming release. Or, if you would like to contribute to the development of
this Objective-C SQLite repository, go ahead and create a fork.
You can also email any bug-fixes, unit-tests, or recommendations to [email protected].
Usually, code is not posted to this SQLite repository unless it works; however, there are times when some code may get
posted even though it still contains some bugs. When this occurs, every attempt will be made to list these known bugs
in this README (if they are not already listed under the “Issues” tab).
At the current time, there are no known bugs. However, the “XML to DDL” schema processing is still being developed.
This Objective-C SQLite project is updated frequently with bug-fixes and new features. Be sure to add this repository
to your watch list so that you can be notified when such updates are made. You can also request email notifications
regarding updates by emailing [email protected].
This project is under heavy development. There are development plans to add:
Help expand this list with your feedback.
Copyright 2011-2015 Ziminji
Licensed under the Apache License, Version 2.0 (the “License”); you may not use these files except in compliance with the
License. You may obtain a copy of the License at:http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.