Home > Archive > SQL Anywhere Mobile > March 2005 > Am I syncing ... ?









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 Am I syncing ... ?
mark

2005-03-30, 9:43 am

I have a couple of triggers on the remote database that
contain code I only want to execute when I am syncing. Not
everyday insert and updates. Is there anyway for me to
check this programatically? Maybe a setting in the db
itself or something?

Thanks,
mark
mark

2005-03-30, 9:43 am

OK...
so I just read deeper through the news groups and someone
had asked a similiar question to mine. They wanted to know
if you can determine if a record is being inserted/updated
"at the consolidated databsae" during replication. The
answer was :

"You can create a variable in sp_hook_dbmlsync_beg
in and
then drop it in sp_hook_dbmlsync_end
. Your trigger code can
then check for the existence of the variable using the
VAREXISTS function."

My question, just to clarify is : Can I do something like
this at the remote store?


> I have a couple of triggers on the remote database that
> contain code I only want to execute when I am syncing.
> Not everyday insert and updates. Is there anyway for me
> to check this programatically? Maybe a setting in the db
> itself or something?
>
> Thanks,
> mark

mark

2005-03-30, 9:43 am

sorry...
i forgot to mention version ...
ASA 8.0.2.4339

thanks,
mark

[color=darkred]
> OK...
> so I just read deeper through the news groups and someone
> had asked a similiar question to mine. They wanted to
> know if you can determine if a record is being
> inserted/updated "at the consolidated databsae" during
> replication. The answer was :
>
> "You can create a variable in sp_hook_dbmlsync_beg
in and
> then drop it in sp_hook_dbmlsync_end
. Your trigger code
> can then check for the existence of the variable using the
> VAREXISTS function."
>
> My question, just to clarify is : Can I do something like
> this at the remote store?
>
>
Reg Domaratzki \(iAnywhere Solutions\)

2005-03-30, 9:43 am

That quote is valid on the remote. I mis-read the original post.

--
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

<mark> wrote in message news:423b39eb.4ba3.1681692777@sybase.com...[color=darkred]
> OK...
> so I just read deeper through the news groups and someone
> had asked a similiar question to mine. They wanted to know
> if you can determine if a record is being inserted/updated
> "at the consolidated databsae" during replication. The
> answer was :
>
> "You can create a variable in sp_hook_dbmlsync_beg
in and
> then drop it in sp_hook_dbmlsync_end
. Your trigger code can
> then check for the existence of the variable using the
> VAREXISTS function."
>
> My question, just to clarify is : Can I do something like
> this at the remote store?
>
>


Breck Carter [TeamSybase]

2005-03-30, 9:43 am

This used to work, but I haven't used it for a while...

IF CONNECTION_PROPERTY ( 'Name' ) LIKE 'dbmlsync%'

You could also use a *specific* user to execute dbmlsync, and then
just use

IF CURRENT USER = 'whatever'

Breck

On 18 Mar 2005 11:28:57 -0800, mark wrote:

>I have a couple of triggers on the remote database that
>contain code I only want to execute when I am syncing. Not
>everyday insert and updates. Is there anyway for me to
>check this programatically? Maybe a setting in the db
>itself or something?
>
>Thanks,
>mark


--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/A...7/risingroad-20
bcarter@risingroad.com
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
David Fishburn

2005-03-30, 9:43 am

mark wrote in news:423b2bf5.4a90.1681692777@sybase.com
of sybase.public.sqlanywhere.mobilink:

m> I have a couple of triggers on the remote database that
m> contain code I only want to execute when I am syncing. Not
m> everyday insert and updates. Is there anyway for me to
m> check this programatically? Maybe a setting in the db
m> itself or something?

If you create this function, you can call it from your application to
determine if dbmlsync is still running:

/*
* This function checks to see if DBMLSync is already runnings
* It will return 'Y' if it is, otherwise 'N'
* It does this by checking the connection names of all connections
*/

IF EXISTS( SELECT 1
FROM SYS.SYSPROCEDURE
WHERE proc_name = 'f_is_dbmlsync_runni
ng' ) THEN
DROP PROCEDURE "BRINKS_ADGP". f_is_dbmlsync_runnin
g;
END IF;

CREATE FUNCTION "BRINKS_ADGP". f_is_dbmlsync_runnin
g(
IN db_number_parm INTEGER DEFAULT db_id()
)
RETURNS CHAR(1)
BEGIN
DECLARE @is_dbmlsync_runnnin
g CHAR(1);
DECLARE @connid INTEGER;

SET @is_dbmlsync_runnnin
g = 'N';

--Get first connection for this database
--we are currently connected to
SET @connid = next_connection( @connid, db_number_parm );

lbl: LOOP

IF( @connid IS NULL ) THEN
--No connections left
LEAVE lbl;
END IF;

IF( LOCATE( connection_property(
'Name', @connid), 'DBMLsync' )
> 0 ) THEN

--This is not a DBMLSync connection
SET @is_dbmlsync_runnnin
g = 'Y';
LEAVE lbl;
END IF;

SET @connid = next_connection( @connid, db_number_parm );

END LOOP lbl;

RETURN @is_dbmlsync_runnnin
g;
END;

--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng9 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/swx/sdmain.stm

Developer Community / Whitepapers
http://www.ianywhere.com/developer

CaseXpress - to report bugs
http://casexpress.sybase.com

CodeXchange - Free samples
[url]http://ianywhere.codexchange.sybase.com/servlets/ ProjectDocumentList[
/url]

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com