Re: [sqlite] C API: which calls have the biggest chance of latency?

2017-05-26 Thread Jens Alfke
> On May 25, 2017, at 10:00 PM, Wout Mertens wrote: > > I would like to make it partially asynchronous, still doing most of the > work on the main thread, but waiting in a helper thread. I was thinking > that the longest delays will be from disk access, so sqlite_step(). SQLite has a cache, so

Re: [sqlite] C API: which calls have the biggest chance of latency?

2017-05-26 Thread Richard Hipp
On 5/26/17, Wout Mertens wrote: > > Are the above assumptions correct? Any other calls (besides opening the db) > that can take a long time? Most of the work associated with opening the database connection (which is to say, parsing the schema) is deferred until the first time you call sqlite3_pre

Re: [sqlite] C API: which calls have the biggest chance of latency?

2017-05-26 Thread R Smith
On 2017/05/26 7:33 AM, Simon Slavin wrote: On 26 May 2017, at 6:00am, Wout Mertens wrote: Ideally there'd be some way to know if a _step() call will be served from buffer… There are (simplified) three possibilities: quick quick, slow slow, and slow quick. A) SQLite finds a good index for t

Re: [sqlite] C API: which calls have the biggest chance of latency?

2017-05-26 Thread Wout Mertens
On Fri, May 26, 2017 at 7:33 AM Simon Slavin wrote: > > On 26 May 2017, at 6:00am, Wout Mertens wrote: > > > Ideally there'd be some way to know if a _step() call will be served from > > buffer… > > There are (simplified) three possibilities: quick quick, slow slow, and > slow quick. > [...] Aha

Re: [sqlite] C API: which calls have the biggest chance of latency?

2017-05-25 Thread Simon Slavin
On 26 May 2017, at 6:00am, Wout Mertens wrote: > Ideally there'd be some way to know if a _step() call will be served from > buffer… There are (simplified) three possibilities: quick quick, slow slow, and slow quick. A) SQLite finds a good index for the search/sort and can easily locate all t

[sqlite] C API: which calls have the biggest chance of latency?

