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 & 0xFFFFFF00 WHEN 0x00800000 THEN 'Blocked' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x01000000 THEN 'Forward_Back' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x02000000 THEN 'From_Address_Bar' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x04000000 THEN 'Home_Page' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x08000000 THEN 'From_API' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x10000000 THEN 'Chain_Start' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x20000000 THEN 'Chain_end' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x40000000 THEN 'Client_Redirect' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0x80000000 THEN 'Server_Redirect' ELSE '' END || CASE visits.transition & 0xFFFFFF00 WHEN 0xC0000000 THEN 'Is_Redirect_Mask' ELSE '' END ) AS Qualifiers 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? Thanks Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit <http://sandersonforensics.com/forum/content.php?190-SQLite-Recovery> -SQLite Forensic Toolkit http://sandersonforensics.com/forum/content.php?168-Reconnoitre - VSC processing made easy On 13 October 2014 13:17, Clemens Ladisch <clem...@ladisch.de> wrote: > 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 attr & 32 THEN ', archive' ELSE '' END || > CASE WHEN attr & 16 THEN ', directory' ELSE '' END || > CASE WHEN attr & 4 THEN ', system' ELSE '' END || > CASE WHEN attr & 2 THEN ', hidden' ELSE '' END || > CASE WHEN attr & 1 THEN ', readonly' ELSE '' END, 3) > FROM MyTable; > > > Regards, > Clemens > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users