Re: [sqlite] following a trail of references

2014-10-13 Thread Paul Sanderson
Thanks both - modified the code for my example but it failed :( I'll keep at it and see if I can get my head around it. Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit

[sqlite] (no subject)

2014-10-13 Thread Rohit Kaushal
please unregister me ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] (no subject)

2014-10-13 Thread Simon Slavin
On 13 Oct 2014, at 12:06pm, Rohit Kaushal wrote: > please unregister me Only you can stop forest fires. See the link at the bottom of every post to this list. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] decoding a bitmask

2014-10-13 Thread Paul Sanderson
I have a table with an integer value which is a bitmask. one or more of the bits can be set and each bit has a corresponding meaning. so using the windows file attribute as an example we have 0c01 readonly 0x02 hidden 0x04 system 0x10 directory 0x20 archive none, any or all could be set I'd

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Richard Hipp
On Mon, Oct 13, 2014 at 7:52 AM, Paul Sanderson < sandersonforens...@gmail.com> wrote: > I have a table with an integer value which is a bitmask. one or more of the > bits can be set and each bit has a corresponding meaning. > > so using the windows file attribute as an example we have > > 0c01

Re: [sqlite] group_concat query performance

2014-10-13 Thread Kraijenbrink - FixHet - Systeembeheer
Hi, I've created 3 test samples. A C++ (sqlite-amalgamation-3080600 .lib) and two VB.NET variants (sqlite-netFx40-binary-x64-2010-1.0.94.0). 1. "SQLitePerfTest - C++ " runs very fast. 50.000 queries in 8 or 9 seconds; 2. "SQLitePerfTest - VB.net runs very fast. 50.000 queries in 7 or 8

Re: [sqlite] decoding a bitmask