2017-05-25 Thread Wout Mertens
I am liking the simplicity of the better-sqlite3 Nodejs library, but it is synchronous (for some good reasons), so it will hang the main thread until sqlite is done. I would like to make it partially asynchronous, still doing most of the work on the main thread, but waiting in a helper thread. I w

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-18 Thread James K. Lowden
On Tue, 9 Aug 2016 17:09:39 -0300 Paulo Roberto wrote: > I would like something like this: > > "BEGIN EXCLUSIVE TRANSACTION;" > "SELECT counter FROM mytable WHERE counterid = ?;" > "UPDATE mytable SET counter=? WHERE counterid = ?;" > "COMMIT TRANSACTION;" begin transaction;

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-11 Thread Dominique Devienne
On Thu, Aug 11, 2016 at 4:34 AM, Paulo Roberto wrote: > Thank you very much, it worked! Just remember that exposing a SQL function that de-references a "user"-supplied integer value as a pointer is inherently unsafe. Anyone can select remember(val, 0) or select remember(val, 101) and crash (at

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-10 Thread Paulo Roberto
Thank you very much, it worked! On Tue, Aug 9, 2016 at 11:49 PM, Richard Hipp wrote: > On 8/9/16, Paulo Roberto wrote: > > > > I found your solution pretty elegant and I tried to implement it. > > But after solving a lot of building issues with the sqlite3ext header > > It does not have to be i

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Richard Hipp
On 8/9/16, Paulo Roberto wrote: > > I found your solution pretty elegant and I tried to implement it. > But after solving a lot of building issues with the sqlite3ext header It does not have to be implemented as a loadable extension. Just copy the lines https://www.sqlite.org/src/artifact/8440f8

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Paulo Roberto
Thank you for all the answers. Clemens, The counterid in my case is a text field and not an integer. That's why I need to sanitize. Clemens and Keith, As each of my process has its own connection to the database, I tried your solution using BEGIN IMMEDIATE and it worked successfully. Thank you.

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Keith Medcalf
> "BEGIN EXCLUSIVE TRANSACTION;" > "SELECT counter FROM mytable WHERE counterid = ?;" > "UPDATE mytable SET counter=? WHERE counterid = ?;" > "COMMIT TRANSACTION;" > I have a counter that I need to increment and get its previous value in one > operation. > To access this counter I must pass a

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Richard Hipp
On 8/9/16, Richard Hipp wrote: > Or, you could make remember() a two argument function: > >UPDATE mytable SET counter=remember(counter, $ptr)+1 WHERE counterid=$id > A sample implementation for this function can now been seen at https://www.sqlite.org/src/artifact/8440f8d0b452c5cd -- D. Ric

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Richard Hipp
On 8/9/16, Richard Hipp wrote: > > UPDATE mytable SET counter=remember(counter)+1 WHERE counterid=? > Or, you could make remember() a two argument function: UPDATE mytable SET counter=remember(counter, $ptr)+1 WHERE counterid=$id Then bind $ptr to the address of the variable in which you wan

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Richard Hipp
On 8/9/16, Paulo Roberto wrote: > > I need some help to ... increment a counter and get its > former value. > My question is: Preparing 4 statements, binding then and calling > *sqlite3_step > *for each one of then in order, would have the expected atomic operation > behavior or not? If not, how

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Simon Slavin
On 9 Aug 2016, at 9:09pm, Paulo Roberto wrote: > My question is: Preparing 4 statements, binding then and calling *sqlite3_step > *for each one of then in order, would have the expected atomic operation > behavior or not? You might be happier with BEGIN IMMEDIATE. No other connections can make

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Clemens Ladisch
Paulo Roberto wrote: > I need some help to do a simple operation, increment a counter and get its > former value. > I could have some race condition, so the transaction must be atomic. > > I also would like to use prepared statements to accomplish that, so I have > less effort sanitizing inputs. I

[sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Paulo Roberto
Hello, I need some help to do a simple operation, increment a counter and get its former value. I could have some race condition, so the transaction must be atomic. I also would like to use prepared statements to accomplish that, so I have less effort sanitizing inputs. My problem: I have a cou

[sqlite] C API reference manpages

2016-04-19 Thread Kristaps Dzonsons
> On Thu, 31 Mar 2016 10:21:53 -0400 > Richard Hipp wrote: > >> On 3/31/16, Kristaps Dzonsons wrote: >>> >>> Is there any interest in integrating this tool to have manpages in >>> the doc distribution without downstream bits? >>> >> >> I think that would be cool. Integrating your tool into the

[sqlite] C API reference manpages

2016-04-04 Thread Kristaps Dzonsons
> How about the CC0 license? I think it's designed for these sorts of > things (you want to make something public domain even if you're not > allowed to) - https://creativecommons.org/about/cc0/ Jonathon, I think the problem is that LV is similar to Norway[1] in this regard, so something like CC0

[sqlite] C API reference manpages

2016-04-04 Thread Jonathan Moules
How about the CC0 license? I think it's designed for these sorts of things (you want to make something public domain even if you're not allowed to) - https://creativecommons.org/about/cc0/ On Fri, 01 Apr 2016 00:05:30 +0100 Kristaps Dzonsons wrote >> As for publ

[sqlite] C API reference manpages

2016-04-03 Thread James K. Lowden
On Thu, 31 Mar 2016 10:21:53 -0400 Richard Hipp wrote: > On 3/31/16, Kristaps Dzonsons wrote: > > > > Is there any interest in integrating this tool to have manpages in > > the doc distribution without downstream bits? > > > > I think that would be cool. Integrating your tool into the source >

[sqlite] C API reference manpages

2016-04-01 Thread Kristaps Dzonsons
>> As for public domain, I'm happy to put the sources under a similar >> license. I can't speak for the voodoo of the public domain and the EU >> (or is it country-by-country?), however. > > From an English translation I found of the Latvian law includes moral > rights and is closer to the droit

[sqlite] C API reference manpages

2016-03-31 Thread Matthias-Christian Ott
On 31/03/16 14:39, Kristaps Dzonsons wrote: >>> Is there any interest in integrating this tool to have manpages in the >>> doc distribution without downstream bits? >> >> I think that would be cool. Integrating your tool into the source >> tree would mean that as the comment formats evolve, your t

[sqlite] C API reference manpages

2016-03-31 Thread Kristaps Dzonsons
>> Is there any interest in integrating this tool to have manpages in the >> doc distribution without downstream bits? > > I think that would be cool. Integrating your tool into the source > tree would mean that as the comment formats evolve, your tool would > evolve in lock-step. If your tool i

