[freetds] Freetds API query

James K. Lowden jklowden at schemamania.org
Wed Jun 11 08:08:19 EDT 2003


On 10 Jun 2003 23:47:55 +0100, Chris Underhill <chris at tart.net> wrote:
> > Did you use sockets to send messages the from the C stored procedures
> > ?
> 
> Yes - standard winsock calls. Look in the sql server documentation/msdn
> for details on how you can create an "extended stored procedure" and
> then look up using google etc. for info on creating simple winsock
> applications and put the two together as detailed in the documentation
> to generate a dll.   
> 
> Finally you need a nice friendly sysadmin who trusts your code enough
> that s/he's happy to load this dll into the server's address space and
> create the procedure using sp_addextendedproc - afair if your code is
> buggy/leaky,  this can create rather a lot of fun with sql server
> hangs/crashes etc. :-)

I might add that you should be *very* nice to such sysadmin, for s/he is
both rare and brave.  As Chris says, your DLL is attached to SQL Server's
process; if it crashes, it takes the server down with it.  You are also
undertaking some political liability, because the next time the server
behaves unexpectedly, you can bet questions will be routed in your
direction, even if your code is perfect.  

I'm not advising against; I think Chris's technique is clean and
efficient.  I'm just offering a friendly "caveat programmer" that your
extended stored procedure can have unintended technical and political side
effects.  

[returning to topic...]

Regards, 

--jkl



More information about the FreeTDS mailing list