[sqlite] What's the status of SQLite4? Where can I find its source code?

2015-10-06 Thread Stefanos Sofroniou
@Scott Robison
+1 mate; I thought the same thing as I was reading this. Maybe a 
different concept, something like SQLiteNG (SQLite Next Generation)?

It's just a thought, that's all.

Cheers.

On 10/05/2015 05:47 PM, Scott Robison wrote:
> It seems to me the reason these questions keep coming up because people are
> encouraged to use the latest and greatest version of SQLite 3 at all times,
> and SQLite 4 sounds like something even later and greater. I wonder if a
> name like SQLite X might reduce the number of queries. Well, maybe not
> SQLite X, but something different that doesn't imply what 4 implies.
>
> On Mon, Oct 5, 2015 at 4:30 AM, Richard Hipp  wrote:
>
>> Jerry & Scott:  What are you hoping to achieve with SQLite4 that you
>> cannot do with SQLite3?
>>
>> On 10/5/15, Stephen Chrzanowski  wrote:
>>> There was a thread sometime last year about this.  Basically, SQLite4
>> isn't
>>> planned for a release at this time, and from what I understood then,
>>> chances are there isn't going to be a thought towards release for at few
>>> more years.  It basically is a playground to test theories, it is buggy,
>>> and such.  It shouldn't be considered for use in a production
>> environment.
>>> On Mon, Oct 5, 2015 at 1:18 AM, Scott Doctor 
>> wrote:
 Is there a release date set for sqlite4?

 
 Scott Doctor
 scott at scottdoctor.com
 --


 On 10/4/2015 9:14 PM, Stephen Chrzanowski wrote:

> https://sqlite.org/src4/tree?ci=trunk
>
> On Mon, Oct 5, 2015 at 12:02 AM, Jerry  wrote:
>
> Seems I could not find its source code ...
>> https://sqlite.org/src4/doc/trunk/www/index.wiki
>>
>> Thanks.
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
 ___
 sqlite-users mailing list
 sqlite-users at mailinglists.sqlite.org
 http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

>>> ___
>>> sqlite-users mailing list
>>> sqlite-users at mailinglists.sqlite.org
>>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>
>> --
>> D. Richard Hipp
>> drh at sqlite.org
>> ___
>> sqlite-users mailing list
>> sqlite-users at mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>



[sqlite] Latest SQLite version for Java

2012-06-29 Thread stefanos sofroniou
Greetings everyone.

I have searched a bit how to use SQLite's latest version in Java and 
unfortunately did not find anything other than SQLiteJDBC (which is really 
outdated) and sqlite4java (which has not released any update for about a year 
now).

I feel a bit bittered with the way Java is treated, because C and C++ 
programmers can immediately use the C API. Various scripting languages like 
PHP, Python, and Ruby (just to name a few), support it by default following the 
latest database releases. Also, SQLite itself have forked an ADO.NET adapter 
project which has become part of their official release putting ahead .NET in 
contrast to Java.

Isn't a bit oxymoron that Oracle is an SQLite's consortium member and does not 
have full support for one of their greatest product, named Java Programming 
Language?

Is the SQLite development team aware of it, are they willing to do anything 
about it, or do they feel that such thing will going to slow down the SQLite 
Development procedure?

I'm waiting for your valuable reply.

Regards,

Stefanos
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Load SQLite from InputStream in Java as ReadOnly

2012-06-28 Thread stefanos sofroniou
Hector, here's the link from official SQLite website about Flags for File 
opening operations: 

http://www.sqlite.org/c3ref/c_open_autoproxy.html

Unfortunately I don't know anything (yet!) about SQLite under Java. If you need 
any other kind of help, let me know.


