Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

SQL Server Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(SQL Server) Create a Zip Entirely in Memory

Demonstrates how to create a .zip from in-memory byte data and strings, and to write the .zip to an in-memory image.

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    --  This example requires the Chilkat API to have been previously unlocked.
    --  See Global Unlock Sample for sample code.

    DECLARE @crypt int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Crypt2', @crypt OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    DECLARE @zip int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Zip', @zip OUT

    DECLARE @success int
    EXEC sp_OAMethod @zip, 'NewZip', @success OUT, 'test.zip'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @zip, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @crypt
        EXEC @hr = sp_OADestroy @zip
        RETURN
      END

    --  Add the bytes 0x00 0x01 0x02 0x03 ... 0x0F as a file in the .zip

    EXEC sp_OAMethod @crypt, 'Decode', @binFileData OUT, '000102030405060708090A0B0C0D0E0F', 'hex'
    DECLARE @entry int
    EXEC sp_OAMethod @zip, 'AppendData', @entry OUT, 'binaryData.dat', @binFileData
    EXEC @hr = sp_OADestroy @entry

    --  Add the string "Hello World!" to the .zip
    EXEC sp_OAMethod @zip, 'AppendString2', @entry OUT, 'helloWorld.txt', 'Hello World!', 'utf-8'
    EXEC @hr = sp_OADestroy @entry

    EXEC sp_OAMethod @zip, 'WriteToMemory', @zipFileInMemory OUT

    --  We could save these files to a file, and it is a valid .zip
    DECLARE @fac int
    EXEC @hr = sp_OACreate 'Chilkat_9_5_0.FileAccess', @fac OUT

    EXEC sp_OAMethod @fac, 'WriteEntireFile', @success OUT, 'test.zip', @zipFileInMemory
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @fac, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        EXEC @hr = sp_OADestroy @crypt
        EXEC @hr = sp_OADestroy @zip
        EXEC @hr = sp_OADestroy @fac
        RETURN
      END


    PRINT 'Zip Created!'

    EXEC @hr = sp_OADestroy @crypt
    EXEC @hr = sp_OADestroy @zip
    EXEC @hr = sp_OADestroy @fac


END
GO

 

© 2000-2016 Chilkat Software, Inc. All Rights Reserved.