[sqlite] Best way to handle time slicing of SQL data.

2015-06-02 Thread Simon Slavin
On 2 Jun 2015, at 12:34pm, Richard Warburton wrote: > I'm wanting to store data in a way such that I can choose a time in the > past and view records as they were at that dateTime. Therefore (in my > mind), all updates are really inserts with a timestamp. Ids are suddenly > no longer primary

[sqlite] sqlite3 compound index usage for LIKE and GROUP BY

2015-06-02 Thread Simon Slavin
On 1 Jun 2015, at 7:37pm, Amol Kandurwar wrote: > SELECT foo, boo FROM mytable WHERE foo LIKE 'hi%' GROUP BY boo; Try the following: CREATE INDEX m_fb ON mytable (foo, boo); CREATE INDEX m_bf ON mytable (boo, foo); ANALYZE; SELECT foo, boo FROM mytable WHERE foo BETWEEN 'hi' AND 'hizzz' GROUP

[sqlite] How to get length of all columns in a table

2015-06-02 Thread Drago, William @ CSG - NARDA-MITEQ
All, I just want to make sure everyone understands that I know how to get the length of a column and that I was only asking for a wildcard technique to get the lengths of all columns in a table without having to list all the columns (e.g. SELECT Length(*) FROM myTable). Obviously that doesn't

[sqlite] How to get length of all columns in a table

2015-06-02 Thread Hick Gunter
True. Both are documented to convert their argument to string (unless it is already a string or blob). -Urspr?ngliche Nachricht- Von: Igor Tandetnik [mailto:igor at tandetnik.org] Gesendet: Dienstag, 02. Juni 2015 14:21 An: sqlite-users at mailinglists.sqlite.org Betreff: Re: [sqlite]

[sqlite] Best way to handle time slicing of SQL data.

2015-06-02 Thread Hick Gunter
What is the reason for wanting the id of a record to be fixed at the unique record number of the original insertion? Do you need to access historical data regularly or only for specific inquiries? For rarely required historical data, you could use a "history table" to hold historic copies of

[sqlite] Best way to handle time slicing of SQL data.

2015-06-02 Thread Stephen Chrzanowski
On Tue, Jun 2, 2015 at 7:34 AM, Richard Warburton < richard at skagerraksoftware.com> wrote: > 1) Do I need UID? I'm currently using it to ensure a unique Id for when > the user is creating a new entry. This however means two operations, an > Insert, then an Update to set the record's Id to

[sqlite] How to get length of all columns in a table

2015-06-02 Thread Richard Hipp
On 6/2/15, Igor Tandetnik wrote: > On 6/2/2015 2:28 AM, Hick Gunter wrote: >> Sqlite3_column_bytes will convert numeric values to strings and return the >> length of that "string representation" (excluding the terminating \0), not >> the byte size required to store the numeric value itself. > >

[sqlite] Best way to handle time slicing of SQL data.

2015-06-02 Thread Igor Tandetnik
On 6/2/2015 7:34 AM, Richard Warburton wrote: > 2) Can I auto fill Id to UID on insert instead of having to do two > operations? Yes, with an AFTER INSERT trigger -- Igor Tandetnik

[sqlite] How to get length of all columns in a table

2015-06-02 Thread Igor Tandetnik
On 6/2/2015 2:28 AM, Hick Gunter wrote: > Sqlite3_column_bytes will convert numeric values to strings and return the > length of that "string representation" (excluding the terminating \0), not > the byte size required to store the numeric value itself. So will length() SQL function, I'm pretty

[sqlite] Best way to handle time slicing of SQL data.

2015-06-02 Thread J Decker
On Tue, Jun 2, 2015 at 4:34 AM, Richard Warburton < richard at skagerraksoftware.com> wrote: > Hi, > > I'm wanting to store data in a way such that I can choose a time in the > past and view records as they were at that dateTime. Therefore (in my > mind), all updates are really inserts with a

[sqlite] How to get length of all columns in a table

2015-06-02 Thread Hick Gunter
Sqlite3_column_bytes will convert numeric values to strings and return the length of that "string representation" (excluding the terminating \0), not the byte size required to store the numeric value itself. -Urspr?ngliche Nachricht- Von: J Decker [mailto:d3ck0r at gmail.com] Gesendet: