[bug_fixed] Delphi5 & MySql5
Moderators: EgonHugeist, mdaems
[bug_fixed] Delphi5 & MySql5
Hi! I'm a new member and I'm no expert in delphi.
I have a problem to install ZEOSDBO-6.6.0-beta on delphi5
I have read some topics on problem install and I've tried to follows the some steps but I've this problem.
I try to compile the:
ZCore --> compiled
ZParseSql --> compiled
ZPlain --> Errors -->
ZPlainPostgreSql8.pas(279):Undeclared identifier: 'PLongword'
the code is:
TPQescapeByteaConn =function(Handle: PPGconn;const from:pchar;from_length:longword;to_lenght:PLongword):PChar;cdecl;
ZDbc --> Same Errors
ZTestFramework --> Same Errors
What can I do ?
Waiting for your help, thank you.
Ila
p.s. Sorry for my english
I have a problem to install ZEOSDBO-6.6.0-beta on delphi5
I have read some topics on problem install and I've tried to follows the some steps but I've this problem.
I try to compile the:
ZCore --> compiled
ZParseSql --> compiled
ZPlain --> Errors -->
ZPlainPostgreSql8.pas(279):Undeclared identifier: 'PLongword'
the code is:
TPQescapeByteaConn =function(Handle: PPGconn;const from:pchar;from_length:longword;to_lenght:PLongword):PChar;cdecl;
ZDbc --> Same Errors
ZTestFramework --> Same Errors
What can I do ?
Waiting for your help, thank you.
Ila
p.s. Sorry for my english
Here goes the patch:
Code: Select all
Index: ZCompatibility.pas
===================================================================
--- ZCompatibility.pas (revision 174)
+++ ZCompatibility.pas (working copy)
@@ -93,6 +93,7 @@
PCardinal = ^Cardinal;
PInt64 = ^Int64;
PPChar = ^PChar;
+ PLongWord = ^LongWord;
{$ENDIF}
PWord = ^Word;
hehe! yep, that's easy
I forgetted that I have delphi 5 installed. Well, to zeos compile and run on D5, it's needed one thing more.
In ZAbstractRODataset.pas, line 869, there's a call to ApplicationHandleException, defined at D7 in Classes.pas as follows:
ApplicationHandleException: procedure (Sender: TObject) of object = nil;
Yep, an empty procedure. I was not familiar to that procedure, but know that Forms.pas have a Application.HandleException defined. So, looking in forms.pas (D7), at creator of TApplication object, we have:
if not Assigned(Classes.ApplicationHandleException) then
Classes.ApplicationHandleException := HandleException;
Then, the mistery if over
What is better, simulate an ApplicationHandleException in ZCompatibility.pas, inside IFDEFs, only for D5 and below, or link ZAbstractRODataset directly to Application.HandleException, in forms.pas?
You decide
I forgetted that I have delphi 5 installed. Well, to zeos compile and run on D5, it's needed one thing more.
In ZAbstractRODataset.pas, line 869, there's a call to ApplicationHandleException, defined at D7 in Classes.pas as follows:
ApplicationHandleException: procedure (Sender: TObject) of object = nil;
Yep, an empty procedure. I was not familiar to that procedure, but know that Forms.pas have a Application.HandleException defined. So, looking in forms.pas (D7), at creator of TApplication object, we have:
if not Assigned(Classes.ApplicationHandleException) then
Classes.ApplicationHandleException := HandleException;
Then, the mistery if over
What is better, simulate an ApplicationHandleException in ZCompatibility.pas, inside IFDEFs, only for D5 and below, or link ZAbstractRODataset directly to Application.HandleException, in forms.pas?
You decide
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi gto,
Do you want to take care of this problem? Tell us if you don't. I'll accept your patch ASAP after a compatibility test in D7 and Lazarus.
Please check where I have IFDEFed other pointer variable types for VER130 (grep VER130 shows them all, I think)
I think we better solve this in ZCompatibility whenever possible. Then we can let it die in case we stop supporting D5. Do you use Lazarus as well? Just to make sure this fix does not fail on Lazarus.
See this lines in ZEOS.inc:
Doesn't you fix redeclare PLongWord? Or does that not cause an error?
BTW. Do you know the version naming schedule for fpc? Is there a parallel for VER130, VER140,...
Do you want to take care of this problem? Tell us if you don't. I'll accept your patch ASAP after a compatibility test in D7 and Lazarus.
Please check where I have IFDEFed other pointer variable types for VER130 (grep VER130 shows them all, I think)
I think we better solve this in ZCompatibility whenever possible. Then we can let it die in case we stop supporting D5. Do you use Lazarus as well? Just to make sure this fix does not fail on Lazarus.
See this lines in ZEOS.inc:
Code: Select all
{$IFDEF FPC}
{$DEFINE VER130BELOW}
{$DEFINE VER140BELOW}
{$ENDIF}
BTW. Do you know the version naming schedule for fpc? Is there a parallel for VER130, VER140,...
Well, why not
I don't use lazarus/FPC but I'll download it and test, then make the patch.
AFAIK, redeclarations don't cause problems, at least in delphi. The compiler will use the "nearest" declaration it finds. This means if you declare a PLongWord, in the same unit it's used, as a string, it will be a string. If you remove the declaration, it will become a pointer for a long word again.
Lazarus does not use a versioning style, AFAIK (beauty expression ), only the FPC.
A bit OFF: Mark, can I post the patch for ZSQLMonitor now? I have it here, done and working for the newest SVN branch.
Little Edit: Looking at source now I've seen something like:
This is at ZStreamBlob @ line 107. Isn't the best way to code, but it's a workarround for the problem I've posted up there.
I don't use lazarus/FPC but I'll download it and test, then make the patch.
AFAIK, redeclarations don't cause problems, at least in delphi. The compiler will use the "nearest" declaration it finds. This means if you declare a PLongWord, in the same unit it's used, as a string, it will be a string. If you remove the declaration, it will become a pointer for a long word again.
Lazarus does not use a versioning style, AFAIK (beauty expression ), only the FPC.
A bit OFF: Mark, can I post the patch for ZSQLMonitor now? I have it here, done and working for the newest SVN branch.
Little Edit: Looking at source now I've seen something like:
Code: Select all
try
...
except
{$IFNDEF VER130BELOW}
ApplicationHandleException(Self);
{$ENDIF}
end;
The patches!!!
The following patch is only for optimization. Delphi 5 complained about never used variables and that PQFreeMem procedure (this unit uses directly the "mapped" version from ZPlainPostgreeSQL8.pas). Not needed, but optimization is always welcome, I think.
Working on D5, D7 and lazarus (0.9.20 Win32).
In case I can post my patch for ZSQLMonitor, please update these to SVN, then I'll make other patches only with ZSQLMonitor stuff.
Code: Select all
Index: ZAbstractRODataset.pas
===================================================================
--- ZAbstractRODataset.pas (revision 174)
+++ ZAbstractRODataset.pas (working copy)
@@ -865,8 +865,12 @@
try
OnFilterRecord(Self, Result);
- except
- ApplicationHandleException(Self);
+ except
+ {$IFNDEF VER130BELOW}
+ ApplicationHandleException(Self);
+ {$ELSE}
+ ShowException(ExceptObject, ExceptAddr);
+ {$ENDIF}
end;
CurrentRow := SavedRow;
Code: Select all
Index: ZDbcASAUtils.pas
===================================================================
--- ZDbcASAUtils.pas (revision 174)
+++ ZDbcASAUtils.pas (working copy)
@@ -1108,7 +1110,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := PSingle(sqldata)^;
DT_DOUBLE : Result := PDouble(sqldata)^;
DT_VARCHAR : begin
@@ -1146,7 +1148,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^ <> 0;
DT_UNSSMALLINT : Result := PWord(sqldata)^ <> 0;
DT_INT : Result := PInteger(sqldata)^ <> 0;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^ <> 0;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^ <> 0;
DT_FLOAT : Result := PSingle(sqldata)^ <> 0;
DT_DOUBLE : Result := PDouble(sqldata)^ <> 0;
DT_VARCHAR : begin
@@ -1184,7 +1186,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := Trunc( PSingle(sqldata)^);
DT_DOUBLE : Result := Trunc( PDouble(sqldata)^);
DT_VARCHAR : begin
@@ -1257,7 +1259,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := PSingle(sqldata)^;
DT_DOUBLE : Result := PDouble(sqldata)^;
DT_VARCHAR : begin
@@ -1295,7 +1297,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := PSingle(sqldata)^;
DT_DOUBLE : Result := PDouble(sqldata)^;
DT_VARCHAR : begin
@@ -1333,7 +1335,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := Trunc( PSingle(sqldata)^);
DT_DOUBLE : Result := Trunc( PDouble(sqldata)^);
DT_VARCHAR : begin
@@ -1371,7 +1373,7 @@
DT_SMALLINT : Result := PSmallint(sqldata)^;
DT_UNSSMALLINT : Result := PWord(sqldata)^;
DT_INT : Result := PInteger(sqldata)^;
- {$IFNDEF VER130}DT_UNSINT : Result := PLongWord(sqldata)^;{$ENDIF}
+ DT_UNSINT : Result := PLongWord(sqldata)^;
DT_FLOAT : Result := Trunc( PSingle(sqldata)^);
DT_DOUBLE : Result := Trunc( PDouble(sqldata)^);
DT_VARCHAR : begin
@@ -1432,7 +1434,7 @@
DT_SMALLINT : Result := IntToStr( PSmallint(sqldata)^);
DT_UNSSMALLINT : Result := IntToStr( PWord(sqldata)^);
DT_INT : Result := IntToStr( PInteger(sqldata)^);
- {$IFNDEF VER130}DT_UNSINT : Result := IntToStr( PLongWord(sqldata)^);{$ENDIF}
+ DT_UNSINT : Result := IntToStr( PLongWord(sqldata)^);
DT_FLOAT : Result := FloatToStr( PSingle(sqldata)^);
DT_DOUBLE : Result := FloatToStr( PDouble(sqldata)^);
DT_VARCHAR : SetString( Result, PChar( @PZASASQLSTRING( sqlData).data[0]),
Code: Select all
Index: ZPlainFirebirdInterbaseConstants.pas
===================================================================
--- ZPlainFirebirdInterbaseConstants.pas (revision 174)
+++ ZPlainFirebirdInterbaseConstants.pas (working copy)
@@ -41,6 +41,9 @@
{$I ZPlain.inc}
+uses
+ ZCompatibility;
+
const
IBLocalBufferLength = 512;
IBBigLocalBufferLength = IBLocalBufferLength * 2;
@@ -503,7 +506,7 @@
{ & text types only }
sqllen: Short; { length of data area }
sqldata: PChar; { address of data }
- sqlind: {$IFNDEF VER130}PSmallInt{$ELSE}^SmallInt{$ENDIF}; { address of indicator }
+ sqlind: PSmallInt; { address of indicator }
{ variable }
sqlname_length: Short; { length of sqlname field }
{ name of field, name length + space for NULL }
Code: Select all
Index: ZPlainMysqlConstants.pas
===================================================================
--- ZPlainMysqlConstants.pas (revision 174)
+++ ZPlainMysqlConstants.pas (working copy)
@@ -50,6 +50,9 @@
{$I ZPlain.inc}
+uses
+ ZCompatibility;
+
const
{$IFNDEF MYSQL_STRICT_DLL_LOADING}
WINDOWS2_DLL_LOCATION = 'libmysql.dll';
@@ -402,13 +405,13 @@
PMYSQL_BIND2 = ^MYSQL_BIND2;
MYSQL_BIND2 = record
- length: {$IFNDEF VER130}PLongInt{$ELSE}^LongInt{$ENDIF};
- is_null: {$IFNDEF VER130}PByte{$ELSE}^Byte{$ENDIF};
+ length: PLongInt;
+ is_null: PByte;
buffer: PChar;
- error: {$IFNDEF VER130}PByte{$ELSE}^Byte{$ENDIF};
+ error: PByte;
buffer_type: TMysqlFieldTypes;
buffer_length: LongInt;
- row_ptr: {$IFNDEF VER130}PByte{$ELSE}^Byte{$ENDIF};
+ row_ptr: PByte;
offset: LongInt;
length_value: LongInt;
param_number: Cardinal;
Code: Select all
Index: ZPlainPostgreSqlDriver.pas
===================================================================
--- ZPlainPostgreSqlDriver.pas (revision 174)
+++ ZPlainPostgreSqlDriver.pas (working copy)
@@ -395,8 +395,6 @@
{** Implements a driver for PostgreSQL 8.1 }
TZPostgreSQL8PlainDriver = class(TZAbstractObject, IZPlainDriver,IZPostgreSQLPlainDriver)
- private
- procedure PQFreeMem(ptr: Pointer);
public
constructor Create;
@@ -985,13 +983,11 @@
end;
function TZPostgreSQL8PlainDriver.DecodeBYTEA(value: string): string;
-var decoded,dest:pchar;
+var decoded:pchar;
len:Longword;
- von,nach:string;
begin
- decoded:=ZPlainPostgreSql8.PQunescapeBytea(pansichar(value),@len);
+ decoded:=ZPlainPostgreSql8.PQUnescapeBytea(pansichar(value),@len);
SetLength(result,len);
- dest:=pchar(result);
if (len > 0) then Move(decoded^,result[1],len);
ZPlainPostgreSql8.PQFreemem(decoded);
end;
@@ -1277,11 +1273,6 @@
Result := ZPlainPostgreSql8.lo_open(Handle, ObjId, Mode);
end;
-procedure TZPostgreSQL8PlainDriver.PQFreeMem(ptr: Pointer);
-begin
- ZPlainPostgreSql8.PQFreemem(ptr);
-end;
-
function TZPostgreSQL8PlainDriver.PutBytes(Handle: PZPostgreSQLConnect;
Buffer: PChar; Length: Integer): Integer;
begin
In case I can post my patch for ZSQLMonitor, please update these to SVN, then I'll make other patches only with ZSQLMonitor stuff.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
This patches have been committed to SVN Testing branch (rev 177). If you can, please check if it works now. (BTW, changed ZStreamBlob as well)
@gto: Concerning your patch forZSQLMonitor : If we commit it now to Testing branch it would give too much collissions when we want to do bugfixes for 6.6.X (we keep it for 6.7 or whatever next version will be called) My advise : copy your workingversion apart ans do an SVN update evere two weeks to keep it up to date. Make your patch the day 6.6.x-stable is released. (Send it as an attach, because I had to do the changes above manualy)
Mark
@gto: Concerning your patch forZSQLMonitor : If we commit it now to Testing branch it would give too much collissions when we want to do bugfixes for 6.6.X (we keep it for 6.7 or whatever next version will be called) My advise : copy your workingversion apart ans do an SVN update evere two weeks to keep it up to date. Make your patch the day 6.6.x-stable is released. (Send it as an attach, because I had to do the changes above manualy)
Mark
Right !mdaems wrote:This patches have been committed to SVN Testing branch (rev 177). If you can, please check if it works now. (BTW, changed ZStreamBlob as well)
@gto: Concerning your patch forZSQLMonitor : If we commit it now to Testing branch it would give too much collissions when we want to do bugfixes for 6.6.X (we keep it for 6.7 or whatever next version will be called) My advise : copy your workingversion apart ans do an SVN update evere two weeks to keep it up to date. Make your patch the day 6.6.x-stable is released. (Send it as an attach, because I had to do the changes above manualy)
Mark
Updated here, everithing works. I'll keep my SVN folder always up to date. =)