EasyZip and Transact SQL


EasyZip and Transact SQL

Postby Nussi on Mon Aug 25, 2003 11:43 am

Hi,
I was wondering if it would be possible to use EasyZip with Microsoft Transact SQL (SQL Server"s language). Could be cool being able to zip/unzip files inside a stored procedure.
So I created a small stored procedure containing the following code : (@pZipFile being the name of the zip file, and @pFilePath an existing directory)

<b>EXEC @hr = sp_OACreate "aspZIP.EASYZIP", @zip OUT
EXEC @hr = sp_OASetProperty @zip, "ZipFileName", @pZipFile
EXEC @hr = sp_OASetProperty @zip, "ExtrBaseDir", @pFilePath
EXEC @hr = sp_OAMethod @zip, "ArgsClear"
EXEC @hr = sp_OAMethod @zip, "UnZip"
EXEC @hr = sp_OADestroy @zip</b>

This wouldn"t work, so I reviewed the visual basic example, and saw that I was supposed to call the OnStartPage method. So I added :
<b>EXEC @hr = sp_OAMethod @zip, "OnStartPage", null, null</b>
(just after the line with sp_OACreate)
and I also added :
<b>EXEC @hr = sp_OAMethod "OnEndPage"</b>
(before sp_OADestroy)

The error message I get is "type does not match". [:(!]
(just after the OnStartPage) (which seems to be located in the sp_OAMethod extended procedure).
Any idea how to solve the problem ? Or how to give a Null value as parameter with Unknown type ?
(I thought that I could translate the VB "Nothing" to "Null" in TSQL, but obviously that"s not the solution ...)

Seb

PS : I"m still working with EasyZip version 2.0.0.3
Nussi
 
Posts: 8
Joined: Mon Apr 08, 2002 9:31 am

Postby John on Mon Aug 25, 2003 11:51 am

I've never worked with the Transact SQL languages, but latest version 3.01 can be used on all languages that support library calls.
There are two methods that has been introduced to support that, Create and Destroy, so verifying your sample it can be used on this way:

EXEC @hr = sp_OACreate 'aspZIP.EASYZIP', @zip OUT
EXEC @hr = sp_OAMethod @zip, 'Create'
EXEC @hr = sp_OASetProperty @zip, 'ZipFileName', @pZipFile
EXEC @hr = sp_OASetProperty @zip, 'ExtrBaseDir', @pFilePath
EXEC @hr = sp_OAMethod @zip, 'ArgsClear'
EXEC @hr = sp_OAMethod @zip, 'UnZip'
EXEC @hr = sp_OAMethod @zip, 'Destroy'
EXEC @hr = sp_OADestroy @zip
John
 
Posts: 1313
Joined: Wed Oct 31, 2001 10:23 am
Location: Spain

Postby Nussi on Mon Aug 25, 2003 2:12 pm

Hi,
Tried to get version 3 registered (http://www.mitdata.com/~regusers/),
but when I enter the informations I got by mail a few months ago I get the following message :
<b>Your session has expired. Please activate the cookies to track your session on this secured place</b>
I'm quite sure cookies are activated on my browser.
Tried to email support@mitdata.com but it didn't work either (looks like our mail server is blacklisted, quite suprising ...)

Can you help me get version 3 ? Thanks
Nussi
 
Posts: 8
Joined: Mon Apr 08, 2002 9:31 am

Postby John on Mon Aug 25, 2003 2:30 pm

No, is our server that is blacklisted... We left openned for only 20 hours the open relay on the Wingate proxy server, when we fixed that we couldn't be removed from that list.

Send me an email to jlohmeyer@eresmas.net with you Order ID information and I will send you the login information and the URL to download it.
John
 
Posts: 1313
Joined: Wed Oct 31, 2001 10:23 am
Location: Spain

Postby Nussi on Mon Aug 25, 2003 4:19 pm

OK, tried with version 3 and it's working. Here's the code, if that's of any interest for somebody :

<b>CREATE PROCEDURE dbo.sp_m2UnzipFile (
@pZipFile varchar(250),
@pFilePath varchar(250)
)
AS

Declare @zip int,
@hr int
EXEC @hr = sp_OACreate 'aspZIP.EASYZIP', @zip OUT
EXEC @hr = sp_OAMethod @zip, 'Create'
EXEC @hr = sp_OASetProperty @zip, 'ZipFileName', @pZipFile
EXEC @hr = sp_OASetProperty @zip, 'ExtrBaseDir', @pFilePath
EXEC @hr = sp_OAMethod @zip, 'UnZip'
EXEC @hr = sp_OAMethod @zip, 'Destroy'
EXEC @hr = sp_OADestroy @zip
GO</b>

You have to use a registered version, otherwise easyZip will show a messagebox, and since SQL Server is a service, nobody will ever be able to answer "OK" to that box [:(]

Nussi.

PS : BTW, we left relay activated on our server once for two hours, it was flooded too, and we were blacklisted for a while too. Should do something evil to those spammers, like aspEasySpamKiller lol [|)]
Nussi
 
Posts: 8
Joined: Mon Apr 08, 2002 9:31 am


Return to Zip

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Fatal error: Not able to open ./cache/data_global.php in D:\Hosting\6480136\html\ForosBB3\includes\acm\acm_file.php on line 106