>
> From: Hector Guilarte 
>To: sqlite-users@sqlite.org 
>Sent: Thursday, June 28, 2012 4:08 PM
>Subject: Re: [sqlite] Load SQLite from InputStream in Java as ReadOnly
> 
>Hello?
>
>I'm starting to feel hopeless, No luck in StackOverflow and no luck here
>:-(...
>
>Well, i guess it just can't be done.
>
>On Wed, Jun 27, 2012 at 10:13 AM, Hector Guilarte wrote:
>
>> Hello everyone,
>>
>> I'm new to SQLite as well as to this list. I'm writing because I was
>> planning on using SQLite for a personal -but public- project that I wanted
>> to make available through Google App Engine. It is basically a SQLite to
>> CSV converter and a SQLite to VCard converter. In other words, I have an
>> Address Book in a SQLite database and I wanted to export it to a well-known
>> format for importing it to some other places, as CSV and as VCard.
>>
>> I already placed my question in StackOverflow.com last friday with no
>> luck, it has only been seen 21 times and the only answer I received was not
>> helpfull since it was telling me somehing like "first use something like
>> what you are trying to develop yourself and then use yours with their
>> output" (nahh, I'm kidding, but the real answer is not far from that and it
>> can be seen here:
>> http://stackoverflow.com/questions/11155537/load-sqlite-from-inputstream-in-java-as-readonly
>> )
>>
>> If somebody has an answer, even if it is "It's not possible at all, so
>> drop it" and is a stackoverflow user, feel free to go ahead and answer over
>> there to earn the points, but please post your answer here as well. Now my
>> question as I wrote it in StackOverflow:
>>
>> I have an App which receives a SQLite database to read some data and
>> export it as an CSV. I'm trying to upload it to Google App Engine but I
>> faced a huge problem which I think makes it impossible to use the GAE for
>> this app.
>>
>> The problem is that since on the GAE I can't write to the FileSystem, I
>> can't open the JDBC Connection to the SQLite file and therefore I can't
>> read the data to convert to CSV. I've been looking for other options such
>> as Google Cloud Storage, but I don't want to use my only "free trial" of it
>> on this application, and actually I don't want to have to pay ever for this
>> app after the Free Trial ends, so this is not an option.
>>
>> After a lot of research, my only guess is that I might be able to load the
>> database straight from the InputStream as I received it from the upload
>> form I'm using to get it, however, this is a 100% lucky guess and I've not
>> been able to find anything about this approach online, but I just don't
>> want to believe it can't be done with any of the existing JDBC libraries to
>> SQLite and I'm hoping somebody here will tell me how to do it.
>>
>> If the InputStream approach is not possible, but you know some other way
>> to open a SQLite DB in GAE to READ ONLY, and then dispose it, feel free to
>> comment as well...
>>
>> If there is another option like "don't use JDBC, use a socket connection
>> with a pipe to open the connection with the InputStream", I'd also like to
>> hear that, it does not HAVE to be done with JDBC.
>>
>> Thanks a lot,
>>
>> Héctor Guilarte
>>
>___
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Foreign key constraint failed

2012-06-03 Thread stefanos sofroniou
You are missing parentheses here:

create table if not exists a (id integer primary key autoincrement, a text 
unique, b default current_timestamp);
create table if not exists b (id integer primary key autoincrement, a integer 
references a(id) on update cascade on delete cascade, b text, c text, d text, e 
text, f real, g text, h text, unique (a, b) on conflict ignore);
create table if not exists c (id integer primary key autoincrement, a integer, 
b integer references b(id) on update cascade on delete cascade, c integer, d 
text, e integer, f text, g blob, unique (a, b, c) on conflict ignore);


Also here you miss 'a'

insert into c (a, b, c, d, e, f, g) values (:a, :b, :c, :d, :e, :f, :g);


Also what sqlite version are you using?

I have run this with the latest available version (3.7.12.1) under SQLite 
Manager (Firefox / Iceweasel extension).

If you need any further help, please let me know.

Cheers.

Stefanos



