Jump to content

Recommended Posts

Posted

When is good time to do _SQLite_Shutdown() , in my program there is lot of buttons that need to query _SQLite so i made little function for that

something like this below , my question is is it good practice to open and close database at every query , or open database at program start and close it when you exit program

Func _bazaread ($upit)
    
    Local $sSQliteDll = _SQLite_Startup(@ScriptDir & "\include\sqlite3_x64_300801000.dll", False, True)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
                        "Not FOUND in @ScriptDir, @WorkingDir," & @CRLF & @TAB & "@LocalAppDataDir\AutoIt v3\SQLite," & @CRLF & @TAB & "@SystemDir or @WindowsDir")
        Exit -1
    EndIf
    $dbn = _SQLite_Open("include\statisika.db3")
    
    _SQLite_Query(-1, "SELECT "&$upit, $hQuery) ; Upit iz baze stavljamu u array
    While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
    $podatci = $aRow[0]
    WEnd
    
    _SQLite_Shutdown()
    Return $podatci
    EndFunc

 

  • Solution
Posted

Code like this:

At program start:
_SQLite_Startup
_SQLite_Open

proceed with the main code

before exit:
_SQLite_Close
_SQlite_ShutDown

Prefer _SQLite_GetTable[2d] to your use of _SQLite_Query and _SQLite_FetchData

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)

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
  • Recently Browsing   0 members

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