Jump to content

Fast,Clean .db options?


 Share

Recommended Posts

Hey guys!

I've been using AutoIt for a couple of years.  I do not have any "official" training or classes in programming.  My degree is in Mechanical Engineering.  However, I have found programming with Autoit, VB, Python, etc. to be fun and very useful when it comes to understanding logic and expressions in PLC programming.  Creating my own little programs, with the portable version on my flash drive, has become a fun little hobby for me.

Most of my "little programs" involve storing and recalling data, along with simple calculations (average, sums).  I've been using Excel to handle my "databases".  I can perform the calculations with Excel; and write the program to simply read and display the data as well as accept input for writing to the Excel file.  Of course this presents a few issues.  The computer must have an Excel type program installed to handle the .xls files.  Additionally, Excel tends to be a little slow when it comes to opening, saving, and closing files.  

I have experimented in the past with .txt files but found the reading and writing process to be problematic.  It also lengthened my code a great deal due to the additional calculations.

I recently began research into the SQLite UDF's and was impressed with the speed, but not sure of the programs capabilities as far as performing calculations (if there are any).  

I guess I would like recommendations on a reliable, clean, self-contained (including a .dll in the script directory like SQLite is nice) type of database.  One that would support simple calculations and reasonably simple to interface with (I like my programs small and fast).

If $uHappy = True And $uKnow_it = True Then

      For $i = 1 To 2 Step 1

              Clap()
      Next

EndIf

 

Link to comment
Share on other sites

Hey NitNG4le,

If you have a large number of datas, SQLite seems indeed a good choice because you don't need anything installed on the computer to make it run.

You can do basic maths using a MySQL database directly, or you can also use the UDF to retreive data from the database, do the maths with autoIT and store the calculated data back :)

Link to comment
Share on other sites

Thanks Neutro,

I have researched the forums and found several threads concerning SQLite and AutoIt.  (I apologize moderators for starting another one.)

Sometimes it helps to explain one's situation and have specific feedback from experienced peers.

After a couple of hours of searching, reading and trying several test scripts, I am very impressed with SQLite.  It's been fairly simple to manipulate, since finding the syntax help file tucked away inside the "Extras" folder of my AutoIt directory.

I will probably have to do the math within my program.  Given my situation, finding an average can be a pain as I have several input boxes that may or may not have data.  Excel has worked well because It would average an area of cells and ignore those not containing data.  I can already perceive how to accomplish this using operators and conditional statements, it'll just require a lot of code.

If $uHappy = True And $uKnow_it = True Then

      For $i = 1 To 2 Step 1

              Clap()
      Next

EndIf

 

Link to comment
Share on other sites

You're welcome :)

This might help:

 

 
#include <Array.au3>

local $data[6]

$k=0

$sum = 0

;getting all inputbox answers in an array and removing empty ones

for $i=0 to ubound($data) - 1 step 1 ;ubound means size of the array

$data[$k] = inputbox("","Enter data " & $k & " here")

   if $data[$k] == "" then ;if answer is empty
   
        _arraydelete($data, $k) ;removing array line
   
   else
   
   $sum = $sum + $data[$k]
      
   $k = $k + 1 ;otherwise check next array line
   
   endif

Next

$average = $sum / $k

if isarray($data) then _arraydisplay($data) ;displaying result
   
msgbox("","Average", $average)
 

 

So you can basicly do what Excel does in 9 lines with autoIT, perhaps even less :)

Edited by Neutro
Link to comment
Share on other sites

You can also load extensions along with SQLite3.dll, which allow you to invoke a number of math functions which are not part of raw SQLite.

Have a look at these functions for instance. You're free to supplement them, or write your own from scratch, or write a wrapper around a more specialized library.

A good example of what can be done is Spatialite, a GIS application based on SQLite.

You can load extensions >using this UDF.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

One more SQLite extension of mine that you could find useful someday. Autodocumented in the source code which comes along the baby.

TIA for reporting bugs/usefulness.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...