[sqlite] C API reference manpages

2016-03-31 Thread Kristaps Dzonsons
Hello, I couldn't find any way to convert the SQLite docs (via sqlite.h) to UNIX manpages, so I wrote a tool that does so: https://github.com/kristapsdz/sqlite2mdoc This generates one manpage per API reference with the proper SEE ALSO (from collected references) and IMPLEMENTATION NOTES (the ra

[sqlite] C API reference manpages

2016-03-31 Thread Richard Hipp
On 3/31/16, Kristaps Dzonsons wrote: > > Is there any interest in integrating this tool to have manpages in the > doc distribution without downstream bits? > I think that would be cool. Integrating your tool into the source tree would mean that as the comment formats evolve, your tool would evol

[sqlite] what is typical pattern for test double of sqlite c api

2015-08-11 Thread Adam Devita
Good day, I'm about to implement TDD for an existing c project that uses sqlite, using CPPUnit. Sqlite would be a dependency from the point of view of the routines making calls to it. Is is typical to just write a link time stub to substitute commonly used parts of the interface (exec, open, pre

Re: [sqlite] Need a sqlite c api that wrires data into a table.

2012-01-13 Thread Steve and Amy
If I understand your question, the answer is NO. There is NO function like sqlite3_insert_data_into_table(TableName, Data, FieldName). The SQL engine responsible for reading and writing data from and to tables only responds to SQL queries passed to it via functions like sqlite3_exec(). For m

[sqlite] Need a sqlite c api that wrires data into a table.

2012-01-12 Thread bhaskarReddy
es to that function, the particular function will enter the record of values into that table. Is there any C API like that in SQlite. Regards, Bhaskar -- View this message in context: http://old.nabble.com/Need-a-sqlite-c-api-that-wrires-data-into-a-table.-tp33132538p33132538.html Sent from

Re: [sqlite] C API docs

2011-10-24 Thread Simon Slavin
On 25 Oct 2011, at 2:40am, Richard Hipp wrote: > On Mon, Oct 24, 2011 at 9:05 AM, Baruch Burstein wrote: > >> How are the C API documents auto-generated? Which tool is used? >> I see that they are all in the comments in the code, but couldn't find a >> tool in the source that is used to extract

Re: [sqlite] C API docs

2011-10-24 Thread Richard Hipp
On Mon, Oct 24, 2011 at 9:05 AM, Baruch Burstein wrote: > How are the C API documents auto-generated? Which tool is used? > I see that they are all in the comments in the code, but couldn't find a > tool in the source that is used to extract them and make the links. > The SQLite website, includin

Re: [sqlite] C API docs

2011-10-24 Thread Alek Paunov
I do not know the answer, but I am thinking for an attempt to extract them as clang+lpeg exercise. Why you are asking ... ? On 24.10.2011 16:05, Baruch Burstein wrote: How are the C API documents auto-generated? Which tool is used? I see that they are all in the comments in the code, but couldn

Re: [sqlite] C API docs

2011-10-24 Thread Eugene N
hi Perhaps it widely popular doxygen, although its just a guess Eugene 2011/10/24 Baruch Burstein > How are the C API documents auto-generated? Which tool is used? > I see that they are all in the comments in the code, but couldn't find a > tool in the source that is used to extract them and ma

[sqlite] C API docs

2011-10-24 Thread Baruch Burstein
How are the C API documents auto-generated? Which tool is used? I see that they are all in the comments in the code, but couldn't find a tool in the source that is used to extract them and make the links. -- Programming today is a race between software engineers striving to build bigger and bette

Re: [sqlite] c-api document suggestion

2011-09-23 Thread Tim Streater
On 23 Sep 2011 at 11:18, Mirek Suk wrote: > Dne 23.9.2011 4:41, Igor Tandetnik napsal(a): >> Note that I didn't say it was wise to store NUL characters as part of the >> string - I only said that you could do it if you wanted to. sqlite3_bind_text >> takes the length parameter at face value, an

Re: [sqlite] c-api document suggestion

