![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(SQL Server) Setting a HTTP Max Response SizeDemonstrates the
-- 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 @success int SELECT @success = 0 DECLARE @http int EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END DECLARE @maxSz int SELECT @maxSz = 16384 EXEC sp_OASetProperty @http, 'MaxResponseSize', @maxSz -- Try to get something larger, such as hamlet.xml which is 279658 bytes DECLARE @xmlStr nvarchar(4000) EXEC sp_OAMethod @http, 'QuickGetStr', @xmlStr OUT, 'https://chilkatsoft.com/hamlet.xml' EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT IF @iTmp0 = 0 BEGIN -- If the LastErrorText contains the string "MaxResponseSize", -- then the HTTP request failed because the response body would've been larger than the max allowed response size. EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http RETURN END PRINT 'OK' EXEC @hr = sp_OADestroy @http END GO |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.