Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread fnoyanisi
He means, in your HOST struct, instead of defining a lot of in variables for each protocol type, just define your ENUM type to hold all possible protocol types, so you will insert only one protocol value into your sqlite db. When you fetch data, it will be just a matter of simple switch/case

Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Newbie89
Teg-3 wrote > Hello Newbie89, > > Sunday, April 28, 2013, 3:32:07 AM, you wrote: > > N> Thanks for the correction > N> ok...I will check first. > > > > N> -- > N> View this message in context: > N> >

Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Newbie89
Let say my C file contain this 2 variable, struct Packet { char Src_MAC[18], Dest_MAC[18]; char Net_P[5],Trans_P[5]; char Src_IP[16], Dest_IP[16]; long int Src_Port,Dest_Port, Cap_Bytes;//[ long int Range: −2,147,483,648 to 2,147,483,647] }; /* Each Host Information

Re: [sqlite] Bug in resolving aliases with parentheses in join

2013-04-28 Thread James K. Lowden
On Sun, 28 Apr 2013 12:23:42 +0200 Lucas Clemente wrote: > SELECT * FROM (t1 AS a) JOIN (t2 AS b) USING(k) WHERE a.k = 1; ... > Looks like this is due to some problem with resolving the alias in > the parantheses. Now, as far as I understand SQL this should just > work

Re: [sqlite] Index question

2013-04-28 Thread Simon Slavin
On 28 Apr 2013, at 10:18pm, Paolo Bolzoni wrote: > Interesting, so sqlite3 is smart enough to actually move the blob instead > of copying and deleting? If it is the case it is indeed great. SQLite3 keeps all the data for a row together on disk. It rewrites the

Re: [sqlite] Question about binding

2013-04-28 Thread Igor Korot
Keith, On Sun, Apr 28, 2013 at 2:21 PM, Keith Medcalf wrote: > > Exactly ... Both a=? and c=?1 will use the same parameter. With named > parameters you would do something like: > > Where a = :a and b = :b and c = :a and d = :d > > sqlite3_bind_parameter_index(stmt, ":a")

Re: [sqlite] Question about binding

2013-04-28 Thread Keith Medcalf
Exactly ... Both a=? and c=?1 will use the same parameter. With named parameters you would do something like: Where a = :a and b = :b and c = :a and d = :d sqlite3_bind_parameter_index(stmt, ":a") -> 1 sqlite3_bind_parameter_index(stmt, ":b") -> 2 sqlite3_bind_parameter_index(stmt, ":d") -> 3

Re: [sqlite] Index question

2013-04-28 Thread Paolo Bolzoni
Interesting, so sqlite3 is smart enough to actually move the blob instead of copying and deleting? If it is the case it is indeed great. On Sun, Apr 28, 2013 at 5:12 PM, Simon Slavin wrote: > > On 28 Apr 2013, at 3:51pm, Paolo Bolzoni >

Re: [sqlite] Question about binding

2013-04-28 Thread Igor Korot
Hi, Keith, On Sun, Apr 28, 2013 at 12:34 PM, Keith Medcalf wrote: > > http://www.sqlite.org/lang_expr.html#varparam > > They are what are called Named Parameters. You use the > sqlite3_bind_parameter_index to look up the index associated with a name ... > > ?nnn simply

Re: [sqlite] Index question

2013-04-28 Thread Paolo Bolzoni
I use only the C API. The function causing it in my program is: fprintf(stderr, "%s\n", sqlite3_errmsg(db)); and I think it comes out from: sqlite3.c:70718: zErr = sqlite3MPrintf(db, "cannot open %s column for writing", zFault); On Sun, Apr 28, 2013 at 6:05 PM, Richard Hipp

Re: [sqlite] Question about binding

2013-04-28 Thread Keith Medcalf
http://www.sqlite.org/lang_expr.html#varparam They are what are called Named Parameters. You use the sqlite3_bind_parameter_index to look up the index associated with a name ... ?nnn simply means to use index nnn for that parameter. Subsequent bare ? parameter indexes are incremented by 1

[sqlite] Question about binding

2013-04-28 Thread Igor Korot
Hi, ALL, On the page http://www.sqlite.org/c3ref/bind_blob.html it says: [quote] . that matches one of following templates: - ? - ?NNN - :VVV - @VVV - $VVV [/quote] What is the purpose of having "NNN" and "VVV"? Are those standard? How do I use those templates? Everywhere

Re: [sqlite] Index question

2013-04-28 Thread Richard Hipp
On Sun, Apr 28, 2013 at 10:02 AM, Paolo Bolzoni < paolo.bolzoni.br...@gmail.com> wrote: > I get this error: "cannot > open indexed column for writing." > > What does it mean? > > That error is not coming from SQLite. Are you using a wrapper program of some kind - or perhaps a third-party query

[sqlite] Bug in resolving aliases with parentheses in join

2013-04-28 Thread Lucas Clemente
Hi, I hit something that looks like a bug when working with aliases in parentheses: CREATE TABLE t1 (k); CREATE TABLE t2 (k); This works as expected: SELECT * FROM (t1 AS a) JOIN (t2 AS b) USING(k) WHERE a.k = 1; But chaging the a to b in the WHERE clause causes the following query to error

Re: [sqlite] sequential row numbers from query

2013-04-28 Thread Bart Smissaert
Hi Hitesh, Here all the VB6 code to do with this. Ignore all the Debug stuff and also all the RaiseEvent lines. Note that this uses the free VB SQLite wrapper from Olaf Schmidt and if you don't use that then that is very much recommended. Let me know if you want that and I will explain. Also

Re: [sqlite] Index question

2013-04-28 Thread Simon Slavin
On 28 Apr 2013, at 3:51pm, Paolo Bolzoni wrote: > So I should write my BLOB in another (not-indexed) table, UPDATE the > indexed table copying from the other, > and finally delete the line in the first table? All in one transaction? That would work and would be a

Re: [sqlite] Index question

2013-04-28 Thread Paolo Bolzoni
So I should write my BLOB in another (not-indexed) table, UPDATE the indexed table copying from the other, and finally delete the line in the first table? All in one transaction? On Sun, Apr 28, 2013 at 4:23 PM, Simon Slavin wrote: > > On 28 Apr 2013, at 3:02pm, Paolo

Re: [sqlite] Index question

2013-04-28 Thread Simon Slavin
On 28 Apr 2013, at 3:02pm, Paolo Bolzoni wrote: > And it seems quite an improvement, alas now I get this error: "cannot > open indexed column for writing." You have a column of type BLOB. It is now an indexed column. You are trying to use the BLOB editing

Re: [sqlite] Index question

2013-04-28 Thread Paolo Bolzoni
Sorry, it seems gmail messed up the layout just before sending. On Sun, Apr 28, 2013 at 4:02 PM, Paolo Bolzoni wrote: > I was playing with indexes, I started checking one my queries with > EXPLAIN QUERY PLAN and > I got this result: > selectidorder from

[sqlite] Index question

2013-04-28 Thread Paolo Bolzoni
I was playing with indexes, I started checking one my queries with EXPLAIN QUERY PLAN and I got this result: selectidorder fromdetail -- -- -- - 0 0 1

Re: [sqlite] Writing in a blob

2013-04-28 Thread Eduardo
On Fri, 26 Apr 2013 14:02:02 -0400 Roland Hughes wrote: > It actually does make sense to add chunking to sqlite. There would be > some computational overhead, but, that all depends on the chunk size and > the cache size of the database. It makes no sense to

Re: [sqlite] Programming API vs console

2013-04-28 Thread Simon Slavin
On 28 Apr 2013, at 9:55am, Igor Korot wrote: > Apologies for noise. > That was an error on my side, which was discovered after spending couple of > hours debugging. No problem. Glad you figured it out. Simon. ___ sqlite-users

Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Teg
Hello Newbie89, Sunday, April 28, 2013, 3:32:07 AM, you wrote: N> Thanks for the correction N> ok...I will check first. N> -- N> View this message in context: N> http://sqlite.1065341.n5.nabble.com/How-to-save-live-data-into-sqlite-database-using-c-language-tp68519p68521.html N> Sent from

Re: [sqlite] Programming API vs console

2013-04-28 Thread Igor Korot
Apologies for noise. That was an error on my side, which was discovered after spending couple of hours debugging. Thank you all for the help and sorry once again. On Sat, Apr 27, 2013 at 5:20 AM, Simon Slavin wrote: > > On 27 Apr 2013, at 8:34am, Igor Korot

Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Newbie89
Thanks for the correction ok...I will check first. -- View this message in context: http://sqlite.1065341.n5.nabble.com/How-to-save-live-data-into-sqlite-database-using-c-language-tp68519p68521.html Sent from the SQLite mailing list archive at Nabble.com.

Re: [sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Igor Korot
Hi, On Sun, Apr 28, 2013 at 12:14 AM, Newbie89 wrote: > previously It used log file to save data. I need to identify the variables > which need to logged and save into database. So I need to create the table > from this file.c > struct HOST > { >char Src_MAC[18]; >

[sqlite] How to save live data into sqlite database using c language?

2013-04-28 Thread Newbie89
previously It used log file to save data. I need to identify the variables which need to logged and save into database. So I need to create the table from this file.c struct HOST { char Src_MAC[18]; char Src_IP[16]; long int Cap_Bytes; int TCP,UDP,ICMP,IP,ARP,OTH_Net,