(SQL Server) Example: Http.GetCacheRoot method
Demonstrates the GetCacheRoot method.
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
DECLARE @http int
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
-- Establish 2 cache root directories.
EXEC sp_OAMethod @http, 'AddCacheRoot', NULL, 'c:/example/httpCacheA/'
EXEC sp_OAMethod @http, 'AddCacheRoot', NULL, 'c:/example/httpCacheB/'
EXEC sp_OAGetProperty @http, 'NumCacheRoots', @iTmp0 OUT
PRINT 'Number of cache roots: ' + @iTmp0
EXEC sp_OAMethod @http, 'GetCacheRoot', @sTmp0 OUT, 0
PRINT '1st cache root: ' + @sTmp0
EXEC sp_OAMethod @http, 'GetCacheRoot', @sTmp0 OUT, 1
PRINT '2nd cache root: ' + @sTmp0
-- Output:
-- Number of cache roots: 2
-- 1st cache root: c:/example/httpCacheA/
-- 2nd cache root: c:/example/httpCacheB/
EXEC @hr = sp_OADestroy @http
END
GO
|