Subject RE: [IBO] Global DML Caching with CURRENT_CONNECTION?
Author Jason Wharton
> Hello Jason,

Hi Thomas!

I typed up an answer to this twice before.
I wonder if it ever made it to this list???


> currently, the Global DML Caching mechanism is designed to
> work distinct connected users only.
>
> Ever thought about giving it a try with the
> CURRENT_CONNECTION context
> variable instead of USER?

This is something I requested a very long time ago and nearly begged for.
It is perfect and ideal for this very purpose because you can have an
application that has the same USER login but there are multiple
instances/connections and so it isn't possible for the DMLCaching to
distinguish. With this new feature it is now possible to be precise.

> This would mean:
>
> - Works with Firebird only, because InterBase AFAIK does not support
> this context variable
> - Making the CURRENT_CONNECTION value persistent in the "log table"
> - In IB_SyncCursor, change
>
> procedure TIB_SyncCursor.SysPrepareSQL;
> begin
> inherited SysPrepareSQL;
> SQL.Clear;
> SQL.Add( 'SELECT ' + FColIDName +
> ', ' + FColActionName +
> ', ' + FColKeyFieldsName +
> ', ' + FColKeyValuesNames );
> SQL.Add( 'FROM ' + FTableName );
> SQL.Add( 'ORDER BY ' + FColIDName + ' ASCENDING' );
> SQLWhereItems.Add( FColIDName + ' > ?LASTID' );
> if FColUserName <> '' then
> SQLWhereItems.Add( FColUserName + ' <> USER' );
> end;
>
>
> to
>
> procedure TIB_SyncCursor.SysPrepareSQL;
> begin
> inherited SysPrepareSQL;
> SQL.Clear;
> SQL.Add( 'SELECT ' + FColIDName +
> ', ' + FColActionName +
> ', ' + FColKeyFieldsName +
> ', ' + FColKeyValuesNames );
> SQL.Add( 'FROM ' + FTableName );
> SQL.Add( 'ORDER BY ' + FColIDName + ' ASCENDING' );
> SQLWhereItems.Add( FColIDName + ' > ?LASTID' );
> if FColUserName <> '' then
> SQLWhereItems.Add( FColUserName + ' <> CURRENT_CONNECTION' );
> end;
>
>
> Firebird 2.0 even goes one step further, because one could use the
> client IP address for checking if it is a "different" client machine,
> if, locally running applications should not be affected by a refresh.
>
> Thoughts?

Yes! This is a needed enhancement to the documentation and the source code.
I will take your changes and get it so that it will detect which version of
the server is running and have it behave accordingly. I hope to get this in
the next sub-release.

Thanks for re-raising any issue that seems to get neglected. I realize I'm
not being as impeccable as I ought to keep ahead of things. I hope to get
the next sub-release out soon but I am under some pressing issues at the
moment that are soaking up my time and energy.

Jason Wharton