2011-09-23 Thread Igor Tandetnik
Mirek Suk wrote: > I just find entire nul handling in SQLite strange. it's C API why not > expect C (that is nul terminated) strings. Because some people do want to store strings with embedded NULs, for various reasons. If you don't, just pass -1 for length and be done with it. > man says > "St

Re: [sqlite] c-api document suggestion

2011-09-23 Thread Simon Slavin
On 23 Sep 2011, at 11:18am, Mirek Suk wrote: > I just find entire nul handling in SQLite strange. it's C API why not expect > C (that is nul terminated) strings. That's more or less the problem: C expects 0x00 termination. But SQLite3 is written to support UTF-8 and UTF-16 strings of specifie

Re: [sqlite] c-api document suggestion

2011-09-23 Thread Mirek Suk
Dne 23.9.2011 4:41, Igor Tandetnik napsal(a): Mira Suk wrote: On 9/21/2011 21:22 Igor Tandetnik wrote: You can include the NUL terminator, if you want it to actually be stored in the database. Actually you can't - if you do all SQL string functions will not work. to be clear - SELECT TRIM(wh

Re: [sqlite] c-api document suggestion

2011-09-22 Thread Igor Tandetnik
Mira Suk wrote: > On 9/21/2011 21:22 Igor Tandetnik wrote: > >> You can include the NUL terminator, if you want it to actually be stored >> in the database. > > Actually you can't - if you do all SQL string functions will not work. > to be clear - > SELECT TRIM(what ever text column you stored w

Re: [sqlite] c-api document suggestion

2011-09-22 Thread Mira Suk
On 9/21/2011 21:22 Igor Tandetnik wrote: You can include the NUL terminator, if you want it to actually be stored in the database. Igor Tandetnik Actually you can't - if you do all SQL string functions will not work. to be clear - SELECT TRIM(what ever text column you stored with including

Re: [sqlite] c-api document suggestion

2011-09-21 Thread Sean Pieper
the clarification :-). -sean -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp Sent: Wednesday, September 21, 2011 12:23 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] c-api document suggestion On Wed,

Re: [sqlite] c-api document suggestion

2011-09-21 Thread Richard Hipp
On Wed, Sep 21, 2011 at 3:05 PM, Sean Pieper wrote: > There's an apparent inconsistency in the behavior of sqlite3_bind_text and > sqlite3_prepare_v2. > If the user supplies the length of the argument rather than using -1, > bind_text expects that this length exclude the null termination, wherea

Re: [sqlite] c-api document suggestion

2011-09-21 Thread Pavel Ivanov
> If the user supplies the length of the argument rather than using -1, > bind_text expects that this length exclude the null termination, whereas > prepare apparently expects it to include the null termination. Can I challenge you in that this conclusion is wrong? Everywhere in the development w

Re: [sqlite] c-api document suggestion

2011-09-21 Thread Igor Tandetnik
On 9/21/2011 3:05 PM, Sean Pieper wrote: There's an apparent inconsistency in the behavior of sqlite3_bind_text and sqlite3_prepare_v2. If the user supplies the length of the argument rather than using -1, bind_text expects that this length exclude the null termination, You can include the NU

[sqlite] c-api document suggestion

2011-09-21 Thread Sean Pieper
There's an apparent inconsistency in the behavior of sqlite3_bind_text and sqlite3_prepare_v2. If the user supplies the length of the argument rather than using -1, bind_text expects that this length exclude the null termination, whereas prepare apparently expects it to include the null termina

Re: [sqlite] c-api

2011-07-27 Thread John Deal
Hello Baruch, You may want to look at sqlite3_exec() (http://www.sqlite.org/c3ref/exec.html). John --- On Wed, 7/27/11, Baruch Burstein wrote: > From: Baruch Burstein > Subject: [sqlite] c-api > To: "General Discussion of SQLite Database" > Date: Wednesday, July 27, 20

Re: [sqlite] c-api

2011-07-27 Thread Doug Currie
On Jul 27, 2011, at 9:22 AM, Baruch Burstein wrote: > Is there an easier way to get a single value (for instance "select > last_insert_rowid();" ) then prepare -> step -> column -> finalize? http://www.sqlite.org/capi3ref.html#sqlite3_last_insert_rowid e __

Re: [sqlite] c-api

2011-07-27 Thread Igor Tandetnik
Baruch Burstein wrote: > Is there an easier way to get a single value (for instance "select > last_insert_rowid();" ) then prepare -> step -> column -> finalize? For this specific example, there's sqlite3_last_insert_rowid API function. In general, no, there's no special way to handle SELECT sta

[sqlite] c-api

2011-07-27 Thread Baruch Burstein
Is there an easier way to get a single value (for instance "select last_insert_rowid();" ) then prepare -> step -> column -> finalize? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] [C-API] Query returns only 0

