Re: [sqlite] Correct use of sqlite3_vtab_nochange/sqlite3_value_nochange

2019-08-13 Thread Kevin Martin
> On 13 Aug 2019, at 14:08, Richard Hipp wrote: > > I think that is correct. > Great, thanks. > But it never occurred to me that somebody might do this on the PRIMARY > KEY. I don't see any reason why it wouldn't work, though. I have a c++ interface built on top of the virtual table api

Re: [sqlite] [EXTERNAL] Correct use of sqlite3_vtab_nochange/sqlite3_value_nochange

2019-08-13 Thread Kevin Martin
> On 12 Aug 2019, at 07:53, Hick Gunter wrote: > > You did not state your argc and argv[0] values, Apologies, it is a 2 column table. Full details are: - argc is 4 - argv[0] is the value of the primary key for the row I want to update. - argv[1] is SQLITE_NULL, but as described,

[sqlite] Correct use of sqlite3_vtab_nochange/sqlite3_value_nochange

2019-08-10 Thread Kevin Martin
Hi, I have a without rowid virtual table with an implementation of xColumn that begins with if(sqlite3_vtab_nochange(ctx)) return SQLITE_OK; If I try to perform an update on this table that doesn't involve a primary key change, then my understanding from the documentation is that xUpdate will

[sqlite] Optimising multiple group by clauses

2019-06-09 Thread Kevin Martin
Hi, I am trying to find the best way to write a query that has two levels of group by where the outer group by columns are a subset of the inner group by columns. In my example below I want to do an aggregation grouping by per, prod, and mar, then I want aggregate the results of this

Re: [sqlite] picking random subset of rows

2019-03-18 Thread Kevin Martin
> On 18 Mar 2019, at 16:15, Dan Kennedy wrote: > > > In SQLite, a correlated sub-query on the RHS of an IN(...) operator may be > rerun every time the IN(...) test is required. And if that sub-query contains > "random()" it might return a different result every time. > > Your words suggest

[sqlite] picking random subset of rows

2019-03-18 Thread Kevin Martin
Hi, I am trying to use a correlated subquery with an 'order by random() limit 2' to pick upto two random rows for each value in the outer query. I am not sure if I am doing this correctly, but the number of rows I am getting seems to vary randomly which doesn't make sense to me. If i replace

[sqlite] weekday time modifier

2018-09-23 Thread Kevin Martin
Hi, Not sure if this is me misreading it, but the description of the weekday modifier in the documentation seems a bit ambiguous. It says: > The "weekday" modifier advances the date forward to the next date where the > weekday number is N. Sunday is 0, Monday is 1, and so forth. It is not

[sqlite] Accessing sqlite3Apis pointer when loading sqlite3 dll/so.

2016-10-29 Thread Kevin Martin
Hi, I have a shared library that internally uses a statically linked sqlite for a few different internal tasks. Amongst these there is some code that provides a few virtual tables. I would like to extend the interface of the library so that as well as it’s normal interface, it can be accessed

Re: [sqlite] Application with 'grid' form for entering table data wanted

2014-06-03 Thread Kevin Martin
On 3 Jun 2014, at 15:07, c...@isbd.net wrote: > I'm looking for an application (or *simple* development framework) > which will provide me with an easily accessible grid form for entering > data into a table. I don't know anything about coding a web program, so all this advice related purely

Re: [sqlite] Like and percent character

2014-06-03 Thread Kevin Martin
Are you forming your query with sprintf? It may be worth printing the query you are preparing, to make sure it says what you think it is. Thanks, Kev Sent from my iPhone > On 3 Jun 2014, at 14:53, Micka wrote: > > Hi, > > I'm having trouble with the percent character

Re: [sqlite] calculation of a fraction stored in a text column

2014-02-20 Thread Kevin Martin
On 20 Feb 2014, at 12:54, Patrick Proniewski wrote: > My problem is that my database holds too many different values for > ExposureTime, so the resulting plot is unreadable. I want to be able to "bin" > those values to create a proper histogram. It's not possible to "bin"

Re: [sqlite] Proposed enhancement to the sqlite3.exe command-lineshell

2014-02-10 Thread Kevin Martin
On 10 Feb 2014, at 17:57, Richard Hipp wrote: > I think I know how to detect a double-click launch versus a command-line > launch on windows. But I don't know how to do this, or even if it is > possible to do, on Mac or Linux. Anybody have any ideas? For me, It's not so much

Re: [sqlite] struggling with a query

2014-02-08 Thread Kevin Martin
On 8 Feb 2014, at 10:03, Stephan Beal wrote: > i am trying like mad to, but can't seem formulate a query with 2 version > number inputs (1 and 2 in this case) and creates a result set with these > columns: > > - name. must include all names across both versions > -

Re: [sqlite] Send Mail from sqlite

2014-02-07 Thread Kevin Martin
On 7 Feb 2014, at 09:59, Vairamuthu wrote: > Thanks for your response, it will be great help if you can get me some > sample code or algorithms, on that. I'm assuming you're using SQLite embedded within another application on something unix like. Off the top of my

Re: [sqlite] Virtual Table xRowid

2014-02-05 Thread Kevin Martin
On 5 Feb 2014, at 18:40, Dan Kennedy wrote: > But is it the case that your virtual table doesn't handle > anything other than full scans of the entire table contents? If > so, it's probably not a problem if rowids are inconsistent. Thanks for the heads up on the 'or'

[sqlite] Virtual Table xRowid

