|
Home > Archive > SQL Anywhere Mobile > April 2005 > Stopping a sync from the connection script
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 |
Stopping a sync from the connection script
|
|
|
| In the connection script I retrieve a parameter from the consolidated
database that is specific to the site requesting the synchronization. Based
on the value of that parameter I may want to disallow a synchronization from
that site.
Is there a kind way to stop the sych from the connection script? I am using
MobiLink version 7.0.0.313 (I know, I know, but it's still doing the job!)
| |
| Reg Domaratzki \(iAnywhere Solutions\) 2005-04-26, 1:24 pm |
| This is something I'd do in the authenticate_user connection script. I
think this is even the right link in the docs for v700 :
Replication and Synchronization Guide
PART 2. MobiLink Synchronization
CHAPTER 8. Reference
Scripts
authenticate_user connection script
--
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 "Platform Preview" and "Time Frame" to ALL
"Doug" <me@anywhere.com> wrote in message news:426e8463$1@foru
ms-1-dub...
> In the connection script I retrieve a parameter from the consolidated
> database that is specific to the site requesting the synchronization.
Based
> on the value of that parameter I may want to disallow a synchronization
from
> that site.
>
> Is there a kind way to stop the sych from the connection script? I am
using
> MobiLink version 7.0.0.313 (I know, I know, but it's still doing the job!)
>
>
| |
|
| I have set up an authenticate_user connection event in the
ml_connection_script
table. It calls a stored procedure.
My problem is that it isn't obvious that this call to the stored procedure
is actually happening.
I start the ML server with the -vcst logging options. I look at the log
after I synch from a remote database and there is nary a mention of the
execution of the authenticate_user event.
Where can I verify that this event is firing?
One other thing. The example of the my_auth stored procedure in the manual
has the line 'message OK type info to client'. Where exactly is this 'OK'
message suppose to appear?
"Reg Domaratzki (iAnywhere Solutions)" < Spam_bad_rdomarat@ia
nywhere.com>
wrote in message news:426e8666$1@foru
ms-2-dub...
> This is something I'd do in the authenticate_user connection script. I
> think this is even the right link in the docs for v700 :
>
> Replication and Synchronization Guide
> PART 2. MobiLink Synchronization
> CHAPTER 8. Reference
> Scripts
> authenticate_user connection script
>
> --
> 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 "Platform Preview" and "Time Frame" to ALL
>
> "Doug" <me@anywhere.com> wrote in message news:426e8463$1@foru
ms-1-dub...
> Based
> from
> using
job!)[color=darkred]
>
>
| |
| Greg Fenton 2005-04-27, 9:24 am |
| Doug wrote:
> I have set up an authenticate_user connection event in the
> ml_connection_script
table. It calls a stored procedure.
>
How exactly did you set this up?
Did you use the ml_add_connection_sc
ript() stored proc? Or Sybase
Central? Or did you manually insert the row into ml_connection_script
?
If the latter, please show use the exact SQL you used.
Also, are you sure you associated the script with the same script
version your remote is using?
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/
| |
|
| I manually INSERT into the various 'ml_' tables. The script for my
authenticate_user event is defined as follows:
INSERT INTO "ml_script"
( "script_id",
"script" )
VALUES (56,
'call my_auth(?,?) ' ) ;
And to assign this script as the event I use this:
INSERT INTO " ml_connection_script
"
( "version_id",
"event",
"script_id" )
VALUES (1,
'authenticate_user',
56 ) ;
I only have one version id in my databases, and that is 1.
The my_auth stored procedure looks like this:
ALTER procedure dba.my_auth(inout auth_status integer,@user_name
varchar(128))
begin
if exists(select* from last_update where user_code = @user_name and
disable_sync = 'N') then
message 'OK to synchronize' type info to client;
set auth_status=1000
else
message 'Not OK to synchronize' type info to client;
set auth_status=4000
end if
end
"Greg Fenton" <greg. fenton_NOSPAM_@ianyw
here.com> wrote in message
news:426f91e3@forums
-2-dub...
> Doug wrote:
>
> How exactly did you set this up?
>
> Did you use the ml_add_connection_sc
ript() stored proc? Or Sybase
> Central? Or did you manually insert the row into ml_connection_script
?
>
> If the latter, please show use the exact SQL you used.
>
> Also, are you sure you associated the script with the same script
> version your remote is using?
>
> greg.fenton
> --
> Greg Fenton
> Consultant, Solution Services, iAnywhere Solutions
> --------
> Visit the iAnywhere Solutions Developer Community
> Whitepapers, TechDocs, Downloads
> http://www.ianywhere.com/developer/
| |
| Graham Hurst 2005-04-27, 8:25 pm |
| > I manually INSERT into the various 'ml_' tables.
That's not supported. The supported ways to add MobiLink scripts are to
use Sybase Central or the supplied stored procedures, described here:
MobiLink Administration Guide
Stored Procedures
Stored procedures to add or delete scripts
Many people prefer using the stored procedures from a SQL file. Such a
file can be edited with a text editor and saved under a source control
system.
I don't know if directly inserting scripts is your problem, but I
suspect it is. I strongly recommend using one of the recommended methods
instead.
Cheers,
Graham
| |
| Reg Domaratzki \(iAnywhere Solutions\) 2005-04-28, 9:24 am |
| Doug, the authenticate_user script was added in v701, but Graham makes a
very good point about inserting into the ml_ table directly. I'd always
suggest using the ml_add_connection_sc
ript and ml_add_table_script stored
procedures to add scripts.
http://sybooks.sybase.com/onlineboo.../1120;pt=1120#X
It looks like you've got a reason to upgrade now. :)
--
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 "Platform Preview" and "Time Frame" to ALL
"Doug" <me@anywhere.com> wrote in message news:426f97cd$1@foru
ms-2-dub...
> I manually INSERT into the various 'ml_' tables. The script for my
> authenticate_user event is defined as follows:
>
> INSERT INTO "ml_script"
> ( "script_id",
> "script" )
> VALUES (56,
> 'call my_auth(?,?) ' ) ;
>
> And to assign this script as the event I use this:
>
> INSERT INTO " ml_connection_script
"
> ( "version_id",
> "event",
> "script_id" )
> VALUES (1,
> 'authenticate_user',
> 56 ) ;
> I only have one version id in my databases, and that is 1.
>
> The my_auth stored procedure looks like this:
>
> ALTER procedure dba.my_auth(inout auth_status integer,@user_name
> varchar(128))
> begin
> if exists(select* from last_update where user_code = @user_name and
> disable_sync = 'N') then
> message 'OK to synchronize' type info to client;
> set auth_status=1000
> else
> message 'Not OK to synchronize' type info to client;
> set auth_status=4000
> end if
> end
>
> "Greg Fenton" <greg. fenton_NOSPAM_@ianyw
here.com> wrote in message
> news:426f91e3@forums
-2-dub...
>
>
|
|
|
|
|