2010-09-30 Thread Martin.Engelschalk
Hello Gerald, i think you should tell us more about what you are trying to do and add some C code. what do you mead by "return value"? What functions do you call? Do you know that you have to get the selected value by calling a function like sqlite3_column_text ? Martin Am 30.09.2010 11:41,

[sqlite] [C-API] Query returns only 0

2010-09-30 Thread Legen Där
Hello Gyus, ive got problems with my qeuries. After loading a table, i create a statement for every column to prepare the querys. A sample for such a prepared query is.. SELECT "F_SIZE_M0200_m0_VALUE" FROM fileInfos WHERE FILEINFO_FULLNAME = ?1 ...for that query i bind TEXT values li

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
Will do. Thanks again to everyone. At least I learned how to use strace, which I didnt no. On Wed, Mar 24, 2010 at 2:25 PM, Pavel Ivanov wrote: > > When allocating memory for my ICMP packets I wasnt doind a bzero to fill > all > > fields with 0, so some "garbage" generated by Sqlite use of memor

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread David Baird
On Wed, Mar 24, 2010 at 11:19 AM, Martin Sigwald wrote: > Problem Solved: As some one point out, it was MY fault. > When allocating memory for my ICMP packets I wasnt doind a bzero to fill all > fields with 0, so some "garbage" generated by Sqlite use of memory was > "corrupting" my packets. > Tha

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Pavel Ivanov
> When allocating memory for my ICMP packets I wasnt doind a bzero to fill all > fields with 0, so some "garbage" generated by Sqlite use of memory was > "corrupting" my packets. And still try please my very first suggestion - run you program with valgrind (just to get used to it and to use it rig

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
Problem Solved: As some one point out, it was MY fault. When allocating memory for my ICMP packets I wasnt doind a bzero to fill all fields with 0, so some "garbage" generated by Sqlite use of memory was "corrupting" my packets. Thank you all for the help. One of the best user groups I ever met. Te

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread David Baird
On Wed, Mar 24, 2010 at 11:09 AM, Martin Sigwald wrote: > Doing N pings after a _close or a query has the same result as doind one: > not one of them works. Do 2 pings work ever? For example, how about each of these scenarios? open_db ping ping close_db or ping ping or open_db close_db ping

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
Doing N pings after a _close or a query has the same result as doind one: not one of them works. On Wed, Mar 24, 2010 at 2:07 PM, David Baird wrote: > On Wed, Mar 24, 2010 at 9:42 AM, Martin Sigwald > wrote: > > I meant socket. I know sockets are FDs. My mistake, sorry. > > Yes, I tried putting

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread David Baird
On Wed, Mar 24, 2010 at 9:42 AM, Martin Sigwald wrote: > I meant socket. I know sockets are FDs. My mistake, sorry. > Yes, I tried putting the call before Sqlite calls and it works perfectly. If > I put it between open and close it works, provided I dont do anything else. > For example, if I open

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
I'm attaching the strace output for the following code you asked: int main(void){ sqlite3* db_handle=NULL; if(sqlite3_open("guido.db",&db_handle)) { //abro DB fprintf(stderr,"Error while open DB:%s\n",sqlite3_errmsg(db_handle)); printf("No pude abrir la DB\n

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread paivanof
> I don't notice any cases of where a stale file descriptor is being > accessed.  I'm stumped :-/ Can it be a problem with clone() calls? AFAIK, it's how SQLite checks if it can work safely from multiple threads. Martin, can you recompile SQLite with SQLITE_THREADSAFE set to 0 and look if your pin

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread David Baird
On Wed, Mar 24, 2010 at 9:24 AM, David Baird wrote: > On Wed, Mar 24, 2010 at 9:05 AM, Martin Sigwald wrote: >> While I could gather, both the open system called generated by the DB and >> the socket() syscall are returning a FD=3. >> That is, they are both trying to use the same filedescriptor.

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
I meant socket. I know sockets are FDs. My mistake, sorry. Yes, I tried putting the call before Sqlite calls and it works perfectly. If I put it between open and close it works, provided I dont do anything else. For example, if I open the DB, ping, then run a query then ping again, the second ping

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread David Baird
On Wed, Mar 24, 2010 at 9:05 AM, Martin Sigwald wrote: > While I could gather, both the open system called generated by the DB and > the socket() syscall are returning a FD=3. > That is, they are both trying to use the same filedescriptor. My guess is > packets get sent to that file descriptor, in

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Jay A. Kreibich
On Wed, Mar 24, 2010 at 12:05:58PM -0300, Martin Sigwald scratched on the wall: > While I could gather, both the open system called generated by the DB and > the socket() syscall are returning a FD=3. > That is, they are both trying to use the same filedescriptor. My guess is > packets get sent to

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
While I could gather, both the open system called generated by the DB and the socket() syscall are returning a FD=3. That is, they are both trying to use the same filedescriptor. My guess is packets get sent to that file descriptor, instead of the port. How can I changed this? I just followed stand

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Martin Sigwald
I tried using STRACE, unfortunately, I am quite new to Linux programming, so I can't make much sense out of the output. I attached it to this email, in case some kind soul would like to take a look at it. The program ran is exactly this: #include #include #include #include "ping.h" int main(vo

Re: [sqlite] SQlite C API screwing port access?

2010-03-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin Sigwald wrote: > Here is the actual code: > > int main(void) > { > sqlite3* db_handle; > > sqlite3_open(DB_NAME,&db_handle); > sqlite3_close(db_handle); > my_ping("10.0.0.4"); > > return 0; > } > > If I call close af

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Simon Slavin
On 23 Mar 2010, at 7:29pm, Martin Sigwald wrote: > DB_NAME equals "servers.db". > Both close and open return 0, my code catches a possible error, I didnt > included for legibility. > I tired using ":memory:", same result: cant ping. > These is quite frustrating. Hmm. Thanks for trying. If both

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Martin Sigwald
DB_NAME equals "servers.db". Both close and open return 0, my code catches a possible error, I didnt included for legibility. I tired using ":memory:", same result: cant ping. These is quite frustrating. On Tue, Mar 23, 2010 at 4:23 PM, Simon Slavin wrote: > > On 23 Mar 2010, at 7:06pm, Martin S

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Simon Slavin
On 23 Mar 2010, at 7:06pm, Martin Sigwald wrote: > Here is the actual code: > > int main(void) > { >sqlite3* db_handle; > > sqlite3_open(DB_NAME,&db_handle); > sqlite3_close(db_handle); > my_ping("10.0.0.4"); > > return 0; > } > > If I call close after ping, it works. How

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Martin Sigwald
Here is the actual code: int main(void) { sqlite3* db_handle; sqlite3_open(DB_NAME,&db_handle); sqlite3_close(db_handle); my_ping("10.0.0.4"); return 0; } If I call close after ping, it works. However, if besides of opening the DB I perform any query, ping doesnt work e

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Matthew L. Creech
On Tue, Mar 23, 2010 at 12:55 PM, Martin Sigwald wrote: > I have a program which builds an ICMP package over IP and sends it. Before > that, I get IP number and other information from a SQlite DB. I was having > problems, so I began to comment different parts of the code, until I got to > this cod

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Pavel Ivanov
> Pavel: Yes, I allocate memory inside the ping function, but that is done > after calling de sqlite functions. There are no pointers shared between the > sqlite functions and the ping part. Actually I meant pointers shared between ping part and the part before calls to sqlite functions. Did you t

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Martin Sigwald
I already tried that, and the first ping works while the second one doesn't, which validates my "screwing ports theory". Simon: Tried changing the DB_NAME and it didnt work either. Pavlov: Yes, I allocate memory inside the ping function, but that is done after calling de sqlite functions. There a

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Teg
Hello Martin, Do the ping both before and after you open the DB. ping_server("10.0.0.4"); //my ping function, which pings a "hardcoded" IP, sqlite3_open(DB_NAME); sqlite3_close(DB_NAME); ping_server("10.0.0.4"); //my ping function, which pings a "hardcoded" IP, See if the first one works. That'l

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Simon Slavin
On 23 Mar 2010, at 4:55pm, Martin Sigwald wrote: > sqlite3_open(DB_NAME); > sqlite3_close(DB_NAME); > > ping_server("10.0.0.4"); //my ping function, which pings a "hardcoded" IP, > doesnt interact with DB > > > If I run that code, the package nevers gets send (can't detect it with > Wireshark)

Re: [sqlite] SQlite C API screwing port access?

2010-03-23 Thread Pavel Ivanov
Does your pinging code involves some pointers to memory (strings or any other stuff) that could be already released before SQLite code is called? Try to run your program under valgrind and see whether it gives any errors. Pavel On Tue, Mar 23, 2010 at 12:55 PM, Martin Sigwald wrote: > I have a p

[sqlite] SQlite C API screwing port access?

2010-03-23 Thread Martin Sigwald
I have a program which builds an ICMP package over IP and sends it. Before that, I get IP number and other information from a SQlite DB. I was having problems, so I began to comment different parts of the code, until I got to this code (pseudocode): sqlite3_open(DB_NAME); sqlite3_close(DB_NAME);

Re: [sqlite] C++ API

2010-02-27 Thread Jay A. Kreibich
On Sat, Feb 27, 2010 at 09:55:07AM +0100, eternelmangekyosharingan scratched on the wall: > Let's assume you need to insert a small number of rows in a given table > using the C++ API. > Is it recommended to use the one-step query execution interface function > sqlite3_exec over the pre-compiled

[sqlite] C++ API

2010-02-27 Thread eternelmangekyosharingan
Hi, Let's assume you need to insert a small number of rows in a given table using the C++ API. Is it recommended to use the one-step query execution interface function sqlite3_exec over the pre-compiled statement interface functions sqlite3_prepare_v2, sqlite3_bind_int, ..., sqlite3_step ? Is the

Re: [sqlite] [C] API: INSERT OR REPLACE

2009-03-27 Thread Igor Tandetnik
""Severin Müller"" wrote in message news:20090327084050.24...@gmx.net > I wam writing a program where i need some data. > > I try to dynamically create a database for this. All my data are > stored in a struct, resp. several structs. What I need now, is to > know, whether it's possible to check ev

Re: [sqlite] [C] API: INSERT OR REPLACE

2009-03-27 Thread mrobi002
Hi Severin, I found very useful the actual code samples at this location: http://www.apress.com/book/downloadfile/2847 The samples for C are under the subdirectory CAPI, there is no subdirectory called C Also you will find additional information at http://www.sqlite.org/c_interface.html Good

[sqlite] [C] API: INSERT OR REPLACE

2009-03-27 Thread Severin Müller
Hello I wam writing a program where i need some data. I try to dynamically create a database for this. All my data are stored in a struct, resp. several structs. What I need now, is to know, whether it's possible to check every row I'm submitting for existance, like: row1: data1 data2 data3 d

[sqlite] Performance - SQLite ODBC against SQLite C API on SLES10

2008-10-09 Thread Darko Filipovic
Hello, I'm doing some performance tests comparing SQLite ODBC and SQLite C API (both 3.5.2 version) on SLES10 (64bit). I'm inserting 1000 rows into 4 columns table (int, int64, double, int64) out of transaction and I'm getting much lower performance using SQLite API (about 10

Re: [sqlite] C++ api - callbacks problem

2008-03-03 Thread Dennis Cote
Toby Roworth wrote: > > Looking at the API reference. it would apear you can send an extra > "custom" argument to the callback fro sqlite3_exec, using the 4th > parameter - how does this work, It works well. :-) > and inperticular, could I pass an object > through to the call back, Yes. >

