Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6

Thread: SQLite Script

  1. #1
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534

    SQLite Script

    I am using the SQLite plugin and am still new at doing the whole "SELECT * FROM ..." stuff and was wondering if anyone has any SQLite functions laying around in a script file somewhere.

    Like this...
    Code:
    function SQLIte.GetValue(dbID, sTable, sColumn, sRow)
    --Mysterious SQLite code here
    return MagicValue
    end
    
    function SQLIte.CountRows(dbID, sTable)
    --Mysterious SQLite code here
    return MagicValue
    end
    Just to make the reading and writing of data from databases so much simpler. I'm sure (but I don't know how) that functions could be made that would allow a person to do just about every SQLite action there is with ease.

    Most of the trouble I'm having is that I can't figure out to get records from a database that contains more than one table. The plugin does not seem to discriminate against multiple tables in a database (or I'm just missing it).

    The possibility also exists that I'm just a N00b at this and need to give it some time to sink in in order to find simplicity in the code.

    Oh, also, anyone know how to turn on auto vacuum when using the SQLite plugin?

    Thanks for reading guys.
    Last edited by Centauri Soldier; 02-23-2010 at 06:45 PM.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  2. #2
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    sqlite.org has great documentation.

    nHandle = SQLite.Open(".\\MyDatabase.db");
    tData= SQLite.QueryToTable( nHandle, "Select * from MyTable where lastname='fish';");

    Then use the data
    tData.Data[1]["FirstName"]
    etc.

    Someone put together a small sqlite example, perhaps in the plugin directory or examples...


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  3. #3
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    Yes I did find find the website quite useful so far but I think my confusion lies in multiple table handling.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  4. #4
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    please don't take this the wrong way -- but this forum might not be the best place to get SQL help on this level.

    here's an example that uses multiple tables.

    cheesy example...
    Some comments -- start in "on start" then "on show" then "on close" and finally "on shutdown"


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  5. #5
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    No, you're probably right, Josh. This may be the wrong place indeed but thank you very much for the example.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  6. #6
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    A good 'start' to sqlite (there are differences, and my example uses some shorthand sqlite stuff) is downloading the executable SQLite.exe (The AMS sqlite plugin is version 2, not version 3) and trying things.

    Some things don't translate into the sqlite plugin -- for example sometimes views don't work. There's a few gui based sqlite interfaces too.

    "Try" and you'll learn -- it's harder learning sqlite via the plugin over using more direct tools.

    try and post code/questions.


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts