Page 22 of 40

Posted: Wed Aug 22, 2007 4:02 pm
by Micko
Hi gnozal i try but i hav the same problem can you help me why my last code please ?

Posted: Sun Sep 02, 2007 4:11 pm
by byo
Hi, gnozal.

This is not working on my computer:

Code: Select all

Procedure MSSQL_MakeBackup(dbName.s, destFolder.s)
	Protected string.s, bckFile.s, zipFile.s
	
	bckFile = GetTemporaryDirectory() + dbName + ".bck"
	string = "BACKUP DATABASE " + dbName + " TO DISK = '" + bckFile + "'  WITH INIT"
	
	If Not DatabaseQuery(0, string)
		MessageRequester("Error", "Error while creating backup!")
		End
	EndIf
	
	zipFile = destFolder + "\" + dbName + ".zip"
	If PureZIP_Archive_Create(zipFile, #APPEND_STATUS_CREATE)
		PureZIP_Archive_Compress(bckFile, #False)		
		PureZIP_Archive_Close()
	Else
		MessageRequester("Error", "Error creating ZIP file!")
	EndIf
	
	If FileSize(bckFile) > -1
		If DeleteFile(bckFile)
			ProcedureReturn #True
		EndIf
	EndIf
EndProcedure
It creates a ZIP file but the file inside has the file size of 0. PureZip_Archive_Compress() returns -1. Am I doing something wrong?

[EDIT] Sorry I copy & pasted the wrong code. :oops:

Posted: Sun Sep 02, 2007 6:59 pm
by byo
[EDIT] Hmm... I spent all Sunday trying to figure it out. It seems that PureZIP won't find the file I'm trying to compress even if it's there and it will add a zero bytes file. I've tried several ways of detecting what's wrong, tried to isolate the code, made all variables show in the debug output.

Still I can't make this file get into my ZIP file. Only if I add a break point and follow its execution step by step.

Please, help. Thanks a lot for the great tool.

[EDIT #2]
I found out what it is. DatabaseUpdate() returns 1 too soon while SQLServer engine is still creating the backup file. So when I'm adding the file into the ZIP file, the file is still incomplete leading to the error described. Sorry for assuming that it was a PureZIP problem. I was too quick on it because my time is a little scarse so I imagined lots of things.

Thank you for such a wonderful tool.

Posted: Tue Sep 11, 2007 7:03 pm
by nicolaus
Hi gnozal

I have found a link error with PureZIP.

If you use the "UsePNGdecoder()" from PB and your PureZIP you cant compile the code and it shows this message:
"POLINK: error: Symbol '_inflate_copyright' is multiply defined ('PureZIP_LIB_1_UNICODE:inflatress.obj' and 'ImagePluginPNG:inflatress.obj')"

I think you must channge this in your lib or you ask FRED very friendly that he channge it in PB :lol:

regards,
Nico

[EDIT]
testing with pb 4.1b3 with vista home premium 32 bit

Posted: Wed Sep 12, 2007 12:03 am
by DoubleDutch
This is an old problem.

Posted: Wed Sep 12, 2007 5:39 am
by nicolaus
DoubleDutch wrote:This is an old problem.
Aha, and wat i can do to fix this problem?

Posted: Wed Sep 12, 2007 8:03 am
by gnozal
nicolaus wrote:
DoubleDutch wrote:This is an old problem.
Aha, and wat i can do to fix this problem?
I don't know. Both PureZIP and the PNG codec use ZLIB, hence the warning I guess.
What you could do :
- use another image format / codec
- try some linker options, like FORCE:MULTIPLE
- ask Fred / Freak what to do :wink:

Posted: Wed Sep 12, 2007 3:06 pm
by xgp
Hi!, first of all, congratulations on this very nice libray of yours! Great job!
I want to ask yuo something, is it possible to just use the UnpackMemory function? I mean, i just need to decompress some memory area on a program i am about to finish, but i think that, whenever i use that function, i am also including all the functions that exist in the library?.

I am basing my sentence because, so far, my program weights ~110kb, but after implementing the "PureZIP_UnpackMemory" it grows to ~134kb.
I know, the extra size nowadays have little importance, but, out of just curiosity, i would like to know some more about this case.

Without anything more to say, Regards and keep you up with the good work so far!

xgp

Posted: Wed Sep 12, 2007 3:13 pm
by gnozal
xgp wrote:I want to ask yuo something, is it possible to just use the UnpackMemory function? I mean, i just need to decompress some memory area on a program i am about to finish, but i think that, whenever i use that function, i am also including all the functions that exist in the library?.
If you don't need the ZIP functions, try using the zlib static library directly (available on zlib site for example).

Code: Select all

Import "zlib.lib"
  ZLIBCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_compress@16"
  ZLIBUnCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_uncompress@16"
EndImport
Or you could use the genuine PB pack functions ...

Posted: Wed Sep 12, 2007 3:18 pm
by xgp
Wow, quick response!
I've tested, but i am afraid the size grows the same!

Posted: Wed Sep 12, 2007 3:24 pm
by gnozal
xgp wrote:Wow, quick response!
I've tested, but i am afraid the size grows the same!
Well, then it seems like PB links all the static library, and not only the necessary functions.
Maybe if you extract the .obj files (POLIB /EXPLODE ZLIB.LIB) from the .lib and then try to import the .obj files (compress.obj + uncompr.obj + ...?), it would work ?

Posted: Wed Sep 12, 2007 5:52 pm
by xgp
gnozal wrote:Well, then it seems like PB links all the static library, and not only the necessary functions.
Maybe if you extract the .obj files (POLIB /EXPLODE ZLIB.LIB) from the .lib and then try to import the .obj files (compress.obj + uncompr.obj + ...?), it would work ?
Possibly i am doing something wrong, but at the end, i got the pretty much the size as if i were importing the whole .lib. I guess then, there's nothing to do against it.

Here's how i've done:

Code: Select all

POLIB /EXPLODE zlibstat.lib
Then, on the .pb file, i had to keep importing other .obj files because of the "unresolved externanl symbol ..." error.

Code: Select all

Import "inflate.obj"
EndImport
Import "inftrees.obj"
EndImport
Import "adler32.obj"
EndImport
Import "crc32.obj"
EndImport
Import "zutil.obj"
EndImport
Import "inffas32.obj"
EndImport
Import "uncompr.obj"
  ZLIBUnCompress(*DestBuffer, *DestBufferLen, *SourceBuffer, SourceBufferLen.l) As "_uncompress@16" 
EndImport
I am doing something wrong? I am uncertain about this because this was the first time i played with import and .lib or .obj files.

Posted: Thu Sep 13, 2007 7:50 am
by gnozal
xgp wrote:Possibly i am doing something wrong, but at the end, i got the pretty much the size as if i were importing the whole .lib. I guess then, there's nothing to do against it.
Probably not.
There is one thing though : if you know C, I guess you could try to create a new library by compiling only the compress / uncompress sources.
xgp wrote:I am doing something wrong? I am uncertain about this because this was the first time i played with import and .lib or .obj files.
No, seems good to me.

Posted: Tue Sep 18, 2007 7:16 pm
by Micko
hi gnozal
take a look here please!http://www.purebasic.fr/french/viewtopic.php?t=7167

Posted: Fri Sep 28, 2007 4:54 pm
by Micko
Gnozal can purezip support an other archive format ? like ace, tar... or just zip archive