On 1/14/15, Paul Sanderson <sandersonforens...@gmail.com> wrote: > Thanks all > > I am running the latest version :) > > I am just getting back to this and have a related problem > > I have a table > > create table (base int, hex text) > > and I want to create a trigger such that if hex is updated (or a new > row inserted) with a text string in the form 0x12345abcd this value is > converted into an integer and copied to base. > > I have tried various methods such as > > CREATE TRIGGER hex_trig after insert on dates > when (select hex from dates where hex is not null) > begin > update dates set base = cast(new.hex as int); > end > > but so far have drawn a blank > > Can this be done?
No. Not like that, anyhow. >From the documentation (https://www.sqlite.org/lang_expr.html#hexint): "For backwards compatibility, the "0x" hexadecimal integer notation is only understood by the SQL language parser, not by the type conversions routines." > > > Paul > www.sandersonforensics.com > skype: r3scue193 > twitter: @sandersonforens > Tel +44 (0)1326 572786 > http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit > -Forensic Toolkit for SQLite > http://sandersonforensics.com/forum/content.php?168-Reconnoitre - VSC > processing made easy > > > > On 8 January 2015 at 00:33, Richard Hipp <d...@sqlite.org> wrote: >> On 1/7/15, Paul Sanderson <sandersonforens...@gmail.com> wrote: >>> Evening all >>> >>> I dont think this can be done, but would love to be corrected. I have >>> a column with integer dates stored in hex format so 1234567890 is >>> stored as 49962d2 >>> >>> Obviously >>> DateTime(1234567890, 'unixepoch') >>> >>> work OK, but what I would like to do is something like >>> >>> DateTime(0x49962d2, 'unixepoch') >> >> This should work fine, provided you are using SQLite 3.8.6 or later. >> Support for hexadecimal literals was added in version 3.8.6. Release >> date for 3.8.6 was 2014-08-15, so this is not the version running on >> your phone. :-\ >> >> >>> >>> or >>> >>> DateTime(HexToInt(0x49962d2), 'unixepoch') >>> >>> Is this possible? Not a problem if not, but would be nice. >>> >>> Thanks >>> >>> >>> Paul >>> www.sandersonforensics.com >>> skype: r3scue193 >>> twitter: @sandersonforens >>> Tel +44 (0)1326 572786 >>> http://sandersonforensics.com/forum/content.php?195-SQLite-Forensic-Toolkit >>> -Forensic Toolkit for SQLite >>> http://sandersonforensics.com/forum/content.php?168-Reconnoitre - VSC >>> processing made easy >>> _______________________________________________ >>> sqlite-users mailing list >>> sqlite-users@sqlite.org >>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>> >> >> >> -- >> D. Richard Hipp >> d...@sqlite.org >> _______________________________________________ >> 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 > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users