Re: [fpc-pascal] SqlDB vs Zeos: TDataset.FieldDefs[].Size
On 2013-04-20 10:11, Ludo Brands wrote: TFieldDef.Size is expressed in bytes. Zeos, IIRC, assumes a conversion from any charset to utf8 could be made. Since UTF8 is up to 4 bytes per char, a VarChar(10) can need up to 40 bytes to be represented in the I assumed it has something to do with Unicode, but because I never specified a text encoding for the database when I created it - this confused me. I would have imagined that there might be two size properties. 1) .Size - which is the same value as specified in the DDL scripts 2) .DataSize - which might be larger than .Size in the case of Unicode encoded database. The problem I have with Zeos, is that I can't limit my text input in GUI applications now... Normally the .Size property would have been used, but now Zeos reports 4x the size, so all varchar(10) fields now look like they can store 40 characters, instead of only 10. Does Zeos have some other property I can use that will match the size given via the DDL scripts? Alternatively I thought of faking the real character size in the tiOPF backend, but I can't be sure what encoding the database is in, so I don't know by what value to divide .Size with. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] fpGUI Toolkit v1.0 release for FPC 2.6.2
fpGUI v1.0 is available I'm glad to announce the 1.0 release of fpGUI. This has been over a years worth of development, so a complete list of changes will be to big to list here. Here are just some highlights: - Improvements to the UI (forms) Designer - Lot of DocView improvements (Bookmark management, Image decoding support in INF files, RichView component improvements etc.) - AggPas integration as an experimental backend. AggPas is a 2D graphics library implemented in 100% Pascal, and includes some amazing features that really enhances the quality of fpGUI's canvas class. - New example apps, and improvements to existing demo apps like Maximus and Debug Server. etc. For more details, run any of the following commands: git log --oneline v0.8..v1.0 (console viewer) or gitk v0.8..v1.0(gui viewer) Downloads - An archived source download of fpGUI, and pre-built binaries for DocView (fpGUI's Documentation Viewer) can be found at the following URL: http://sourceforge.net/projects/fpgui/files/fpGUI/1.0/ ...or clone the source code repository by using any of the following commands: from SourceForge: git clone git://fpgui.git.sourceforge.net/gitroot/fpgui/fpgui from GitHub: git clone git://github.com/graemeg/fpGUI.git or git clone https://github.com/graemeg/fpGUI.git The 'master' branch contains the latest released fpGUI (v1.0), and the 'develop' branch contains the latest development work on fpGUI. Documentation - Pre-built documentation in the highly optimized INF file format (for use with DocView) is also available for download in a single archive, just 1.9MB in size. The documentation archive contains the following help files: - Class documentation for fpGUI Toolkit - The Free Pascal Language Reference - FPC Runtime Library (rtl) help - FPC Free Component Library (fcl) help The download URL is: http://sourceforge.net/projects/fpgui/files/fpGUI/Documentation/ If you want integrated help in your IDE or Programmer Editor of choice, the following URL describes how to do it: http://fpgui.sourceforge.net/docview_ide_integration.shtml For more details, please visit the fpGUI home page: http://fpgui.sourceforge.net Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Statically link library
On 20/apr/2013, at 11:55, Darius Blaszyk dhkblas...@zeelandnet.nl wrote: Hi, I'm linking a C and FPC program but I keep on getting undifined symbols (see example below). Error: Undefined symbol: _strcpy Sofar I have added: {$linklib msvcrt} {$linklib gcc} What other libraries should I add? BTW, I'm compiling the C library with MinGW. You need to instruct fpc to use gcc instead of default ld when you link c/pas code statically. This is because gcc adds many linker flags that are automatically set when you link something but are not set when you call ld directly. I think such issue arises only when compiling statically, can you compile your c library shared? Cheers, Vittorio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Statically link library
In our previous episode, Vittorio Giovara said: {$linklib gcc} What other libraries should I add? BTW, I'm compiling the C library with MinGW. You need to instruct fpc to use gcc instead of default ld when you link c/pas code statically. Fpc can't call gcc. This is because gcc adds many linker flags that are automatically set when you link something but are not set when you call ld directly. FPC can pass extra flags to the linker. Just harvest the flags by compiling a simple program with gcc ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Statically link library
On Sun, Apr 21, 2013 at 2:36 PM, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Vittorio Giovara said: {$linklib gcc} What other libraries should I add? BTW, I'm compiling the C library with MinGW. You need to instruct fpc to use gcc instead of default ld when you link c/pas code statically. Fpc can't call gcc. Well you could manually edit ppas.sh/link.res and substitute 'gcc' to 'ld', and of course adjust all the flags. This is because gcc adds many linker flags that are automatically set when you link something but are not set when you call ld directly. FPC can pass extra flags to the linker. Just harvest the flags by compiling a simple program with gcc Indeed, too bad sometimes you have to link gcc, sometimes gcc_s.1, sometimes stdc++ and so on, depending on target, architecture, operating system and so on... Like I said other time, not really portable, but with little use-case too, so not a big deal, right? Cheers, Vittorio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Mipsel compilation: changing elf flags?!
Reinier Olislagers wrote: See this forum thread: http://lazarus.freepascal.org/index.php/topic,20664.msg119960.html#msg119960 Forum user ocye got mipsel binaries, but the ELF flags apparently need to be changed due to a bug in older Linux kernels. How can this be done? In addition, is there perhaps a compiler switch to manage this? Interesting, there was somebody in (I think) fpc-devel a few months ago with similar problems but we all rather went in circles. Since Lemote appears to be using the compiler OK and since I think I've had it running on (a Qemu emulation of) mipsel, I think that the problem is that /some/ kernel builds are expecting a particular ELF header on /some/ machine types. If OP could identify the correct parameter for ld it might be possible to use fpc's -k option. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpGUI Toolkit v1.0 release for FPC 2.6.2
1 - I have the source from Git, how to start without download the binary? 2 - What the best demo to open and start new project? I have a new project i like to build it on fpgui small one :) On Sat, Apr 20, 2013 at 9:16 PM, Graeme Geldenhuys gra...@geldenhuys.co.ukwrote: fpGUI v1.0 is available I'm glad to announce the 1.0 release of fpGUI. This has been over a years worth of development, so a complete list of changes will be to big to list here. Here are just some highlights: - Improvements to the UI (forms) Designer - Lot of DocView improvements (Bookmark management, Image decoding support in INF files, RichView component improvements etc.) - AggPas integration as an experimental backend. AggPas is a 2D graphics library implemented in 100% Pascal, and includes some amazing features that really enhances the quality of fpGUI's canvas class. - New example apps, and improvements to existing demo apps like Maximus and Debug Server. etc. For more details, run any of the following commands: git log --oneline v0.8..v1.0 (console viewer) or gitk v0.8..v1.0(gui viewer) Downloads - An archived source download of fpGUI, and pre-built binaries for DocView (fpGUI's Documentation Viewer) can be found at the following URL: http://sourceforge.net/projects/fpgui/files/fpGUI/1.0/ ...or clone the source code repository by using any of the following commands: from SourceForge: git clone git://fpgui.git.sourceforge.net/gitroot/fpgui/fpgui from GitHub: git clone git://github.com/graemeg/fpGUI.git or git clone https://github.com/graemeg/fpGUI.git The 'master' branch contains the latest released fpGUI (v1.0), and the 'develop' branch contains the latest development work on fpGUI. Documentation - Pre-built documentation in the highly optimized INF file format (for use with DocView) is also available for download in a single archive, just 1.9MB in size. The documentation archive contains the following help files: - Class documentation for fpGUI Toolkit - The Free Pascal Language Reference - FPC Runtime Library (rtl) help - FPC Free Component Library (fcl) help The download URL is: http://sourceforge.net/projects/fpgui/files/fpGUI/Documentation/ If you want integrated help in your IDE or Programmer Editor of choice, the following URL describes how to do it: http://fpgui.sourceforge.net/docview_ide_integration.shtml For more details, please visit the fpGUI home page: http://fpgui.sourceforge.net Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3 Best Regards Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] The 2.6.2 RPM and Deb archives are still in preparation
Hello All, Some words about me: I'm a pascalist for now more than 25 years. I developped many embedded applications, but I don't feel well putting the hands on the compiler... About The 2.6.2 RPM and Deb archives are still in preparation seen on the the download page about linux/386, can I be useful to the project being a tester ? Mandriva, Mageia and sometimes Ubuntu... But also XP and Vista basic on two laptops. Thank you for this greaaat compiler ! Cheers, Raoul ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] GetCurrentDir
Hi, On one of my Linux machines GetCurrentDir returns '', when the working directory is a samba share. Is this a feature or a bug? Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How can retrive value from OUT parameter?
(2013/04/20 23:06), Marcos Douglas wrote: On Sat, Apr 20, 2013 at 2:47 AM, Toru Takubo tak...@e-parcel.co.jp wrote: (2013/04/19 21:22), Marcos Douglas wrote: (snip) With analogical thinking, I expected that the following might work for TSQLQuery in FPC: var r,i: Integer; DBQ: TSQLQuery; begin ... DBQ.SQL.Text:='IncValue :@Param'; DBQ.Params.CreateParam(ftInteger,'@RETURN_VALUE',ptResult); DBQ.Params.CreateParam(ftInteger,'@Param',ptInputOutput).AsInteger:=3; DBQ.ExecSQL; r:=DBQ.ParamByName('@RETURN_VALUE').AsInteger; //got r=0, NG i:=DBQ.ParamByName('@Param').AsInteger; //got i=3, unchanged NG It does not work as I expected. I read fpc db tutorials and googled, but I could not find the answer for this specific issue. Would anyone have an idea which of the following is the truth? 1. My program is wrong or incomplete. 2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter. 3. TSQLQuery should be able to handle OUTPUT parameter, but currently a bug exists. Hi Toru, You can use SQLdb, MSSQL, StoredProcs and OUTPUT params, without problems... but you have to change a little bit your code. 1- Use a TSQLScript 2- Following your example above, use this SQL: declare @param int = :param exec IncValue @param output select @param as value 3- Call Open instead of ExecSQL You can try Greyhound[1] to abstract this. See the example: (snip) Hi Marcos, As to TSQLScript, it does not seem to have Open method. It may be for execute multiple SQLs which does not return result set. You right, sorry... And I checked your library. It looks simple and nice. But your suggestion is based on the same idea shown by Dimitry in previous mail in this thread, which require modification of existing stored procedures. Unfortunately, I can't modify them. (Thank you) Not so fast. I used your SP, without changes! The tip: https://github.com/mdbs99/Greyhound/blob/master/src/gh_sqldblib.pas#L115 For MSSQL, the TStatementType need to be [stExecProcedure]. The StrToStatementType method is protected so, you need to code a new class... or use Greyhound. Did you test the code as I sent before? Take this example: https://github.com/mdbs99/Greyhound/blob/master/examples/mssql/t1.pas ...and modify it to use the code I sent before. One more thing is that some procedures return both result set and value through OUTPUT parameter. In this case, if I would retrieve OUTPUT parameter as a result set, I must handle multiple result sets. I never tried to use a result set as output parameter before. But you can use another SP to call the real SP just for the application. ;-) Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Thank you again for your advice. Now I understand what you mean. Actually I made a descendant class of TSQLQuery, which override StrToStatementType to force TStatementType on stExecPrcedure, but it did not work then. Your suggestion is that in addition to it, I should create a small sub-query to get OUTPUT parameter as result set. I will try to proceed. On the other hand, I'm wondering if TSQLQuery (or TMSSQLConnection) would natively support OUTPUT parameter and RETURN_VALUE... Toru ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] ppcjvm linking jar
Hi, I am stumped about how to link a program such as the example trange1.pp into a jar file. I've followed the instructions here: http://wiki.freepascal.org/FPC_JVM and the command java -cp /full/path/to/fpcjvm/units/jvm-java/rtl:. trange1 works fine. But I would like to make it a jar file. How? My google-foo has failed me. Thanks, Andrew Haines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How can retrive value from OUT parameter?
On Sun, Apr 21, 2013 at 10:05 PM, Toru Takubo tak...@e-parcel.co.jp wrote: (2013/04/20 23:06), Marcos Douglas wrote: On Sat, Apr 20, 2013 at 2:47 AM, Toru Takubo tak...@e-parcel.co.jp wrote: (2013/04/19 21:22), Marcos Douglas wrote: (snip) With analogical thinking, I expected that the following might work for TSQLQuery in FPC: var r,i: Integer; DBQ: TSQLQuery; begin ... DBQ.SQL.Text:='IncValue :@Param'; DBQ.Params.CreateParam(ftInteger,'@RETURN_VALUE',ptResult); DBQ.Params.CreateParam(ftInteger,'@Param',ptInputOutput).AsInteger:=3; DBQ.ExecSQL; r:=DBQ.ParamByName('@RETURN_VALUE').AsInteger; //got r=0, NG i:=DBQ.ParamByName('@Param').AsInteger; //got i=3, unchanged NG It does not work as I expected. I read fpc db tutorials and googled, but I could not find the answer for this specific issue. Would anyone have an idea which of the following is the truth? 1. My program is wrong or incomplete. 2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter. 3. TSQLQuery should be able to handle OUTPUT parameter, but currently a bug exists. Hi Toru, You can use SQLdb, MSSQL, StoredProcs and OUTPUT params, without problems... but you have to change a little bit your code. 1- Use a TSQLScript 2- Following your example above, use this SQL: declare @param int = :param exec IncValue @param output select @param as value 3- Call Open instead of ExecSQL You can try Greyhound[1] to abstract this. See the example: (snip) Hi Marcos, As to TSQLScript, it does not seem to have Open method. It may be for execute multiple SQLs which does not return result set. You right, sorry... And I checked your library. It looks simple and nice. But your suggestion is based on the same idea shown by Dimitry in previous mail in this thread, which require modification of existing stored procedures. Unfortunately, I can't modify them. (Thank you) Not so fast. I used your SP, without changes! The tip: https://github.com/mdbs99/Greyhound/blob/master/src/gh_sqldblib.pas#L115 For MSSQL, the TStatementType need to be [stExecProcedure]. The StrToStatementType method is protected so, you need to code a new class... or use Greyhound. Did you test the code as I sent before? Take this example: https://github.com/mdbs99/Greyhound/blob/master/examples/mssql/t1.pas ...and modify it to use the code I sent before. One more thing is that some procedures return both result set and value through OUTPUT parameter. In this case, if I would retrieve OUTPUT parameter as a result set, I must handle multiple result sets. I never tried to use a result set as output parameter before. But you can use another SP to call the real SP just for the application. ;-) Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Thank you again for your advice. Now I understand what you mean. Actually I made a descendant class of TSQLQuery, which override StrToStatementType to force TStatementType on stExecPrcedure, but it did not work then. Your suggestion is that in addition to it, I should create a small sub-query to get OUTPUT parameter as result set. You need to override StrToStatementType method of TMSSQLConnection, not TSQLQuery. The problem is the connection is global to all TSQLQuery instances so, you need to 'save' the status before call StrToStatementType to restore after. The idea to create a SP to call the real SP that have OUTPUT parameters is to facilitate the integration with MSSQL... but I never needed to do this before. I will try to proceed. On the other hand, I'm wondering if TSQLQuery (or TMSSQLConnection) would natively support OUTPUT parameter and RETURN_VALUE... Well, even using Delphi (4~7) I never used RETURN_VALUE. I always used MSSQL but I never needed this feature. Did you try Greyhound? Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How can retrive value from OUT parameter?
(2013/04/22 10:46), Marcos Douglas wrote: On Sun, Apr 21, 2013 at 10:05 PM, Toru Takubo tak...@e-parcel.co.jp wrote: (2013/04/20 23:06), Marcos Douglas wrote: On Sat, Apr 20, 2013 at 2:47 AM, Toru Takubo tak...@e-parcel.co.jp wrote: (2013/04/19 21:22), Marcos Douglas wrote: (snip) With analogical thinking, I expected that the following might work for TSQLQuery in FPC: var r,i: Integer; DBQ: TSQLQuery; begin ... DBQ.SQL.Text:='IncValue :@Param'; DBQ.Params.CreateParam(ftInteger,'@RETURN_VALUE',ptResult); DBQ.Params.CreateParam(ftInteger,'@Param',ptInputOutput).AsInteger:=3; DBQ.ExecSQL; r:=DBQ.ParamByName('@RETURN_VALUE').AsInteger; //got r=0, NG i:=DBQ.ParamByName('@Param').AsInteger; //got i=3, unchanged NG It does not work as I expected. I read fpc db tutorials and googled, but I could not find the answer for this specific issue. Would anyone have an idea which of the following is the truth? 1. My program is wrong or incomplete. 2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter. 3. TSQLQuery should be able to handle OUTPUT parameter, but currently a bug exists. Hi Toru, You can use SQLdb, MSSQL, StoredProcs and OUTPUT params, without problems... but you have to change a little bit your code. 1- Use a TSQLScript 2- Following your example above, use this SQL: declare @param int = :param exec IncValue @param output select @param as value 3- Call Open instead of ExecSQL You can try Greyhound[1] to abstract this. See the example: (snip) Hi Marcos, As to TSQLScript, it does not seem to have Open method. It may be for execute multiple SQLs which does not return result set. You right, sorry... And I checked your library. It looks simple and nice. But your suggestion is based on the same idea shown by Dimitry in previous mail in this thread, which require modification of existing stored procedures. Unfortunately, I can't modify them. (Thank you) Not so fast. I used your SP, without changes! The tip: https://github.com/mdbs99/Greyhound/blob/master/src/gh_sqldblib.pas#L115 For MSSQL, the TStatementType need to be [stExecProcedure]. The StrToStatementType method is protected so, you need to code a new class... or use Greyhound. Did you test the code as I sent before? Take this example: https://github.com/mdbs99/Greyhound/blob/master/examples/mssql/t1.pas ...and modify it to use the code I sent before. One more thing is that some procedures return both result set and value through OUTPUT parameter. In this case, if I would retrieve OUTPUT parameter as a result set, I must handle multiple result sets. I never tried to use a result set as output parameter before. But you can use another SP to call the real SP just for the application. ;-) Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Thank you again for your advice. Now I understand what you mean. Actually I made a descendant class of TSQLQuery, which override StrToStatementType to force TStatementType on stExecPrcedure, but it did not work then. Your suggestion is that in addition to it, I should create a small sub-query to get OUTPUT parameter as result set. You need to override StrToStatementType method of TMSSQLConnection, not TSQLQuery. Sorry, my mistake. The problem is the connection is global to all TSQLQuery instances so, you need to 'save' the status before call StrToStatementType to restore after. The idea to create a SP to call the real SP that have OUTPUT parameters is to facilitate the integration with MSSQL... but I never needed to do this before. Thank you for your hint. I will try to proceed. On the other hand, I'm wondering if TSQLQuery (or TMSSQLConnection) would natively support OUTPUT parameter and RETURN_VALUE... Well, even using Delphi (4~7) I never used RETURN_VALUE. I always used MSSQL but I never needed this feature. All my stored procedures use RETURN_VALUE in order to return error code. I think it useful, but I also know everyone has his/her own programming style. Did you try Greyhound? I haven't dig into it yet, but I will try later. Thank you! Toru ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How can retrive value from OUT parameter?
On Sun, Apr 21, 2013 at 11:18 PM, Toru Takubo tak...@e-parcel.co.jp wrote: (snip) I will try to proceed. On the other hand, I'm wondering if TSQLQuery (or TMSSQLConnection) would natively support OUTPUT parameter and RETURN_VALUE... Well, even using Delphi (4~7) I never used RETURN_VALUE. I always used MSSQL but I never needed this feature. All my stored procedures use RETURN_VALUE in order to return error code. I think it useful, but I also know everyone has his/her own programming style. Ok, I will do some test to know if SQLdb handles the RETURN_VALUE parameter. Did you try Greyhound? I haven't dig into it yet, but I will try later. Ok Thank you! Regards, Marcos Douglas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal