[fpc-devel]MySQL component installation
I have been trying to install the MySQLLaz package into my Lazarus system. It compiles OK, but on linking I get the following errors: ...undefined reference to `mysql_connect' ...undefined reference to `mysql_create_db' ...undefined reference to `mysql_drop_db' error while linking This is because I have MySQL v4 installed in my Linux distro (SuSE 9.0 or 9.1) and also WinXP, and the library no longer recognises these calls. I pointed out in my tutorial on the WiKi http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusDatabase that changes had to be made to the fpc mysql unit (I used a re-named unit mysql_ver4) when creating simple applications to access late versions of MySQL. Although there are files for access to ver 3.3.2 and ver 4 in subdirectories of ($sourcepath)/fcl/packages/base/mysql, the units in component packages that use mysql have no mechanism to distinguish between the different versions. There is a file in each of the directories called mysql_version, but it only defines the version as a string, and doesn't do anything to modify the function calls. In Version 4 of MySQL the function mysql_connect has been replaced by mysql_real_connect (now with 8 parameters instead of 4); mysql_create_db and mysql_drop_db have been deprecated in favour of issuing explicit SQL statements to perform the same function. I think the mysqldb unit needs to have some conditionals (to take account of MySQL versions) inserted into the section of the implementation dealing with these functions (unless I am missing something that is already there?). I am prepared to have a go at making the necessary modifications, but am reluctant to do so if there is already some mechanism in place to cope with changes in version of MySQL, or if one of the original developers can do it better and faster. We need to be able to define the version of MySQL - usually this is only done at link time by selecting the appropriate library. We are probably going to have to ask the user what version he's using before we compile. Can I have some guidance please from the FPC developers? Regards - Chris -- Christopher Kirkpatrick <[EMAIL PROTECTED]> ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel]CVS Broken?
Hi all, I can't compile the current CVS version? There's a problem in fcl/db/dbase. It won't compile and then a 'make install' fails... -- Joost van der Sluis <[EMAIL PROTECTED]> CNOC ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel]Fixes for interbase/db
> i have some fixes for the database implementation in FCL. Ok, since my development-machine had no internet-connection i've made the patch files myself, but the database.diff wasn't correct. Here are the right ones. -- Joost van der Sluis <[EMAIL PROTECTED]> CNOC Index: database.inc === RCS file: /FPC/CVS/fpc/fcl/db/database.inc,v retrieving revision 1.4 diff -u -r1.4 database.inc --- database.inc 16 Aug 2003 16:42:21 - 1.4 +++ database.inc 24 Jul 2004 16:11:14 - @@ -36,7 +36,8 @@ procedure TDataBase.Loaded; begin - //!! To be implemented. + inherited; + if FOpenAfterRead then SetConnected(true); end; procedure TDataBase.SetConnected (Value : boolean); @@ -45,11 +46,21 @@ If Value<>FConnected then begin If Value then - DoInternalConnect + begin + if csLoading in ComponentState then +begin +FOpenAfterRead := true; +exit; +end + else +DoInternalConnect; + end else begin Closedatasets; DoInternalDisConnect; + if csloading in ComponentState then +FOpenAfterRead := false; end; FConnected:=Value; end; Index: db.pp === RCS file: /FPC/CVS/fpc/fcl/db/db.pp,v retrieving revision 1.18 diff -u -r1.18 db.pp --- db.pp 19 Jul 2004 20:27:28 - 1.18 +++ db.pp 24 Jul 2004 16:15:13 - @@ -1207,6 +1207,7 @@ FOnLogin : TLoginEvent; FParams : TStrings; FSQLBased : Boolean; +FOpenAfterRead : boolean; Function GetDataSetCount : Longint; Function GetDataset(Index : longint) : TDBDataset; procedure SetConnected (Value : boolean); Index: dataset.inc === RCS file: /FPC/CVS/fpc/fcl/db/dataset.inc,v retrieving revision 1.14 diff -u -r1.14 dataset.inc --- dataset.inc 16 Jul 2004 19:37:40 - 1.14 +++ dataset.inc 24 Jul 2004 16:14:23 - @@ -323,9 +323,8 @@ InternalOpen; FBOF:=True; {$ifdef dsdebug} -Writeln ('Setting state to browse'); +Writeln ('Setting buffer size'); {$endif} -SetState(dsBrowse); {$ifdef dsdebug} Writeln ('Setting buffer size'); {$endif} @@ -338,6 +337,10 @@ *) RecalcBufListSize; //SetBufferCount(DefaultBufferCount); +{$ifdef dsdebug} +Writeln ('Setting state to browse'); +{$endif} +SetState(dsBrowse); DoAfterOpen; DoAfterScroll; except Index: interbase.pp === RCS file: /FPC/CVS/fpc/fcl/db/interbase/interbase.pp,v retrieving revision 1.12 diff -u -r1.12 interbase.pp --- interbase.pp 1 May 2004 23:56:59 - 1.12 +++ interbase.pp 24 Jul 2004 16:14:52 - @@ -204,7 +204,6 @@ FRecordSize : word; FCurrentRecord : integer; FSQL : TStrings; -FPrepared: boolean; FIsEOF : boolean; FStatementType : TStatementType; FLoadingFieldDefs: boolean; @@ -416,7 +415,7 @@ DPB := DPB + Chr(isc_dpb_lc_ctype) + Chr(Length(CharSet)) + CharSet; if (DatabaseName = '') then -raise EInterBaseError.Create('TIBDatabase.Open: Database connect string not filled in!'); +raise EInterBaseError.Create('TIBDatabase.Open: Database connect string (DatabaseName) not filled in!'); FIBDatabaseHandle := nil; if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FIBDatabaseHandle, Length(DPB), @DPB[1]) <> 0 then @@ -635,6 +634,11 @@ x : integer; tr : pointer; begin + if FTransaction = nil then +raise EDatabaseError.Create('TIBQuery.Execute: Transaction not set'); + if not FTransaction.Active then +FTransaction.StartTransaction; + tr := FTransaction.GetHandle; for x := 0 to FSQL.Count - 1 do @@ -861,6 +865,10 @@ var tr : pointer; begin + if FTransaction = nil then +raise EDatabaseError.Create('TIBQuery.Execute: Transaction not set'); + if not FTransaction.Active then +FTransaction.StartTransaction; tr := FTransaction.GetHandle; if isc_dsql_execute(@FStatus, @tr, @FStatement, 1, nil) <> 0 then CheckError('TIBQuery.Execute', FStatus);
Re: [fpc-devel]path problems in lastest fpc snap
On 24 jul 2004, at 17:45, [EMAIL PROTECTED] wrote: The snap should contain the latest units!??? It does, but they don't overwrite the units installed by your release (not under *nix anyway, I don't know about the win32 version). As such, the new compiler is probably still trying to use old units. Jonas ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel]path problems in lastest fpc snap
The snap should contain the latest units!??? Jonas Maebe wrote: On 24 jul 2004, at 16:31, [EMAIL PROTECTED] wrote: D:\Lazarus>make make -C lcl all make[1]: Entering directory `D:/Lazarus/lcl' d:/fpc/bin/win32/rm.exe -f units/i386/win32/alllclunits.ppu d:/fpc/bin/win32/ppc386.exe -gl -Fu. -Fuwidgetset -Fiinclude -FUunits/i386/win32 -di386 alllclunits.pp Hint: End of reading config file d:\fpc\bin\win32\fpc.cfg Free Pascal Compiler version 1.9.5 [2004/07/24] for i386 Copyright (c) 1993-2004 by Florian Klaempfl Target OS: Win32 for i386 Compiling alllclunits.pp Compiling filectrl.pp Compiling stdctrls.pp Compiling graphics.pp Fatal: Can't find unit CONTNRS make[1]: *** [alllclunits.ppu] Error 1 make[1]: Leaving directory `D:/Lazarus/lcl' There is no path problem with the compiler. You probably have some release installed, which is why compiler could find the necessary pacakges/fcl units without you specifying where they were. Newer compilers may have an incompatible ppu format, which means they can't use the older compiled units anymore. They will then try to recompile those units, which is what you are seeing above. You can work around the omissions in Lazarus' makefile by adding the appropriate units paths using make OPT="-Fu/path/to/necessary/snapshot/units" Jonas ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel]Fixes for interbase/db
Hi all, i have some fixes for the database implementation in FCL. Changes in interbase.pp: * Removed unused Fprepared * Changed the error message 'database connect string not filled in' to 'database connect string (databasename) not filled in' * Preparestatement and execute now checks if transaction is assigned (in stead of crashing if it isn't) and if the transaction isn't started, it calls starttransaction. Changes in dataset.inc: * In DoInternalOpen the buffers are now initialised before the dataset is set into browse-state Changes in database.inc and db.pp: * If the dataset is created from a stream, the database is opened after the dataset is read completely -- Joost van der Sluis <[EMAIL PROTECTED]> CNOC *** *** 1200,1205 --- 1200,1206 FOnLogin : TLoginEvent; FParams : TStrings; FSQLBased : Boolean; + FOpenAfterRead : boolean; Function GetDataSetCount : Longint; Function GetDataset(Index : longint) : TDBDataset; procedure SetConnected (Value : boolean); *** *** 204,210 FRecordSize : word; FCurrentRecord : integer; FSQL : TStrings; - FPrepared: boolean; FIsEOF : boolean; FStatementType : TStatementType; FLoadingFieldDefs: boolean; --- 204,209 *** *** 416,422 DPB := DPB + Chr(isc_dpb_lc_ctype) + Chr(Length(CharSet)) + CharSet; if (DatabaseName = '') then ! raise EInterBaseError.Create('TIBDatabase.Open: Database connect string not filled in!'); FIBDatabaseHandle := nil; if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FIBDatabaseHandle, Length(DPB), @DPB[1]) <> 0 then --- 415,421 DPB := DPB + Chr(isc_dpb_lc_ctype) + Chr(Length(CharSet)) + CharSet; if (DatabaseName = '') then ! raise EInterBaseError.Create('TIBDatabase.Open: Database connect string (DatabaseName) not filled in!'); FIBDatabaseHandle := nil; if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FIBDatabaseHandle, Length(DPB), @DPB[1]) <> 0 then *** *** 635,640 --- 634,644 x : integer; tr : pointer; begin + if FTransaction = nil then + raise EDatabaseError.Create('TIBQuery.Execute: Transaction not set'); + if not FTransaction.Active then + FTransaction.StartTransaction; + tr := FTransaction.GetHandle; for x := 0 to FSQL.Count - 1 do *** *** 861,866 --- 865,874 var tr : pointer; begin + if FTransaction = nil then + raise EDatabaseError.Create('TIBQuery.Execute: Transaction not set'); + if not FTransaction.Active then + FTransaction.StartTransaction; tr := FTransaction.GetHandle; if isc_dsql_execute(@FStatus, @tr, @FStatement, 1, nil) <> 0 then CheckError('TIBQuery.Execute', FStatus); *** *** 36,42 procedure TDataBase.Loaded; begin ! //!! To be implemented. end; procedure TDataBase.SetConnected (Value : boolean); --- 36,43 procedure TDataBase.Loaded; begin ! inherited; ! if FOpenAfterRead then SetConnected(true); end; procedure TDataBase.SetConnected (Value : boolean); *** *** 45,55 If Value<>FConnected then begin If Value then - DoInternalConnect - else begin Closedatasets; DoInternalDisConnect; end; FConnected:=Value; end; --- 46,66 If Value<>FConnected then begin If Value then begin + if csLoading in ComponentState then + begin + FOpenAfterRead := true; + exit; + end + else + DoInternalConnect; + end else begin Closedatasets; DoInternalDisConnect; + if csloading in ComponentState then + FOpenAfterRead := false; end; FConnected:=Value; end; *** *** 323,331 InternalOpen; FBOF:=True; {$ifdef dsdebug} ! Writeln ('Setting state to browse'); {$endif} - SetState(dsBrowse); {$ifdef dsdebug} Writeln ('Setting buffer size'); {$endif} --- 323,327 InternalOpen; FBOF:=True; {$ifdef dsdebug} ! Writeln ('Setting buffer size'); {$endif} *** *** 338,343 --- 334,343 *) RecalcBufListSize; //SetBufferCount(DefaultBufferCount); + {$ifdef dsdebug} + Writeln ('Setting state to browse'); + {$endif} + SetState(dsBrowse); DoAfterOpen; DoAfterScroll; except
Re: [fpc-devel]path problems in lastest fpc snap
On 24 jul 2004, at 16:31, [EMAIL PROTECTED] wrote: D:\Lazarus>make make -C lcl all make[1]: Entering directory `D:/Lazarus/lcl' d:/fpc/bin/win32/rm.exe -f units/i386/win32/alllclunits.ppu d:/fpc/bin/win32/ppc386.exe -gl -Fu. -Fuwidgetset -Fiinclude -FUunits/i386/win32 -di386 alllclunits.pp Hint: End of reading config file d:\fpc\bin\win32\fpc.cfg Free Pascal Compiler version 1.9.5 [2004/07/24] for i386 Copyright (c) 1993-2004 by Florian Klaempfl Target OS: Win32 for i386 Compiling alllclunits.pp Compiling filectrl.pp Compiling stdctrls.pp Compiling graphics.pp Fatal: Can't find unit CONTNRS make[1]: *** [alllclunits.ppu] Error 1 make[1]: Leaving directory `D:/Lazarus/lcl' There is no path problem with the compiler. You probably have some release installed, which is why compiler could find the necessary pacakges/fcl units without you specifying where they were. Newer compilers may have an incompatible ppu format, which means they can't use the older compiled units anymore. They will then try to recompile those units, which is what you are seeing above. You can work around the omissions in Lazarus' makefile by adding the appropriate units paths using make OPT="-Fu/path/to/necessary/snapshot/units" Jonas ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel]path problems in lastest fpc snap
D:\Lazarus>make make -C lcl all make[1]: Entering directory `D:/Lazarus/lcl' d:/fpc/bin/win32/rm.exe -f units/i386/win32/alllclunits.ppu d:/fpc/bin/win32/ppc386.exe -gl -Fu. -Fuwidgetset -Fiinclude -FUunits/i386/win32 -di386 alllclunits.pp Hint: End of reading config file d:\fpc\bin\win32\fpc.cfg Free Pascal Compiler version 1.9.5 [2004/07/24] for i386 Copyright (c) 1993-2004 by Florian Klaempfl Target OS: Win32 for i386 Compiling alllclunits.pp Compiling filectrl.pp Compiling stdctrls.pp Compiling graphics.pp Fatal: Can't find unit CONTNRS make[1]: *** [alllclunits.ppu] Error 1 make[1]: Leaving directory `D:/Lazarus/lcl' make: *** [lcl] Error 2 D:\Lazarus> ___ fpc-devel maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-devel
[fpc-devel]gdb issue
Hi, i tried to view integer variable value in binary mode using gdb (5.2.1, windows, fpc1010 ) command "p /t i". But it shows nothing. Does anyone else come across this issue or i am doing something wrong?