Hello,

Assume a table simplified for this discussion as:

        create table T(C timestamp default (julianday()) not null);

I simply have to use a new function (let's call it 'now()' other than 
julianday() to define the default for this column.

I have apparently successfully tested this:

pragma writable_schema=1;
update sqlite_master set sql='create table T(C timestamp default (now()) not 
null)' where type='table' and name='T';
pragma writable_schema=0;

(and then disconnect / reconnect).

The automated patch would actually select the sql column value for the right 
table, edit the string appropriately, changing nothing else, then update it as 
above. This will happen in a situation where a single connection (that one) is 
made to the db (that can be guaranteed by the host app).

Apparently, from testing, I do not seem to suffer from side-effects and the 
default is properly applied when needed.

But am I missing some important detail that could hurt me later?
Or do you agree with this procedure?

-- 
Meilleures salutations, Met vriendelijke groeten, Best Regards,
Olivier Mascia, integral.be/om


Reply via email to