skip to content

 Web design 

Database-driven systems

Easy-to-maintain web sites


 



AutoIt

AutoIt is a great programming tool that's easy to learn and use. It's free, it has lots of User Defined Functions (UDF's) and it can be compiled. The syntax is quite similar to PHP so it is very easy to use if you already know PHP. It was originally built for automation tasks but it now can do almost anything on a PC or through access to the internet.

You can visit the website to get more info so I won't go into any more detail here.


SQLite_Easy

I have built a few UDFs for my own use. One of them is SQLite_Easy, a simplified way of using a SQLite database in an AutoIt program. This comes with examples and other supporting information. It isn't intended to be a database tutorial but the examples are quite simple and go step-by-step so for someone who is not very familiar with using a database, they may provide a good introduction. You can find the download for SQLite_Easy at the bottom of this page.

Background

  • Using SQLite is already quite easy in AutoIt. It integrates quite well using the SQLite UDF. There is documentation for each function with example code.

  • Despite this, even though I am quite familiar with databases and SQL (Structured Query Language), I still spent quite a bit of time to become familiar with the commands and how to use SQLite (versus MySQL that I use most often). 

  • For my own use (initially) I figured out how to use SQLite databases in AutoIt and created Functions to support all of the (simple) standard needs in working with a database. I also created sample code to demonstrate how to use the most common database functions.

  • Version 1.1 adds some new functions to make SQLite_Easy even better and easier to use. There are also some additional examples showing a wider range of usage.

Limitations
Sqlite_easy isn't an all-purpose facility supporting every possible use of SQlite. It is intended for simple uses of SQLite. The most significant limitation is that it is limited to using one database and one table (or multiple joined tables) at one time. An application that requires more than this (or may in the future) should use the native sqlite.au3 UDF. In a future release of SQLite_easy, support will likely be added for connections to multiple tables in parallel (no plan/date for this yet). 

What's Changed in Version 1.1
The Changes in this Version are mostly about making it easier to code SQLite requests and to access the data from a database table.

  • Simplified Table Inserts
    SQLite only provides the traditional format for inserts where you list the fields and then list the data for each one. MySQL and maybe others allow you to use the same format as an update ( set field1='aaaa',field2='bbb'...). SQLite_Easy now returns the ROWID for an Insert which you need to use a similar approach for SQLite.

  • SQLite_String: Simplified Strings for SQL Commands
    If you are defining an SQL string (e.g. Insert or Update) in Autoit and the column values are mostly variables, then the string becomes a long awkward series of concatenated literals and variables. This function allows you to embed the variables in the input string. The output string has the values of the variables inserted in place of the variable names. Thus, you can provide an input string such as " Update people set field1='$a1', field2='$a2' ..."

  • SQLite_Col: Use Associative Indices
    Accessing the data from an SQLite_Read normally involves retrieving the data from an array using an index number (based on the relative position of the column). In other languages like PHP, you can also access the col using the name of the column. You can't normally do this in Autoit since it doesn't support associative arrays.

    The SQLite_Col function provides the ability to reference the columns returned by an SQLite_Read using the column name. This makes the code easier to create and easier to read; and, it separates the code from the structure / order of the table columns.
     

The SQLite_Easy (zip) package includes:

  • The _SQLite_easy.au3 udf

  • The SQLite_v3.dll.au3 module that provides the support for SQLite Version 3

  • Nine example modules that show how to use SQLite_easy (and SQLite SQL) to do the most common database functions with an SQLite database.

  • A link to download the SQLite Expert Utility that you can use to create and manage SQLite databases.

  • A link to the Web page for the SQLite SQL Language.


With these resources, I think that you will find it quite simple to use an SQLite database in your AutoIt program.

Note: the sqlite_easy module is currently set up to use the DLL module that is provided (named 
SQLite_v3.dll.au3). It does not use the module provided with the latest versions of Autoit. That can be easily changed in Sqlite_easy.au3 (and likely will be in the next release of Sqlite_easy).

AutoIt UDF's For Download
SQLite_Easy V1.1 downloads: 2175 | type: zip | size: 0 kB

 Version 1.1 as of Aug 23, 2011

 
   

Powered by Website Baker,
Design by Innovations Design based on a template by gavjof