>
> From: Jörgen Hägglund 
>To: sqlite-users@sqlite.org 
>Sent: Sunday, June 3, 2012 11:10 PM
>Subject: [sqlite] Foreign key constraint failed
> 
>Hi all!
>I have just recently discovered the strengths of foreign keys but now, I've 
>been banging my head against the wall for a couple of days.
>I just can't figure out what is causing the error or how to get around it.
>Here's the specs (simplified) of my DB;
>
>create table if not exists a (id integer primary key autoincrement, a text 
>unique, b default current_timestamp);
>create table if not exists b (id integer primary key autoincrement, a integer 
>references a(id) on update cascade on delete cascade, b text, c text, d text, 
>e text, f real, g text, h text, unique (a, b) on conflict ignore;
>create table if not exists c (id integer primary key autoincrement, a integer, 
>b integer references b(id) on update cascade on delete cascade, c integer, d 
>text, e integer, f text, g blob, unique (a, b, c) on conflict ignore;
>
>And the insert query;
>
>insert into c (b, c, d, e, f, g) values (:a, :b, :c, :d, :e, :f, :g);
>
>The problem is that I get a "Foreign key constraint failed" error when I try 
>to insert the same data twice. The first time it works as it should and the 
>data is inserted correctly. But, the second time, I get the exception.
>
>Is there anyone out there who's willing (and able) to help me? And hopefully 
>explain what I'm doing wrong.
>
>Regards,
>/Jörgen
>
>___
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Clarification about NULL NOT Constraints

2012-04-24 Thread stefanos sofroniou
Dear all,

I have been gazing my code for amount 20 minutes now and I really need your 
help with this silly yet simple code.

CREATE TABLE testing(
id integer primary key,
name text not null default 'hello');

* If I insert an empty row with null values, it does not work.

* If I insert an N value to id, name adds default string as its value.
* If I insert any character in name, id automatically adds a value.
* If I run this line "insert into testing default values;" it works 
just fine.
Can you clarify this just a bit please about the first line with null values?

I know that sounds silly since I have declared my name as not null, but should 
not the shell caught this and check for its default alternative if any?

Regards,

Stefanos
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Problem with sqlite and codeblocks (mingw)

2012-01-28 Thread stefanos sofroniou
Robert,

Have you tried wxSQLite3? It works like a charm for many wxWidgets' projects.

Here's the link http://wxcode.sourceforge.net/components/wxsqlite3/

Regards,

Stefanos



>
> From: Robert Gdula 
>To: sqlite-users@sqlite.org 
>Sent: Saturday, January 28, 2012 5:46 PM
>Subject: [sqlite] Problem with sqlite and codeblocks (mingw)
> 
>Hi, I have a problem with compilation sqlite for mingw and code:blocks,
>everything is ok and compilation don't show any abnormal information, but
>when I try only add library of sqlite to the linker  of sample wxwidgets
>program it doesn't work. Everything is ok when I use normal cosole program
>for C++ but when I use wxwidgets everything is wrong, program compile
>without any errors and warning but don't show anything on the screen, when
>I try debugging.
>
>It is my build log of sqlite library (everything build as a static library):
>
>[ 33,3%] mingw32-gcc.exe  -Wall -g  -Weffc++ -w -Wextra -g
>-IC:\MY_PROJECT\SQLCIPHER\lib  -c C:\MY_PROJECT\sqlite\shell.c -o
>obj\Debug\shell.o
>cc1.exe: warning: command line option '-Weffc++' is valid for C++/ObjC++
>but not for C [enabled by default]
>[ 66,7%] mingw32-gcc.exe  -Wall -g  -Weffc++ -w -Wextra -g
>-IC:\MY_PROJECT\SQLCIPHER\lib  -c C:\MY_PROJECT\sqlite\sqlite3.c -o
>obj\Debug\sqlite3.o
>cc1.exe: warning: command line option '-Weffc++' is valid for C++/ObjC++
>but not for C [enabled by default]
>[100,0%] ar.exe -r -s libsqlite.a obj\Debug\shell.o obj\Debug\sqlite3.o
>ar.exe: creating libsqlite.a
>Output size is 1,28 MB
>
>The sam build log for my sample wxwidgets_app:
>
>-- Build: Debug in Wx_test_sql ---
>
>[ 20,0%] mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__
>-DwxUSE_UNICODE -Wno-attributes -Winvalid-pch -include wx_pch.h
>-DWX_PRECOMP -Wall  -g -D__WXDEBUG__  -Weffc++ -w -Wextra -g
>-IC:\wxWidgets-2.8.12\include -IC:\wxWidgets-2.8.12\contrib\include
>-IC:\wxWidgets-2.8.12\lib\gcc_lib\mswud  -c
>C:\MY_PROJECT\Wx_test_sql\wx_pch.h -o wx_pch.h.gch\Debug_wx_pch_h_gch
>[ 40,0%] mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__
>-DwxUSE_UNICODE -Wno-attributes -Winvalid-pch -include wx_pch.h
>-DWX_PRECOMP -Wall  -g -D__WXDEBUG__  -Weffc++ -w -Wextra -g
>-IC:\wxWidgets-2.8.12\include -IC:\wxWidgets-2.8.12\contrib\include
>-IC:\wxWidgets-2.8.12\lib\gcc_lib\mswud  -c
>C:\MY_PROJECT\Wx_test_sql\Wx_test_sqlApp.cpp -o obj\Debug\Wx_test_sqlApp.o
>[ 60,0%] windres.exe -IC:\wxWidgets-2.8.12\include
>-IC:\wxWidgets-2.8.12\lib\gcc_lib\mswud  -J rc -O coff -i
>C:\MY_PRO~1\WX_TES~3\resource.rc -o obj\Debug\resource.res
>[ 80,0%] mingw32-g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__
>-DwxUSE_UNICODE -Wno-attributes -Winvalid-pch -include wx_pch.h
>-DWX_PRECOMP -Wall  -g -D__WXDEBUG__  -Weffc++ -w -Wextra -g
>-IC:\wxWidgets-2.8.12\include -IC:\wxWidgets-2.8.12\contrib\include
>-IC:\wxWidgets-2.8.12\lib\gcc_lib\mswud  -c
>C:\MY_PROJECT\Wx_test_sql\Wx_test_sqlMain.cpp -o obj\Debug\Wx_test_sqlMain.o
>[100,0%] mingw32-g++.exe -LC:\wxWidgets-2.8.12\lib\gcc_lib  -o
>bin\Debug\Wx_test_sql.exe obj\Debug\Wx_test_sqlApp.o
>obj\Debug\Wx_test_sqlMain.o  obj\Debug\resource.res  -mthreads
>-lwxmsw28ud_richtext -lwxmsw28ud_xrc -lwxmsw28ud_aui -lwxmsw28ud_media
>-lwxbase28ud_net -lwxbase28ud_xml -lwxmsw28ud_adv -lwxmsw28ud_html
>-lwxmsw28ud_core -lwxbase28ud -lwxpngd -lwxjpegd -lwxtiffd -lwxzlibd
>-lwxregexud -lwxexpatd ..\sqlite\libsqlite.a -lkernel32 -luser32 -lgdi32
>-lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid
>-lcomctl32 -lwsock32 -lodbc32  -mwindows
>Output size is 31,03 MB
>Process terminated with status 0 (0 minutes, 14 seconds)
>0 errors, 0 warnings (0 minutes, 14 seconds)
>___
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Expert

2011-11-01 Thread stefanos sofroniou
It's one of the best programs I have tested myself. I have even suggested to 
Bogdan to add forms to make it even a better application for covering GUI needs 
for complex database like in my case where I have to deal with stock taking and 
cartridges. I hope he do something about it because honestly is one of the 
greatest applications I have ever tried on SQLite adminstration; highly 
recommended by all means.




>
>From: Don V Nielsen 
>To: General Discussion of SQLite Database 
>Sent: Monday, October 31, 2011 11:05 PM
>Subject: Re: [sqlite] SQLite Expert
>
>I use the free version of sqlite expert.  I use sqlite for my IO handling.
>Having the power of sql available to test values, generate counts, etc...
>is indispensable.
>
>On Sun, Oct 30, 2011 at 2:50 PM, Abair Heart  wrote:
>
>> Hi all,
>>
>> Searching the archives implies, that "sqlite expert" hasn't been asked
>> about.
>>
>> Has anyone tried it yet?  Is the program safe? time-saving?
>>
>>
>> Thanks for any input.
>>
>> Abair
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>___
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] select where date < 30 days ago

2011-09-23 Thread stefanos sofroniou
Miklos, have you tried something like 


SELECT * FROM ticket
WHERE time 
BETWEEN '2011-08-01' AND '2011-09-01';

?

I have my "time" as current_timestamp and gives me data like "2011-09-23 
17:44:48", so using the above method works just fine with me.




>
>From: Miklos Koren 
>To: sqlite-users@sqlite.org
>Sent: Friday, September 16, 2011 3:01 PM
>Subject: [sqlite] select where date < 30 days ago
>
>Hi,
>
>This is probably a basic SQL question, but I could not make it work under
>sqlite. How do I select records for which a datetime column is less than
>today - 30 days? I tried
>
>SELECT * FROM ticket WHERE time < DATETIME('now','-30 days');
>
>but it does not give the intended results.
>
>Thanks,
>
>Miklos
>___
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Clarification about Triggers

2011-09-16 Thread stefanos sofroniou
Today I came at work with cleared mind (after a long time I would say!) and 
within minutes have found an easy and rather silly solution to my initial 
request.

Here's the code:

CREATE TABLE tmp_name(
id integer primary key,
name text);

CREATE TABLE [temp_01] (
  [id] INTEGER PRIMARY KEY AUTOINCREMENT, 
  [name_id] INTEGER, 
  [val] REAL(0, 2));

CREATE TABLE [temp_02] (
  [id] INTEGER PRIMARY KEY AUTOINCREMENT, 
  [name_id] INTEGER, 
  [val] REAL(0, 2));

  
CREATE VIEW [MergeTwoTableValuesAsOne] AS 
select tmp_name.[name],
temp_01.val  as [First Value],
temp_02.val  as [Second Value],
(temp_01.val + temp_02.val)  as [Addition],
(temp_01.val - temp_02.val)   as [Subtraction],
(temp_01.val * temp_02.val)  as [Multiplication],
(temp_01.val / temp_02.val)   as [Division],
(temp_01.val % temp_02.val) as [Remainder]

from temp_01, temp_02, tmp_name
where 
temp_01.id  = temp_02.id and
temp_01.[name_id]  = temp_02.[name_id] and
temp_01.name_id = tmp_name.id and 
temp_02.name_id = tmp_name.id;


This is way much better than passing my data to a table. Like this, I generate 
my information on the fly and if I want them in a table I can create a new 
table and insert them in:

create table  as select * from MergeTwoTableValuesAsOne;

Simple as that :D

Just wanted to share it with you guys :)