Re: [sqlite] C++ API callback problem

2008-03-01 Thread Toby Roworth
Thanks Igor and Teg, I think I know were I was going wrong now. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] C++ API callback problem

2008-03-01 Thread Igor Tandetnik
"Toby Roworth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Looking at the API reference. it would apear you can send an extra > "custom" argument to the callback fro sqlite3_exec, using the 4th > parameter - how does this work, and inperticular, could I pass an > object through to

Re: [sqlite] C++ API callback problem

2008-03-01 Thread Teg
Hello Toby, You can pass in anything you want, a pointer, a number. As long as it fits in the native size of the parameter. You can pass the ADDRESS of an object as long as it doesn't go out of scope between the call and when the processing finishes. I tend to pass the "this" pointer to the class

[sqlite] C++ API callback problem

2008-03-01 Thread Toby Roworth
Hello all Looking at the API reference. it would apear you can send an extra "custom" argument to the callback fro sqlite3_exec, using the 4th parameter - how does this work, and inperticular, could I pass an object through to the call back, and if so, how? Thanks Toby

[sqlite] C++ api - callbacks problem

2008-03-01 Thread Toby Roworth
Hello all Looking at the API reference. it would apear you can send an extra "custom" argument to the callback fro sqlite3_exec, using the 4th parameter - how does this work, and inperticular, could I pass an object through to the call back, and if so, how? Thanks Toby _

