![]() |
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) Example: Http.S3_FileExists methodDemonstrates the
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr 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 -- Insert your AWS keys here: EXEC sp_OASetProperty @http, 'AwsAccessKey', 'AWS_ACCESS_KEY' EXEC sp_OASetProperty @http, 'AwsSecretKey', 'AWS_SECRET_KEY' DECLARE @bucketName nvarchar(4000) SELECT @bucketName = 'chilkat.ocean' DECLARE @objectName nvarchar(4000) SELECT @objectName = 'seahorse.jpg' EXEC sp_OASetProperty @http, 'AwsRegion', 'us-west-2' EXEC sp_OASetProperty @http, 'AwsEndpoint', 's3-us-west-2.amazonaws.com' DECLARE @retval int EXEC sp_OAMethod @http, 'S3_FileExists', @retval OUT, @bucketName, @objectName IF @retval < 0 BEGIN PRINT 'Failed to check for the S3 object existence' EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @http RETURN END IF @retval = 0 BEGIN PRINT 'The S3 object does not exist.' EXEC @hr = sp_OADestroy @http RETURN END PRINT 'The S3 object exists.' EXEC @hr = sp_OADestroy @http END GO |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.