see here for German Thread
DBA is an object oriented wrapper around several different databases/database providers to standardize the access interface. It is similar to ADO from MS or the jdbc driver in Java. Currently DBA supports SQLite, MySQL and ADO. (ADO is itself an abstraction of Database Access and incorporates many drivers such as OLEDB for MSAccess and others for MS SQL Servers)
Please note that this project is in an early stage and bugs are expected, feature requests are welcome.
The basic idea beyond this Project is to abstract the underling database to uniformize and simplify the access to a database. You get an very intuitive way to access a database, which will be demonstrated below. This is done in wrapping the native table data/resultsets in Objects with several helper Classes for Tables, Rows, Fields and finally the dll wrappers.
Requirements
AHK_L 1.1.08 or above. Unicode, Ansi, 32bit, 64bit is supported in any combination.
DBA 64bit support: MySQL and SQLite3 are supported in 64bit AHK build. (64bit versions of mysqlib.dll and sqlite3.dll are included in /Lib/x64/, the internal DLL Loader will automatically choose the correct Dll for you)
Everything runs out of the box

Download Lib & Example
The example runs out of the box, using an SQLite Database.
DBA on

Usage
To open a connection to a Database, use the DBA.DataBaseFactory.OpenDataBase Method:
SQLite:
connectionString := "C:\my\sqlite\database.sqlite" db := DBA.DataBaseFactory.OpenDataBase("SQLite", connectionString)OpenDataBase is a static method, which will build an instance of "DataBase" Class, which then is stored in the db variable -> db
Beyond the facade it will resolve the DB Type and create a concrete Instance for the given DB Type, but as a user of this code you don't have to care about.
MySQL:
connectionString := "Server=localhost;Port=3306;Database=test;Uid=root;Pwd=toor;" db := DBA.DataBaseFactory.OpenDataBase("MySQL", connectionString) ; MySQL
ADO - MsAccess:
connectionString := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" A_ScriptDir "\Test\TestDB.mdb" db := DBA.DataBaseFactory.OpenDataBase("ADO", connectionString) ; ADO
Database Queries
Whichever database we use, we know that our DB Object will have a Method called "Query(sql)", to perform a simple SQL-Query.
res := db.Query("Select * from Test")res might be a bool true/false (on a command statement) or a table Object, which contains a full resultset-dump.
Now you can iterate through the Tables Rows and access the fields:
table := db.Query("Select * from Test") columnCount := table.Columns.Count() for each, row in table.Rows { Loop, % columnCount msgbox % row[A_index] }However, you can also access the fields by its column-name. This is demonstrated below in the record-set show-case:
RecordSet (Get the rows step by step)
If you have a lot of data you may not wan't to dump it all in your clients memory. In those cases you can use a RecordSet:
rs := db.OpenRecordSet("Select * from Test") while(!rs.EOF){ name := rs["Name"] phone := rs["Phone"] ; column-name oder Index MsgBox %name% %phone% rs.MoveNext() } rs.Close()Insert Data
To fill data into the DB, you create a simple Object which must have the same Propertynames as the Table Columnames are:
;Table Layout: Name, Fname, Phone, Room record := {} record.Name := "Hans" record.Fname := "Meier" record.Phone := "93737337" record.Room := "wtf is room!? :D" db.Insert(record, "Test")Simple as that. The Insert-SQL will be generated automatically.
so far
IsNull
Credits:
- [*:g7kj61hw] SQLite uses big parts of "ich_L"'s library @ <!-- m -->http://de.autohotkey...opic.php?t=7350<!-- m -->
[*:g7kj61hw] MySQL.ahk was inspired from "panofish" @ <!-- m -->http://www.autohotke...topic67280.html<!-- m -->
[*:g7kj61hw] infogulch - Several contributions on github
Deprecated Version 0.9
1.6 Several Bugfixes & refactorings, introducing BLOB support
1.5a Fixed path related issues when #NoEnv is not present
1.5 Fixed ADO Non-Selection Queries, merged several fixes from infogulch (FilePath-Check, DllCall fixes.)
1.4 Fixed ADO Connection Closed bug, updated sqlite.dll (32bit) to newest version (supporting multiline SQL Inserts, 64 bit is already the newest version)
1.3 several minor fixes according to SQLite. SQLite has now 64bit support out of the box!
1.2 several minor fixes according to mySQL (AHK_L 64bit works now as expected!)
1.1b merged several fixes by infogulch
1.1a added DB Types thx @ infogulch
1.1 - fixed InsertMany in ADO, using nested classes as namespaces DBA.Recordset etc.
1.0 - first support for ADO, prefixed class names with "DBA"
0.9 - support 64bit AHK for MySQL.
0.8b - added string escaping on autogenerated inserts, added db.EscapeString(string)
0.8a - fixed some mysql related bugs, fixed bugs introduced with 0.8
0.8 - several fixes, updated to current AHK_L Syntax, added QueryVaule(...) Method
0.7 - Implemented auto reconnect on MySQL Servers (thx @ panofish)
0.6 - Support MySQL