![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java JavaScript 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) Extract a .tar.gz Archive to a DirectorySee more Gzip ExamplesThis example demonstrates how to use the The method performs both the Gzip decompression and TAR extraction in a single step. It operates in streaming mode, meaning it does not create temporary files and uses a constant, minimal amount of memory regardless of archive size. The This method is ideal for efficiently extracting large
-- 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 @success int SELECT @success = 0 -- This example demonstrates how to extract a .tar.gz archive to a directory. DECLARE @gzip int EXEC @hr = sp_OACreate 'Chilkat.Gzip', @gzip OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- The .tar.gz file to be extracted: DECLARE @tgzPath nvarchar(4000) SELECT @tgzPath = 'c:/temp/archive.tar.gz' -- The destination directory: DECLARE @destDir nvarchar(4000) SELECT @destDir = 'c:/temp/outputDir' -- Set to 1 to prevent extraction of files with absolute paths: DECLARE @noAbsolute int SELECT @noAbsolute = 1 -- Extract the archive: EXEC sp_OAMethod @gzip, 'UnTarGz', @success OUT, @tgzPath, @destDir, @noAbsolute IF @success = 0 BEGIN EXEC sp_OAGetProperty @gzip, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @gzip RETURN END PRINT 'Archive successfully extracted to: ' + @destDir EXEC @hr = sp_OADestroy @gzip END GO |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.