Re: [sqlite] how to use sqlite in COCOA

2014-07-30 Thread Simon Slavin
On 30 Jul 2014, at 6:40am, YAN HONG YE yanhong...@mpsa.com wrote: Who can tell me how to use Sqlite in COCOA in my MAC system? Include the .h and .c files in your project. Make sure your project understands that the .c file is C code, not C++ code. Use the C/C++ API calls as shown here:

Re: [sqlite] Variable values in Views

2014-07-30 Thread Sylvain Pointeau
It is called parameterized view in sqlserver. Actually it is extremely useful in order to have a good reusability in the code. I was actually missing it in Oracle, although I found a workaround of using the pipelined functions. Unfortunately, it is missing in sqlite, as well as the merge

Re: [sqlite] Variable values in Views

2014-07-30 Thread Noel Frankinet
There a tcl binding to sqlite, maybe it could help you ? Noël On 30 July 2014 08:44, Sylvain Pointeau sylvain.point...@gmail.com wrote: It is called parameterized view in sqlserver. Actually it is extremely useful in order to have a good reusability in the code. I was actually missing it

Re: [sqlite] Variable values in Views

2014-07-30 Thread Jonathan Moules
Hi List, Thanks for the responses. I don't think TCL will work for me - I want to use less languages, not more. As to the structure - I am considering using ATTACH as a method, but haven't gotten to the point where I need to decide which of the three options (keys in tables, table sets, or

[sqlite] What average is avg()?

2014-07-30 Thread Jonathan Moules
Hi List, A question and possible suggestion. Which type of average does avg() calculate? The documentation doesn't say - https://www.sqlite.org/lang_aggfunc.html I guess it's the mean, but it could be median or mode, so worth asking. My suggestion would be to include an explicit statement in

Re: [sqlite] What average is avg()?

2014-07-30 Thread Clemens Ladisch
Jonathan Moules wrote: Which type of average does avg() calculate? I guess it's the mean, but it could be median or mode, so worth asking. The SQL standard says it's the mean. Regards, Clemens ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] What average is avg()?

2014-07-30 Thread RSmith
The convention, as far as I am aware, is Average always refers to the Mean Average unless explicitly stated otherwise. Modes and Medians are usually specific to certain arms of the calculati. Having said that, probably a good idea to add the note to the docs regardless. On 2014/07/30 09:38,

[sqlite] sqlite bug after CREATE UNIQUE INDEX

2014-07-30 Thread Pavel Pimenov
hi C:\!dc-db\db-sqlite-corrupt\db-uniq-bugsqlite3 --version 3.8.5 2014-06-04 14:06:34 b1ed4f2a34ba66c29b130f8d13e9092758019212 C:\!dc-db\db-sqlite-corrupt\db-uniq-bugsqlite3.exe FlylinkDC.sqlite 0test-uniq-3.sql CREATE TABLE fly_hash_block(tth_id integer PRIMARY KEY NOT NULL, tth number NOT

Re: [sqlite] Handling Timezones

2014-07-30 Thread Keith Medcalf
On Tuesday, 29 July, 2014 20:31 Will Fong w...@digitaldev.com said: On Wed, Jul 30, 2014 at 10:01 AM, Keith Medcalf kmedc...@dessus.com wrote: Store and retrieve everything in the database in Zulu time. Whether this means using timestrings, UNIX timestamps, JD or MJD floats is up to you. The

Re: [sqlite] What average is avg()?

2014-07-30 Thread Simon Slavin
On 30 Jul 2014, at 8:51am, Clemens Ladisch clem...@ladisch.de wrote: Jonathan Moules wrote: Which type of average does avg() calculate? I guess it's the mean, but it could be median or mode, so worth asking. The SQL standard says it's the mean. Might be worth noting that avg() treats

Re: [sqlite] Handling Timezones

2014-07-30 Thread Roger Binns
On 29/07/14 17:23, Will Fong wrote: Ah! I have not explained my issue properly :) I'm very sorry about that. I'm using SQLite as a backend to a small website and I have users in multiple timezones. When users login, their timezone is retrieved from the user table. Why do you even need to

Re: [sqlite] Handling Timezones

2014-07-30 Thread Nico Williams
On Wed, Jul 30, 2014 at 11:53 AM, Roger Binns rog...@rogerbinns.com wrote: Why do you even need to store their timezone? The only time it would matter is if you are showing one user what another users local time is. Users travel; they don't have a single timezone. What matters is: the TZ when

Re: [sqlite] Handling Timezones

2014-07-30 Thread Simon Slavin
On 30 Jul 2014, at 6:05pm, Nico Williams n...@cryptonector.com wrote: Ideally we'd all just use Zulu time all the time, but that won't fly. If this is web-facing, the problem is solved. JavaScript can be told to return 'now' expressed in UTC. The Date.now() method returns the number of

Re: [sqlite] Handling Timezones

2014-07-30 Thread Roger Binns
On 30/07/14 10:05, Nico Williams wrote: Users travel; they don't have a single timezone. What matters is: the TZ when a user posted / did something, so you can have a vague idea of when they might be sleeping / unavailable. I'm not sure if you are disagreeing or agreeing with me. A clearer

Re: [sqlite] Handling Timezones

2014-07-30 Thread Nico Williams
On Wed, Jul 30, 2014 at 12:34 PM, Roger Binns rog...@rogerbinns.com wrote: On 30/07/14 10:05, Nico Williams wrote: Users travel; they don't have a single timezone. What matters is: the TZ when a user posted / did something, so you can have a vague idea of when they might be sleeping /

Re: [sqlite] Handling Timezones

2014-07-30 Thread Roger Binns
On 30/07/14 10:51, Nico Williams wrote: I find that somewhat obnoxious. I often prefer absolute time It depends on the content being shown. We go for human friendly relative times (eg 13 hours ago) and then have a tooltip that gives the full timestamp. Doing maths on times and dates is

Re: [sqlite] sqlite bug after CREATE UNIQUE INDEX

2014-07-30 Thread James K. Lowden
On Wed, 30 Jul 2014 09:10:29 +0400 Pavel Pimenov pavel.pime...@gmail.com wrote: CREATE TABLE fly_hash_block(tth_id integer PRIMARY KEY NOT NULL, tth number NOT NULL); INSERT INTO fly_hash_block VALUES(1,1); INSERT INTO fly_hash_block VALUES(2,2); INSERT INTO fly_hash_block VALUES(3,2);

Re: [sqlite] Counting changes in a INSERT/REPLACE

2014-07-30 Thread James K. Lowden
On Tue, 29 Jul 2014 16:49:04 -0400 jose isaias cabrera cabr...@wrc.xerox.com wrote: BEGIN; INSERT OR REPLACE INTO A SELECT * FROM client.A WHERE id = 1 AND Date != '2014-06-22'; INSERT OR REPLACE INTO A SELECT * FROM client.A WHERE id = 2 AND Date != '2014-06-22';

Re: [sqlite] sqlite bug after CREATE UNIQUE INDEX

2014-07-30 Thread Keith Medcalf
I think the point is that attempting to create the unique index should fail (with an error) and the index not be created rather than creating a unique index with duplicates (or whatever it is doing) causing subsequent queries to return incorrect results. On Wed, 30 Jul 2014 09:10:29 +0400