Browse Source

small changes

Unknown 6 years ago
parent
commit
d74dfe17c5
2 changed files with 14 additions and 4 deletions
  1. 7 1
      Quick.Commons.pas
  2. 7 3
      Quick.Compression.pas

+ 7 - 1
Quick.Commons.pas

@@ -7,7 +7,7 @@
   Author      : Kike Pérez
   Version     : 1.5
   Created     : 14/07/2017
-  Modified    : 19/09/2018
+  Modified    : 14/10/2018
 
   This file is part of QuickLib: https://github.com/exilon/QuickLib
 
@@ -261,6 +261,7 @@ type
   function GetLastInputInfo(var plii: TLastInputInfo): BOOL;stdcall; external 'user32' name 'GetLastInputInfo';
   {$ENDIF}
   function RemoveLastChar(const aText : string) : string;
+  function DateTimeToSQL(aDateTime : TDateTime) : string;
 
 {$IFDEF MSWINDOWS}
 var
@@ -1135,6 +1136,11 @@ begin
   Result := aText.Remove(aText.Length - 1);
 end;
 
+function DateTimeToSQL(aDateTime : TDateTime) : string;
+begin
+  Result := FormatDateTime('YYYYMMDD hh:mm:ss',aDateTime);
+end;
+
 {$IFDEF MSWINDOWS}
 initialization
   try

+ 7 - 3
Quick.Compression.pas

@@ -37,12 +37,16 @@ uses
   System.SysUtils,
   System.ZLib;
 
-  function CompressString(const aStr : string) : string;
+type
+
+  TCompressionLevel = TZCompressionLevel;
+
+  function CompressString(const aStr : string; aLevel : TCompressionLevel = zcDefault) : string;
   function DecompressString(const aStr: string) : string;
 
 implementation
 
-function CompressString(const aStr : string) : string;
+function CompressString(const aStr : string; aLevel : TCompressionLevel = zcDefault) : string;
 var
   strstream : TStringStream;
   zipstream : TStringStream;
@@ -51,7 +55,7 @@ begin
   try
     zipstream := TStringStream.Create('',TEncoding.ANSI);
     try
-      ZCompressStream(strstream, zipstream);
+      ZCompressStream(strstream, zipstream, aLevel);
       zipstream.Position := 0;
       Result := zipstream.DataString;
     finally