[freetds] Freetds API query

Thompson, Bill D (London) ThompBil at exchange.uk.ml.com
Mon Jun 9 13:38:45 EDT 2003


Manoranjan,

I think you're going to have to design this functionality yourself.

First, you're going to need a mechanism to simplify the task of finding out
whether the table has been updated or not.
I would suggest a trigger on the table which inserts a row into another
table whenever any update, delete or insert happens. This second table could
be a single-column table and you could put a unique clustered index on  that
column WITH IGNORE_DUP_KEY . That would prevent many rows being inserted
into the table. You'd just get one or none... a flag if you will.

next you need to design a program on the UNIX side, which will periodically
poll the second table looking for entries appearing. If you're not too
bothered about latency in your application, then you could have a 'sleep' in
your polling loop that would prevent you flooding the server with queries.
When you find a row in the 'trigger' table, you do what you have to do, then
delete it. then go back to polling again.

As james says, not pretty, not terribly efficient, but it will do the job
for you.

There may be a neater way to do this, it all depends on what you want to do
when this table changes. 
What do you want to do ?

HTH,


Bill

> -----Original Message-----
> From:	manoranjan_sahu at agilent.com [SMTP:manoranjan_sahu at agilent.com]
> Sent:	Monday, June 09, 2003 5:14 PM
> To:	freetds at lists.ibiblio.org
> Subject:	[freetds] Freetds API query
> 
> 
> Hello,
>    I am using freetds with unixodbc to communicate with MS SQL server.
> Here is what I am trying to do.
> 
> >From my unix system, my application needs to be notified of any
> change(insert, update, delete) to a table (say T1). Does freetds has any
> api I can use to do this task?
> 
> Thanks,
> Manoranjan 
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




More information about the FreeTDS mailing list