2014-02-05 Thread Kevin Martin
Hi, My questions are basically: 1) What causes sqlite3 to call xRowid 2) If I don't want to update my virtual table, or do a select ROWID, can I just use an incremental counter, increased on every call to xNext (bearing in mind the order of my data is not guaranteed, so this won't necessarily

Re: [sqlite] SQL Logic error or missing database

2013-04-05 Thread Kevin Martin
On 5 Apr 2013, at 14:12, Rob Collie wrote: > I'm pretty much just including sqlite3.h, sqlite3ext.h, sqlite3.c in a C++ > project and compiling it as a static lib. I don't really know anything about Windows, but this looks a bit different to how I do it on Linux. I think you should only

Re: [sqlite] Joining tow tables with subset of columns from one

2013-03-13 Thread Kevin Martin
On 13 Mar 2013, at 17:44, Paul Sanderson wrote: > I want to join two table by doing a select in the form > > select col1, col2, col3 from table1 as t1, * from table2 as t2 where > t1.col1 = t2.x Are you trying to do: select t1.col1, t1.col2, t1.col3, t2.* from table1 as t1 join table2 as t2

Re: [sqlite] Current Time in WHEN clause.

2012-07-22 Thread Kevin Martin
For now I've decided to play safe and I've added a added an 'ok' column to tell me if I'm within 5s of an update. > CREATE VIEW near_update as select count(*) as n from aliases where > abs(strftime('%s', 'now') - validFrom) < 5; > CREATE VIEW alias_info as select a.name, s.url, s.type, nu.n ==

Re: [sqlite] Current Time in WHEN clause.

2012-07-22 Thread Kevin Martin
On 22 Jul 2012, at 18:35, Keith Medcalf wrote: Thanks for that. I can't say I understand much of that output at the moment. I'm just reading http://www.sqlite.org/eqp.html to try and figure it out. Is the behaviour it will only run once guaranteed by any standard, or likely to change in

Re: [sqlite] sql statement CREATE TABLE

2012-07-22 Thread Kevin Martin
On 22 Jul 2012, at 16:15, Arbol One wrote: > I am getting a run time error that reads > Library routine out of sequence http://sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence My guess is #1. What's the return value from the function you're calling to open the db? Thanks, Kevin

Re: [sqlite] Current Time in WHEN clause.

2012-07-22 Thread Kevin Martin
keep the alias_info view as it is because it's simple - I prefer DB logic to be in the DB, rather than the PHP script. I'm toying with the idea of creating a temporary table with the current time in and selecting from that in the latest_alias subquery, but would prefer better/cleaner options. T

Re: [sqlite] Current Time in WHEN clause.

2012-07-22 Thread Kevin Martin
On 22 Jul 2012, at 17:06, Keith Medcalf wrote: > (select name, max(validfrom) as mvf from aliases where validFrom <= (select > strftime('%s', 'now')) group by name) I don't think that solves the problem because each time the group by query is executed, your subquery will be executed again.

[sqlite] Current Time in WHEN clause.

2012-07-22 Thread Kevin Martin
solution to get the current time function out of the when clause. Thanks, Kevin Martin. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] database busy error

2012-07-02 Thread Kevin Martin
> If I have a pool of external (c++) progs, all writing into the same sqlit3 db, > how do i handle this correctly ? I think it depends on your applications. We use sqlite for IPC and data sharing within processes on the same machine. I'm not suggesting it for you, but the following works for

Re: [sqlite] Interpolation

2012-02-08 Thread Kevin Martin
For the quick and dirty solution, I think you can use something like this to create your view. You would need to index time, and even with the index, I'm not too sure about speed. select x1.time, x1.value, x2.time from x as x1 left join x as x2 on x2.time=(select max(time) from x where

Re: [sqlite] Strange behaviour with fork/close.

2011-08-14 Thread Kevin Martin
On 14 Aug 2011, at 12:18, Kevin Martin wrote: > I am however very confused If > anyone has the time to read this and give a hint as to what might be > going on, it would be greatly appreciated. Why do you always figure things out after you have posted them to the mailing list? Th

[sqlite] Strange behaviour with fork/close.

2011-08-14 Thread Kevin Martin
Hello, I have read the FAQ, and know that you can't fork with an open database connection. I'm not doing that. I am however very confused If anyone has the time to read this and give a hint as to what might be going on, it would be greatly appreciated. Thanks, Kevin Martin

Re: [sqlite] Need Help! -- SQlite database on server

2011-08-04 Thread Kevin Martin
erialization. However, if you take this approach it may be better to use something like Ice (http://zeroc.com/) if the license suits you. Kevin Martin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Exclusive locking mode not working as expected?

2011-07-29 Thread Kevin Martin
akes a database connection (which will take account of the locks), and copies everything relevant into another database. After the user has run this to create their copy, they can then do what they want with it. Kevin Martin ___ sqlite-users mailing lis

Re: [sqlite] Hidding records from the application

2011-07-17 Thread Kevin Martin
> actually I don't know how to get my rules yet, but let's assume the > rules > exist and we can get it from a function. > get_forbidden_ids() I've never done it, so don't know whether it's possible, but you may be able to create a virtual table on top of the real table which calls

Re: [sqlite] Write locking - subquery

2011-07-16 Thread Kevin Martin
On 16 Jul 2011, at 21:30, Kevin Martin wrote: > insert into x values ('abc', -1); > update x set pos = 1+max(0,(select max(pos) from x)); Oops, deliberate mistake there. As I'm sure you all realise that should be update x set pos = 1+max(0,(select max(pos) from x)) where name='abc';

[sqlite] Write locking - subquery

2011-07-16 Thread Kevin Martin
for the subquery to return -1 in both processes. Thanks, Kevin Martin. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users