On Tue, May 28, 2013 at 3:26 PM, kyan <alfasud...@gmail.com> wrote:

>
> On Tue, May 28, 2013 at 3:06 PM, Dave Wellman <dwell...@ward-analytics.com
> > wrote:
>
>> Is there a way to extract the content of a column/row in its 'stored'
>> format
>> - i.e. the actual bytes?  So that it's 'fairly' easy to read! I have a
>> utility that will look at the hex bytes of any file, but the entire
>> database
>> is (understandably) quite complex.
>>
>>
>>
>> Let me explain the problem that I'm facing and someone might point me in a
>> better direction.
>> <snip>
>>
>>
> Maybe the typeof() function could help?
> <snip>
>

Also, in order to troubleshoot your application(s), script(s) etc. that
modify the database and find the piece of code that inserts a value of the
wrong type you can create two triggers on your table:

CREATE TRIGGER BI_TEST BEFORE INSERT ON test FOR EACH ROW
BEGIN
  SELECT CASE
    WHEN (typeof (new.col) <> 'integer') THEN
      RAISE(FAIL, 'Invalid type inserted')
    END;
END;

CREATE TRIGGER BU_TEST BEFORE UPDATE OF col ON test FOR EACH ROW
BEGIN
  SELECT CASE
    WHEN (typeof (new.col) <> 'integer') THEN
      RAISE(FAIL, 'Invalid type inserted')
    END;
END;

You can keep them until you run the app/scripts and locate the problem (you
will get an error at exactly that command) and then drop them or keep them
permanently to ensure that you will never have a value of the wrong type.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to