Announcement

Collapse
No announcement yet.

SQLite3 Action Plugin (free)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • gvanassche
    Guest replied
    Bule, Dermot,

    I'm not seeing the mistake in my code... Can you help?

    local db =sqlite3.open("D:\\Projects\\ProfServ\\test.sqlite ")

    db:exec[[
    CREATE TABLE ProfServ (id INTEGER PRIMARY KEY, cdat, cust, desc, proj, lang);
    ]]

    db:exec[[
    INSERT IGNORE INTO ProfServ (id, cdat, cust, desc, proj, lang) VALUES (NULL, '".. s_cdat .."', '".. s_cust .."', '".. s_desc .."', '".. s_proj .."', '".. s_lang .."');

    ]]
    Thanks!

    gert

    Leave a comment:


  • Dermot
    replied
    This
    Code:
    sql = "INSERT IGNORE INTO Table (id, name) VALUES (null, "..myvalue..");"
    Should be
    Code:
    sql = "INSERT IGNORE INTO Table (id, name) VALUES (null, '"..myvalue.."');"

    Leave a comment:


  • ShadowUK
    replied
    Originally posted by bule View Post
    Have you tried this:

    Code:
    myvalue = Input1.GetText()
    sql = "INSERT IGNORE INTO Table (id, name) VALUES (null, "..myvalue..");"
    ...assuming your table column names are id and name, respectively.
    Originally posted by gvanassche View Post
    Hi Bule,

    what happens in that case is that the text ..myvalue.. is stored in the db, and not the actual contents of the variable myvalue...

    Thanks

    gert
    Both of you have errors.

    First, bule.

    Code:
    myvalue = Input1.GetText()
    sql = "INSERT IGNORE INTO Table (id, name) VALUES (null, "..myvalue..");"
    Don't you mean
    Code:
    Input.GetText("Input1");
    ?

    And gvanassche, "..Variable.." is concentation, which means "..myvalue.." will be replaced with the variable in myvalue.

    Leave a comment:


  • gvanassche
    Guest replied
    Hi Bule,

    what happens in that case is that the text ..myvalue.. is stored in the db, and not the actual contents of the variable myvalue...

    Thanks

    gert

    Leave a comment:


  • bule
    replied
    Have you tried this:

    Code:
    myvalue = Input1.GetText()
    sql = "INSERT IGNORE INTO Table (id, name) VALUES (null, "..myvalue..");"
    ...assuming your table column names are id and name, respectively.

    Leave a comment:


  • gvanassche
    Guest replied
    what I figured out so far...

    I need to add new record in 2 steps:
    - a db:exec with CREATE TABLE -- If this has already been done before, the step has no effect.
    - a db:exec with INSERT IGNORE INTO -- This step is always executed

    What I did not yet discover is how to add data from input fields...
    INSERT IGNORE INTO Table VALUES (NULL, field1 );
    works fine if I enter the data manually like "this is text of field1", but when this data is in a variable, I cannot insert the variable. I can do lot's of other stuff with it (like showing it in a dialogbox)... I don't understand why the variable is not inserted at all...

    Has anyone experienced the same problem?

    thanks

    gert

    Leave a comment:


  • gvanassche
    Guest replied
    although this is not (yet -- I hope) the new SQLite3 action plugin, this is very promising. Thank you so much reteset & dermot! I'm sure this small community appreciates your work!

    I tried to figure out how to use this, but since I'm not a db-specialist at all, I can only use the example to do the same as in the example: create a table and add some records. If I just want to add new records to an existing table, I get stuck. I don't find the cause; I guess it is me ;-)

    If anyone could help by creating an extended example, that would surely help!

    thanks

    gert

    Leave a comment:


  • reteset
    replied
    this is not a newer version of official SQLite action plugin

    this is a Lua module same as LuaCom
    orginally published here http://luaforge.net/projects/luasqlite/

    there is no script editor integration with this plugin
    you should write functions manually

    here is the Function Reference
    also this document is included with some examples into package that you have downloaded

    Leave a comment:


  • Shide
    replied
    No SQLite3 in "new action wizard"

    It's probably just me, but after installing the plugin and enabling it on my project, when I click on "new action" there is no SQLite3 option in the list like there is for previous versions.... any ideas...?



    Thanks
    Andy

    Leave a comment:


  • kambiz
    replied
    Nice work,
    Thank you!

    Leave a comment:


  • reteset
    replied
    Originally posted by ShadowUK View Post
    Sounds amazing, You think you might be able to do LuaSocket? It'll really help my project finish.
    i am busy right now but i'll try it when i have time

    Leave a comment:


  • ShadowUK
    replied
    Sounds amazing, You think you might be able to do LuaSocket? It'll really help my project finish.

    Leave a comment:


  • reteset
    replied
    Originally posted by ShadowUK View Post
    Does this mean, what I think it means?
    when we are creating plugins ,
    we are including a Lua Runtime Library (statically) same as AMS
    it was the version of that libray , just for informational
    also i wrote SQLite version ,which is 3.6.5 , but latest SQLite version is 3.6.11

    i thought, maybe some one may attempt to use a feature of SQLite 3.6.11

    Leave a comment:


  • ShadowUK
    replied
    Originally posted by reteset View Post
    Lua Version : Lua 5.1
    Does this mean, what I think it means?

    Leave a comment:


  • Imagine Programming
    replied
    I'll be absolutely happy to say: Thank you!

    great work

    Leave a comment:

Working...
X