|
Home > Archive > SQL Anywhere Mobile > August 2005 > Re: Is it possible to synchronize & insert,delete, update using the mobilink client's authentic
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: Is it possible to synchronize & insert,delete, update using the mobilink client's authentic
|
|
| Reg Domaratzki \(iAnywhere Solutions\) 2005-08-31, 9:30 am |
| If your triggers are currently using CURRENT USER, then the quick answer is
no.
The longer answer involves re-writing your triggers a little. First, assume
you've defined the following two MobiLink events :
call ml_add_connection_sc
ript ( 'v1', 'begin_connection', 'create variable
@mlu varchar(128)' );
call ml_add_connection_sc
ript ( 'v1', 'begin_synchronizati
on', 'set @mlu =
?' );
Now, a trigger that used to read :
create trigger bi_t1 before insert on t1
referencing new as nr for each row
begin
insert into tracking_table values ( 'whatever', CURRENT USER );
end;
Would now read :
create trigger bi_t1 before insert on t1
referencing new as nr for each row
begin
declare @uname varchar(128);
if VAREXISTS( '@mlu' ) = 1 then set @uname = @mlu;
else set @uname = CURRENT USER;
end if;
insert into tracking_table values ( 'whatever', @uname );
end;
When re-written as above, the trigger will now use CURRENT USER unless the
@mlu variable is defined (which means the connection is from MobiLink), in
which case it will use the value of @mlu, which is the name of the user that
is synchronizing. If you have stored procedures that use CURRENT USER as
well, then those would need to be modified as well.
--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup
iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swx/sdmain.stm
-> Choose SQL Anywhere Studio
-> Set filter to "Display ALL platforms IN ALL MONTHS"
"vsv" <nospam@nospam.com> wrote in message news:4314a8f8$1@foru
ms-1-dub...
> asa 9.0
> Is it possible to synchronize & insert,delete, update using the mobilink
> client's authentication?
> I want to connect to the database from the dbmlsrv9 using the client's
> authentication.
> It could be disconnect & connect within a session, however have the
dbmlsrv9
> running all the time.
>
> remote ->dbmlsrv9->connect using the remote
> userid/pwd ->insert/delete/update to the database.
>
> The reason why I am looking for such a solution is that we have our
> consolidated db built & having hundreds of table with triggers behind all
of
> the tables.
> Rules in the trigger are based on the user connected.
>
> However, dbmlsrv connects using the connection used during its startup.
The
> data sent by dbmlsync is synchronized to the database using the dbmlsrv
> connection authentication instead of the dbml client.
> Is there an option or workaround to do it.
> The authenticate_user doesn't seem to do a help on that.
> Any help please.
>
> Thanks
> vsv
>
>
>
|
|
|
|
|