PDA

View Full Version : SQLite3 Action Plugin (free)



reteset
03-05-2009, 02:08 PM
SQLite3 Action Plugin for AutoPlay Media Studio

This is A Lua module that Orginally written for Lua
This module is ported to an AMS Action plugin


Lua Version : Lua 5.1

SQLite Version : 3.6.5

Plugin Version : 1.0.0.0

Plugin Licence : Just A Thanks



Credits :

Vista Compatibility Tested By Dermot

SQLite3 Lua Wrapper Orginally written By

* Tiago Dionizio
* Doug Currie

You can Download It From Here (http://www.amsplugins.com/details.asp?ID=74&CID=1)

RizlaUK
03-05-2009, 02:35 PM
nice work reteset :yes

Thanks ;)

Imagine Programming
03-05-2009, 04:40 PM
I'll be absolutely happy to say: Thank you!

great work:)

ShadowUK
03-05-2009, 11:27 PM
Lua Version : Lua 5.1

Does this mean, what I think it means?

reteset
03-06-2009, 10:43 AM
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

ShadowUK
03-12-2009, 12:25 AM
Sounds amazing, You think you might be able to do LuaSocket? It'll really help my project finish.

reteset
03-13-2009, 04:42 AM
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

kambiz
03-25-2009, 03:27 AM
Nice work,
Thank you! ;)

Shide
03-25-2009, 07:48 AM
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...?

:huh

Thanks
Andy

reteset
03-25-2009, 09:07 AM
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 (http://luasqlite.luaforge.net/lsqlite3.html)
also this document is included with some examples into package that you have downloaded

gvanassche
03-28-2009, 05:31 AM
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

gvanassche
03-29-2009, 06:16 AM
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 INTO -- This step is always executed

What I did not yet discover is how to add data from input fields...
INSERT 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

bule
03-29-2009, 11:42 AM
Have you tried this:


myvalue = Input1.GetText()
sql = "INSERT INTO Table (id, name) VALUES (null, "..myvalue..");"

...assuming your table column names are id and name, respectively.

gvanassche
04-04-2009, 09:51 AM
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

ShadowUK
04-04-2009, 09:54 AM
Have you tried this:


myvalue = Input1.GetText()
sql = "INSERT INTO Table (id, name) VALUES (null, "..myvalue..");"

...assuming your table column names are id and name, respectively.


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.


myvalue = Input1.GetText()
sql = "INSERT INTO Table (id, name) VALUES (null, "..myvalue..");"


Don't you mean
Input.GetText("Input1"); ?

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

Dermot
04-04-2009, 11:52 AM
This

sql = "INSERT INTO Table (id, name) VALUES (null, "..myvalue..");"
Should be

sql = "INSERT INTO Table (id, name) VALUES (null, '"..myvalue.."');"

gvanassche
04-04-2009, 02:26 PM
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 INTO ProfServ (id, cdat, cust, desc, proj, lang) VALUES (NULL, '".. s_cdat .."', '".. s_cust .."', '".. s_desc .."', '".. s_proj .."', '".. s_lang .."');

]]



Thanks!

gert

ShadowUK
04-04-2009, 03:51 PM
Concentation in long strings ( [[ ]] ) is something along the lines of this.


world = "world";
hello = [[Hello ]]..world..[[!]];

Dermot
04-04-2009, 03:57 PM
Try this.

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

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

bule
04-05-2009, 05:28 AM
First, bule.

myvalue = Input1.GetText()
sql = "INSERT INTO Table (id, name) VALUES (null, "..myvalue..");"

Don't you mean
Input.GetText("Input1");?

Indeed. Too much of a Delphi lately, I guess.

azmanar
05-15-2009, 01:55 AM
Hi,

Just bumping this thread up for everyone's reference.

Major contributions by our friends, Reteset & Dermot.

reteset
07-10-2009, 12:50 PM
here is a simple first step example for SQLite3 action plugin
actually there are no much differences between standard SQLite plugin