2014-10-13 Thread RSmith
On 2014/10/13 13:52, Paul Sanderson wrote: I have a table with an integer value which is a bitmask. one or more of the bits can be set and each bit has a corresponding meaning. so using the windows file attribute as an example we have 0c01 readonly 0x02 hidden 0x04 system 0x10 directory 0x20

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Clemens Ladisch
Paul Sanderson wrote: > I have a table with an integer value which is a bitmask. > > 0c01 readonly > 0x02 hidden > 0x04 system > 0x10 directory > 0x20 archive > > I'd like to create a query which would take an attribute, say 0x07 and spit > out "system, hidden, readonly" SELECT substr(CASE WHEN

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Paul Sanderson
Thanks all Clemens - I went initially for your solution as it fitsbetter with some other work i have done My actual code is as folows (CASE visits.transition & 0xFF00 WHEN 0x0080 THEN 'Blocked' ELSE '' END || CASE visits.transition & 0xFF00 WHEN 0x0100 THEN

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Mark Lawrence
On Mon Oct 13, 2014 at 02:39:40PM +0100, Paul Sanderson wrote: > > The query is on a visits table from a google chrome history database. The > query seems to work OK if a single bit is set, but fails (a blank string is > returned) when multiple bits are set. Any ideas why? I suspect it is a bug

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Mark Lawrence
On Mon Oct 13, 2014 at 04:51:16PM +0200, Mark Lawrence wrote: > On Mon Oct 13, 2014 at 02:39:40PM +0100, Paul Sanderson wrote: > > Perl equivalent: > > use feature 'say'; > my $a = 0x0080 | 0x0800; > > say $a & 0x0080; > say $a & 0x0800; > say $a & 0x0800

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Clemens Ladisch
Paul Sanderson wrote: > (CASE visits.transition & 0xFF00 WHEN 0x0080 THEN 'Blocked' > ELSE '' END || >CASE visits.transition & 0xFF00 WHEN 0x0100 THEN 'Forward_Back' > ELSE '' END || >... > > The query seems to work OK if a single bit is set, but fails (a blank

Re: [sqlite] decoding a bitmask

2014-10-13 Thread RSmith
On 2014/10/13 16:51, Mark Lawrence wrote: On Mon Oct 13, 2014 at 02:39:40PM +0100, Paul Sanderson wrote: The query is on a visits table from a google chrome history database. The query seems to work OK if a single bit is set, but fails (a blank string is returned) when multiple bits are set.

Re: [sqlite] decoding a bitmask

2014-10-13 Thread RSmith
On 2014/10/13 15:39, Paul Sanderson wrote: Thanks all Clemens - I went initially for your solution as it fitsbetter with some other work i have done My actual code is as folows (CASE visits.transition & 0xFF00 WHEN 0x0080 THEN 'Blocked' ELSE '' END || CASE

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Igor Tandetnik
On 10/13/2014 9:39 AM, Paul Sanderson wrote: The query seems to work OK if a single bit is set, but fails (a blank string is returned) when multiple bits are set. Any ideas why? CASE x WHEN y ... checks that x = y, not that x & y != 0. You are checking for equality with a one-bit value - so

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Clemens Herschel
Hi, I used to bitwise stuff in Assembler in the 60's when disk space was dear. Do not know your environment. But maybe my observations will help. CASE stops after one conditions is met and does not test other cases. The next line executed is after the CASEs When I worked with bits, I would

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Doug Currie
> > The query is on a visits table from a google chrome history database. The > query seems to work OK if a single bit is set, but fails (a blank string is > returned) when multiple bits are set. Any ideas why? > It's because none of the WHEN 0x... cases, except 0xC0..., have multiple bits set.

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Mark Lawrence
My apologies for the previous completely wrong mesage. I got mixed up with operator meaning & precedence... On Mon Oct 13, 2014 at 02:39:40PM +0100, Paul Sanderson wrote: > > My actual code is as folows > > (CASE visits.transition & 0xFF00 WHEN 0x0080 THEN 'Blocked' > ELSE '' END

[sqlite] Lets try this again. Sqlite Python libraries throwing exception on unique constraint.

2014-10-13 Thread Jeffrey Parker
Hello, I am working with sqlite3 in python 2.7.8 and I am running into a strange error where I get the below exception when running an insert into statement on an empty table. I know this is probably more to do with the python libraries but I thought that I would ask the question here in case

Re: [sqlite] decoding a bitmask

2014-10-13 Thread Paul Sanderson
Thanks all - agree rookie mistake with xor, had this been a C++ exercise I would have have been OK - SQL seems to make my mind go blank... Thanks for the case explanation Mark - v helpful. Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786

Re: [sqlite] Lets try this again. Sqlite Python libraries throwing exception on unique constraint.

2014-10-13 Thread Clemens Ladisch
Jeffrey Parker wrote: > I am working with sqlite3 in python 2.7.8 and I am running into a strange > error where I get the below exception when running an insert into statement > on an empty table. The following code executes fine in Python 2.7.5: import sqlite3 conn=sqlite3.connect(":memory:")

Re: [sqlite] Lets try this again. Sqlite Python libraries throwing exception on unique constraint.

2014-10-13 Thread Dan Kennedy
On 10/13/2014 11:44 PM, Jeffrey Parker wrote: Hello, I am working with sqlite3 in python 2.7.8 and I am running into a strange error where I get the below exception when running an insert into statement on an empty table. I know this is probably more to do with the python libraries but I

Re: [sqlite] group_concat query performance

2014-10-13 Thread Joe Mistachkin
Kraijenbrink - FixHet - Systeembeheer wrote: > > 1. "SQLitePerfTest - C++ " runs very fast. 50.000 queries in 8 or 9 seconds; > > 2. "SQLitePerfTest - VB.net runs very fast. 50.000 queries in 7 or 8 seconds. >(Without the GROUP_CONCAT function that is;) > > 3. "SQLitePerfTest - VB.net

Re: [sqlite] Lets try this again. Sqlite Python libraries throwing exception on unique constraint.

2014-10-13 Thread Keith Medcalf
And 2.7.8: Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlite3 >>> conn=sqlite3.connect(":memory:") >>> conn.execute(""" ... CREATE TABLE `UpdateFrom` ( ... `VersionName`

Re: [sqlite] Will someone be able to explain this weird outcome...

2014-10-13 Thread jose isaias cabrera
"Roger Binns" wrote... -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/10/2014 01:18 PM, jose isaias cabrera wrote: I was able to figure out that comma's are more important than just a 1000 number delemeter, so I received the right answer by taking the commas out: To help avoid this

[sqlite] [SQL Query] Top 10 of 5 different groups sorted by length

2014-10-13 Thread pihug12
Hello! I'm trying to find a way to reduce the length of the following query using SQLite: select * from (select GroupName, JobName, Start, End, Status, (strftime('%s', End) - strftime('%s', Start)) as Length from ReportJobs where PlanDate = '2014-02-13' and GroupName like 'GRP01%' ORDER BY

Re: [sqlite] [SQL Query] Top 10 of 5 different groups sorted by length

2014-10-13 Thread Igor Tandetnik
On 10/13/2014 5:21 PM, pihu...@free.fr wrote: Do you know a simplest/better way to perform this query? Something along these lines: select * from ReportJobs r1 where rowid in ( select r2.rowid from ReportJobs r2 where substr(r2.GroupName, 1, 5) = substr(r1.GroupName, 1, 5) and