[sqlite] C++ api - callbacks problem

2008-03-01 Thread Toby Roworth
Hello all Looking at the API reference. it would apear you can send an extra "custom" argument to the callback fro sqlite3_exec, using the 4th parameter - how does this work, and inperticular, could I pass an object through to the call back, and if so, how? Thanks Toby __

[sqlite] C++ api - callbacks problem

2008-03-01 Thread Toby Roworth
Hello all Looking at the API reference. it would apear you can send an extra "custom" argument to the callback fro sqlite3_exec, using the 4th parameter - how does this work, and inperticular, could I pass an object through to the call back, and if so, how? Thanks Toby

Re: [sqlite] C API: Manifest type SQLITE_INTEGER: Is it 32- or 64-bit?

2008-01-03 Thread Dan
On Jan 4, 2008, at 7:57 AM, Jerry Krinock wrote: I need to read an sqlite database generated by others. So I wrote an outer loop which steps through the rows of a table using sqlite3_step, and an inner loop which steps through the columns. The inner loop finds the type using sqlite3_colu

Re: [sqlite] C API: Manifest type SQLITE_INTEGER: Is it 32- or 64-bit?

2008-01-03 Thread Jerry Krinock
On 2008 Jan, 03, at 17:21, Kees Nuyt wrote: If I understand the info at http://www.sqlite.org/c3ref/c_blob.html well, the INTEGER is always a 64-bit signed integer. Internally, integers are compressed, so they don't occupy eight bytes all the time. sqlite3_column_int64(); will always re

Re: [sqlite] C API: Manifest type SQLITE_INTEGER: Is it 32- or 64-bit?

2008-01-03 Thread Kees Nuyt
On Thu, 3 Jan 2008 16:57:12 -0800, Jerry Krinock <[EMAIL PROTECTED]> wrote: >I need to read an sqlite database generated by others. So I wrote an >outer loop which steps through the rows of a table using sqlite3_step, >and an inner loop which steps through the columns. The inner loop >find

Re: [sqlite] C API: Manifest type SQLITE_INTEGER: Is it 32- or 64-bit?

2008-01-03 Thread John Stanton
An integer is always 64 bits. Jerry Krinock wrote: I need to read an sqlite database generated by others. So I wrote an outer loop which steps through the rows of a table using sqlite3_step, and an inner loop which steps through the columns. The inner loop finds the type using sqlite3_column

[sqlite] C API: Manifest type SQLITE_INTEGER: Is it 32- or 64-bit?

2008-01-03 Thread Jerry Krinock
I need to read an sqlite database generated by others. So I wrote an outer loop which steps through the rows of a table using sqlite3_step, and an inner loop which steps through the columns. The inner loop finds the type using sqlite3_column_type(), then 'switches' to get the value using

Re: [sqlite] C API trouble

2007-09-30 Thread Andrew Sledge
Hi Mike, That did the trick. I am new to C, but I have used SQLite in Perl and Python. Thanks!* List: sqlite-users <http://marc.info/?l=sqlite-users&r=1&w=2> Subject: Re: [sqlite] C API trouble From: "Mike Polyakov" <http://marc.info/?a=11

Re: [sqlite] C API trouble

2007-09-30 Thread Mike Polyakov
Besides the unneded function calls, and a lot of checks for valid data, the problem here is that you have to copy data using memcpy or somthing similar: instead of chCommand = (const char*)sqlite3_column_text(ptrSel,2); do memcpy(chCommand, sqlite3_column_text(ptrSel,2), sqlite3_column_bytes(ptr

  1   2   >