for example sqlite3:exec("") does same thing with SQLite.QuerytoTable

simply : sqlite3:exec("") returns same thing with SQLite.QuerytoTable

this example shows :


Create and open a database


Create a table with simple fields


Add 500 entry


Query and load data into stadard grid object


i am going to update this example when i have got free times

reteset
08-07-2009, 01:11 PM
Correction :

Lua Version : Lua 5.1 was not correct

this plugin uses statically linked Lua 5.0 library that comes with IR PluginSDK
it was an unnecessary information though
sorry for confusion.

reteset
01-13-2010, 01:52 PM
is there anyone who has some examples which are using SQlite3 plugin.
if so please could you upload to here.
because i am receiving example request PMs from new users
and i can not provide examples for this plugin right now

thanks

webultra
01-13-2010, 09:57 PM
Here comes the help :) . 3 more ways to read a database and fill the grid. I hope this could help.

reteset
01-14-2010, 05:25 AM
Here comes the help :) . 3 more ways to read a database and fill the grid. I hope this could help.

thank you :yes

Centauri Soldier
02-24-2010, 05:44 PM
Hey reteset,

Do you have any plans to update this plugin with functions for the intellisense and all that fancy? I'd love to see more done with this plugin, I love it!

Imagine Programming
02-24-2010, 06:33 PM
thank you :yes

And something else, how did you get a green name, but a Forum Member rank? 0.o'

reteset
02-25-2010, 12:08 AM
And something else, how did you get a green name, but a Forum Member rank? 0.o'

what ??

what is Forum Member rank

webultra
03-03-2010, 09:57 AM
Another function that could be use after FillGrid()


function AppendGrid(gObject, sqlquery, title)
if db then
if ( db:isopen() ) then
local stmt = db:prepare(sqlquery)
if stmt then
--## If we don't know the number of columns that will be retrieved by the query we can do the following ##--
if (Grid.GetColumnCount(gObject)) < (stmt:columns()) then
for b=1, ((stmt:columns())-(Grid.GetColumnCount(gObject))) do
Grid.InsertColumn(gObject, -1, false);
end
end
Grid.InsertRow(gObject, -1, false);
local j = Grid.InsertRow(gObject, -1, false);
if title then --it's like a subtitle that describes what we're going to append
Grid.SetCellText(gObject, j, 0, title, false);
else
Grid.SetCellText(gObject, j, 0, "", false);
end
local k = Grid.InsertRow(gObject, -1, false);
--## END ##--
Grid.SetRedraw(gObject, false, false);
for n,y in stmt:get_names() do
Grid.SetCellText(gObject, k, n-1, y, false);
end
for row in stmt:rows() do ----It returns an indexed table like db:rows
nRowID = Grid.InsertRow(gObject, -1, false);
for x=1, stmt:columns() do
if row[x] then
Grid.SetCellText(gObject, nRowID, x-1, row[x], false);
else
Grid.SetCellText(gObject, nRowID, x-1, "", false);
end
end
end
Grid.AutoSizeColumns(gObject, GVS_DEFAULT, false);
Grid.ExpandLastColumn(gObject, false);
Grid.SetRedraw(gObject, true, true);
stmt:finalize();
end
else
Dialog.Message("Notice", "You haven't selected any database.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
end
else
Dialog.Message("Notice", "You haven't selected any database.", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
end
end

Imagine Programming
03-03-2010, 10:27 AM
what ??

what is Forum Member rank

The text what sais Indigo Rose Customer or Forum Member, but for
some reason, it sais Indigo Rose Customer again in your name (it said
Forum Member a while back)

reteset
05-20-2010, 04:01 PM
SQlite3 Action Plugin Has Been Updated

What's New :


New : Updated to AutoPlay Media Studio 8


New : Help file now integrated to plugin (except actions)


Note : Plugin now requires minimum Windows 2000


Download : Click Here (http://www.amsplugins.com/details.asp?ID=74&CID=1)