Waiting for your valuable replies.


>
>From: "Black, Michael (IS)" <michael.bla...@ngc.com>
>To: General Discussion of SQLite Database <sqlite-users@sqlite.org>
>Sent: Tuesday, August 30, 2011 6:48 PM
>Subject: Re: [sqlite] Clarification about Triggers
>
>I found that if you used the default rowid it always gave -1 for the value.
>That's why I put in it's own key.
>
>I don't understand why this doesn't work...perhaps somebody can point out the 
>error here...new.rowid contains -1.  I would think that rowid ought to be 
>available after the insert.
>This is using 3.7.4
>
>create table temp_01(val float);
>create table temp_02(val float);
>create table total(val float);
>create table row(row2 integer);
>create trigger after insert on temp_01
>begin
>insert into total values((select new.val+temp_02.val from temp_02 where 
>temp_02.rowid=new.rowid));
>insert into row values(new.rowid);
>end;
>insert into temp_02 values(2.0);
>insert into temp_01 values(1.0);
>select * from total;
>
>select * from row;
>-1
>
>
>
>Michael D. Black
>Senior Scientist
>NG Information Systems
>Advanced Analytics Directorate
>
>
>
>
>From: stefanos sofroniou [stefanossofroniou...@yahoo.com]
>Sent: Tuesday, August 30, 2011 9:42 AM
>To: Black, Michael (IS)
>Subject: EXT :Re: [sqlite] Clarification about Triggers
>
>
>I did exactly what you have suggested but it does not work properly with my 
>software.
>
>
>
>It increments my id (i replaced rownum with id, the function still is the 
>same), but the value is null for some reason.
>
>
>
>
>From: "Black, Michael (IS)" <michael.bla...@ngc.com>
>To: stefanos sofroniou <stefanossofroniou...@yahoo.com>; General Discussion of 
>SQLite Database <sqlite-users@sqlite.org>
>Sent: Tuesday, August 30, 2011 3:19 PM
>Subject: RE:[sqlite] Clarification about Triggers
>
>
>There may be a more elegant way but this works:
>
>create table temp_01(rownum integer primary key,val float);
>create table temp_02(rownum integer primary key,val float);
>create table total(rownum integer primary key,val float);
>create trigger after insert on temp_01
>begin
>insert into total values(new.rownum,(select new.val+temp_02.val from temp_02 
>where temp_02.rownum=new.rownum));
>end;
>insert into temp_02 values(1,2.0);
>insert into temp_01 values(1,1.0);
>select * from total;
>1|3.0
>insert into temp_02 values(2,20.0);
>insert into temp_01 values(2,30.0);
>select * from total;
>1|3.0
>2|50.0
>
>
>
>Michael D. Black
>Senior Scientist
>NG Information Systems
>Advanced Analytics Directorate
>
>
>
>
>From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
>behalf of stefanos sofroniou [stefanossofroniou...@yahoo.com]
>Sent: Tuesday, August 30, 2011 2:32 AM
>To: sqlite-users@sqlite.org
>Subject: EXT :[sqlite] Clarification about Triggers
>
>
>Hello everyone.
>
>I have successfully created a trigger for experimentation and I would like 
>your help for implementing the concept behind of it.
>
>My table pollaplasiasmos (which stands for multiplication in Greek, even 
>though I used English characters to write it [Gree-glish]), takes 3 values:
>        * Quantity [int]
>        * amount [real(0,2)]
>
>        * VAT [real(0,2)]I h

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread stefanos sofroniou
old.rowid was an error of mine during typing; my apologies. 


