Original reply sent from incorrect email address.

-----Original Message-----
From: David Wellman [mailto:david.well...@ward-analytics.com] 
Sent: 28 May 2013 14:25
To: 'General Discussion of SQLite Database'
Subject: RE: [sqlite] Exact content of a column in a row

Dear all,

Many thanks for your suggestions. I think the typeof, len and hex functions
will probably give me what I need.

Regards,
Dave


Ward Analytics Ltd - information in motion
Tel: +44 (0) 118 9740191
Fax: +44 (0) 118 9740192
www: http://www.ward-analytics.com

Registered office address: The Oriel, Sydenham Road, Guildford, Surrey,
United Kingdom, GU1 3SR Registered company number: 3917021 Registered in
England and Wales.

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of kyan
Sent: 28 May 2013 13:49
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Exact content of a column in a row

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

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to