SQL Server Stored Procedure Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

SQL Server
Stored Procedure Examples

Quick Start
Encryption
File Access
IMAP
POP3
SMTP
Email Object
FTP
HTML-to-XML
HTTP
MHT
MIME
RSA Encryption
Socket
Spider
String
Tar
Upload
XML
XMP
Zip

Byte Array
RSS
Atom
Self-Extractor

Unrar a RAR Archive

Open a RAR archive and unrar to a directory, recreating the directory tree as present in the RAR.

Note: The Chilkat RAR ActiveX objects are included in the "Chilkat Zip" ActiveX download. The RAR functionality contained within ChilkatZip2.dll is freeware, however, the Chilkat Zip, GZip, and .Z functionality is not freeware.

The Chilkat RAR for .NET and C++ are bundled in downloads that contain all Chilkat classes (both free and non-free). Make sure you select the download that matches your .NET Framework or VC++ version (6/7/8).

If running on x64, download the ActiveX, .NET, or C++ builds marked specifically for x64.

CREATE PROCEDURE ChilkatSample
AS
BEGIN
    DECLARE @hr int
    DECLARE @sTmp0 nvarchar(4000)
    DECLARE @rar int
    EXEC @hr = sp_OACreate 'Chilkat.Rar', @rar OUT
    IF @hr <> 0
    BEGIN
        PRINT 'Failed to create ActiveX component'
        RETURN
    END

    --  Note: The Chilkat RAR functionality only provides the ability
    --  to open, list, and "unrar" (i.e. extract) RAR archives.  It does
    --  not provide the ability to create RAR archives.

    --  Also, the Chilkat RAR functionality is free.  It does not
    --  require a license to use indefinitely.

    DECLARE @success int

    EXEC sp_OAMethod @rar, 'Open', @success OUT, 'abc123.rar'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rar, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
        RETURN
      END

    EXEC sp_OAMethod @rar, 'Unrar', @success OUT, 'c:/temp/unrarDest/'
    IF @success <> 1
      BEGIN
        EXEC sp_OAGetProperty @rar, 'LastErrorText', @sTmp0 OUT
        PRINT @sTmp0
      END
    ELSE
      BEGIN
        PRINT 'Success.'
      END
END
GO

 

Need a specific example? Send a request to support@chilkatsoft.com

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