Even though I have kind of managed to comprehend the logic behind of it, and 
made it partially work, I have decided to stick with a view which does what I 
want it to do. The only problem I have now is how can to update an individual 
value from a row of my choice.




From: Igor Tandetnik <itandet...@mvps.org>
To: sqlite-users@sqlite.org
Sent: Tuesday, August 30, 2011 3:18 PM
Subject: Re: [sqlite] Clarification about Triggers

stefanos sofroniou <stefanossofroniou...@yahoo.com> wrote:
> Now what I want to do is to take two tables, (let's call them temp_01 and 
> temp_02) that would both have columns id and val, and I
> want with a trigger to add temp_01.val with temp_02.val and put their result 
> in a new table named total. 

With a trigger firing on which event? A value from which row in temp_01? Add to 
a value from which row of temp_02? Put the result into which row of total?

You talk about these tables as if they were scalars. But they potentially 
contain many rows with many values.

> I have tried something like this:
> 
> create trigger [after_insert_temp_01]
> after insert on temp_01
> begin
> update total
> set val = temp_01.val + temp_02.val
> where rowid = old.rowid;
> end;

old.rowid is not defined in an "after insert" trigger. You are inserting a new 
row, there's no old row involved.
-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Clarification about Triggers

2011-08-30 Thread stefanos sofroniou
Hello everyone.

I have successfully created a trigger for experimentation and I would like your 
help for implementing the concept behind of it.

My table pollaplasiasmos (which stands for multiplication in Greek, even though 
I used English characters to write it [Gree-glish]), takes 3 values:
* Quantity [int]
* amount [real(0,2)]

* VAT [real(0,2)]I have created the triggers to make the necessary 
calculations for vat_value (per item), vat_included (item price), and 
total_price (which includes vat).

Now what I want to do is to take two tables, (let's call them temp_01 and 
temp_02) that would both have columns id and val, and I want with a trigger to 
add temp_01.val with temp_02.val and put their result in a new table named 
total.

I have tried something like this:

create trigger [after_insert_temp_01]
after insert on temp_01
begin
 update total
 set val = temp_01.val + temp_02.val
 where rowid = old.rowid;
end;

I know that this is wrong of what I am doing, because there is no way to call 
the temp_02 table using this method; this is not an inner join where I can 
compare IDs and make the necessary adjustments on my code.

I am really out of ideas and if there's a link with more information that I 
should know already about it, by all means let me know because I need to learn 
these things.

Regards,

Stefanos
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users