[fpc-pascal] Re: Mipsel compilation: changing elf flags?!

2013-04-22 Thread Reinier Olislagers
On 21-4-2013 19:54, Mark Morgan Lloyd wrote:
 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. 
Correct. The forum thread links to a thread re failing executables using
gdd where it appears that (certain?) 2.4 and 2.6 kernels did *not* want
the MIPS flag set.

 If OP could identify the correct parameter for ld
 it might be possible to use fpc's -k option.
 

Ok, so we have to dig into ld. Thanks; will pass it on.

Thanks, Mark!
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Michael Van Canneyt



On Sun, 21 Apr 2013, Mattias Gaertner wrote:


Hi,

On one of my Linux machines GetCurrentDir returns '', when the working
directory is a samba share.
Is this a feature or a bug?


It can happen. The linux kernel returns an empty cwd in some cases.
The FPC code tries to work its way up from '.' in such a case.

I just tried, but it gives a correct result in my case.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Mattias Gaertner
On Mon, 22 Apr 2013 09:04:30 +0200 (CEST)
Michael Van Canneyt mich...@freepascal.org wrote:

 
 
 On Sun, 21 Apr 2013, Mattias Gaertner wrote:
 
  Hi,
 
  On one of my Linux machines GetCurrentDir returns '', when the working
  directory is a samba share.
  Is this a feature or a bug?
 
 It can happen. The linux kernel returns an empty cwd in some cases.
 The FPC code tries to work its way up from '.' in such a case.
 
 I just tried, but it gives a correct result in my case.

Maybe as fallback it can use the environment variable PWD?

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said:
  The FPC code tries to work its way up from '.' in such a case.
  
  I just tried, but it gives a correct result in my case.
 
 Maybe as fallback it can use the environment variable PWD?

No. That would only be valid right after startup, and doesn't change
when you chdir in the program.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Mipsel compilation: changing elf flags?!

2013-04-22 Thread Mark Morgan Lloyd

Reinier Olislagers wrote:


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. 

Correct. The forum thread links to a thread re failing executables using
gdd where it appears that (certain?) 2.4 and 2.6 kernels did *not* want
the MIPS flag set.


If OP could identify the correct parameter for ld
it might be possible to use fpc's -k option.



Ok, so we have to dig into ld. Thanks; will pass it on.


There might be something in 
http://wiki.lazarus.freepascal.org/Native_MIPS_Systems that will help 
since it includes the command lines I used for the cross-compilers etc., 
finding out what variants of binutils could be built was the hardest part.


I was hoping to be able to test the MIPS etc. targets on a fairly 
regular basis, but Qemu (running on the systems available here) quite 
simply turned out to not be fast enough, and I'm struggling to find time 
to revisit getting an SGI system running for big-endian work.


--
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


[fpc-pascal] Windows backslash

2013-04-22 Thread Mattias Gaertner
Hi,

It seems fpc converts under Windows \^ to ^.
See here:

http://bugs.freepascal.org/view.php?id=23294

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] Windows backslash

2013-04-22 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said:
 It seems fpc converts under Windows \^ to ^.
 See here:
 
 http://bugs.freepascal.org/view.php?id=23294
 
 Is this a feature or a bug?

No idea, but IIRC ^ is the escape char on Windows NT cmdline shell (like \ in 
C).

So ^\ would be a non-path \   ?!? 

I don't know how deep it goes and if it is cmd.exe only.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Windows backslash

2013-04-22 Thread Mattias Gaertner
On Mon, 22 Apr 2013 09:35:19 +0200 (CEST)
mar...@stack.nl (Marco van de Voort) wrote:

 In our previous episode, Mattias Gaertner said:
  It seems fpc converts under Windows \^ to ^.
  See here:
  
  http://bugs.freepascal.org/view.php?id=23294
  
  Is this a feature or a bug?
 
 No idea, but IIRC ^ is the escape char on Windows NT cmdline shell (like \ in 
 C).
 
 So ^\ would be a non-path \   ?!? 
 
 I don't know how deep it goes and if it is cmd.exe only.

C:\Users\^-^\AppData is converted to C:\Users^-^\AppData.

If ^ is the escape character then it is strange that ^\ is kept and the
\^ is not.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Michael Van Canneyt



On Mon, 22 Apr 2013, Marco van de Voort wrote:


In our previous episode, Mattias Gaertner said:

The FPC code tries to work its way up from '.' in such a case.

I just tried, but it gives a correct result in my case.


Maybe as fallback it can use the environment variable PWD?


No. That would only be valid right after startup, and doesn't change
when you chdir in the program.


+1

Michael.
___
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 Thread LacaK

Toru Takubo  wrote / napísal(a):

Hi Dmitry,

Thank you very much for your advice. I am sure your
code should work, but unfortunately I can not modify
the existing stored procedures.

I will explain what I have been trying so far.
Suppose you are using the following stored procedure,

--
CREATE procedure [dbo].[IncValue]

  @Param int OUTPUT

AS

SET NOCOUNT ON

set @Param = @Param + 1

return 100
--


The original program uses TADOStoredProc in Delphi 7,
which is very easy to handle stored procedure.
How to use it is like this:

var
  r,i: Integer;
  DBP: TADOStoredProc;
begin
...
   DBP.ProcedureName:='IncValue';
   DBP.Parameters.Refresh;
   DBP.Parameters.ParamValues['@Param']:=3; //set @Param as 3
   DBP.ExecProc;
   r:=DBP.Parameters.ParamValues['@RETURN_VALUE']; //got r=100, OK!
   i:=DBP.Parameters.ParamValues['@Param']; //got i=4, incremented OK!





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.

Your program is ok from your point of view ;-))


2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter.
TMSSQLConnection does not support handling of return status and output 
parameters of stored procedures

Theoretically it can be added, but it will complicate things ;-)

3. TSQLQuery should be able to handle OUTPUT parameter, but currently 
a bug exists.



it is not a bug in TSQLQuery, but a missing feature in TMSSQLConnection

-Laco.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: How can retrive value from OUT parameter?

2013-04-22 Thread Reinier Olislagers
On 22-4-2013 10:06, LacaK wrote:
 Toru Takubo  wrote / napísal(a):
 2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter.
 TMSSQLConnection does not support handling of return status and output
 parameters of stored procedures
 Theoretically it can be added, but it will complicate things ;-)

Thanks Laco, updated
http://wiki.lazarus.freepascal.org/mssqlconn
for reference
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SqlDB vs Zeos: TDataset.FieldDefs[].Size

2013-04-22 Thread LacaK

Graeme Geldenhuys  wrote / napísal(a):

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.
  

Yes like in case of TField, where is (for ftString):
Size: max.length in characters used in f.e. DB-aware controls
DataSize: max.length in bytes used f.e. for allocating buffer size in record


 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.

  

It is known pain, that causes either:
A.) you have enought long buffer, but then DB-aware MaxLength is incorrect
or
B.) you have correct MaxLength, but data are truncated

It leads me to thinking, that there is need for extend TFieldDef with 
DataSize just like in TField
(and make DataSize independent from Size ... now are they related: 
DataSize:=Size+1 ... so for SBCS it can be as now and for Unicede 
encodings it can be fe: DataSize:=Size*4+1;)


-Laco.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Henry Vermaak
On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote:
 On Mon, 22 Apr 2013, Marco van de Voort wrote:
 In our previous episode, Mattias Gaertner said:
 The FPC code tries to work its way up from '.' in such a case.
 
 I just tried, but it gives a correct result in my case.
 
 Maybe as fallback it can use the environment variable PWD?
 
 No. That would only be valid right after startup, and doesn't change
 when you chdir in the program.
 
 +1

I think that readlink on /proc/self/cwd should work?

Henry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Michael Van Canneyt



On Mon, 22 Apr 2013, Henry Vermaak wrote:


On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote:

On Mon, 22 Apr 2013, Marco van de Voort wrote:

In our previous episode, Mattias Gaertner said:

The FPC code tries to work its way up from '.' in such a case.

I just tried, but it gives a correct result in my case.


Maybe as fallback it can use the environment variable PWD?


No. That would only be valid right after startup, and doesn't change
when you chdir in the program.


+1


I think that readlink on /proc/self/cwd should work?


That is what the kernel getcwd returns.
Sometimes this is empty.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetCurrentDir

2013-04-22 Thread Mark Morgan Lloyd

Henry Vermaak wrote:

On Mon, Apr 22, 2013 at 09:57:06AM +0200, Michael Van Canneyt wrote:

On Mon, 22 Apr 2013, Marco van de Voort wrote:

In our previous episode, Mattias Gaertner said:

The FPC code tries to work its way up from '.' in such a case.

I just tried, but it gives a correct result in my case.

Maybe as fallback it can use the environment variable PWD?

No. That would only be valid right after startup, and doesn't change
when you chdir in the program.

+1


I think that readlink on /proc/self/cwd should work?


Could be problematic if the share is in a form that the kernel can't parse.

--
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


[fpc-pascal] Re: ppcjvm linking jar

2013-04-22 Thread leledumbo
Just create jar file the usual way. However, you'll need to give FPC-JVM RTL
classes as well (those in org.freepascal namespace)



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/ppcjvm-linking-jar-tp5714263p5714282.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: fcl-stl in 2.6.2 packaged release (not source code)

2013-04-22 Thread leledumbo
 Generics are less advanced in 2.6 compared to trunk, so most generic
changes 
are not merged back atm. 

Yes, but 2.6.0 and 2.6.2 sources contain fcl-stl source, and it can be
compiled with either.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-stl-in-2-6-2-packaged-release-not-source-code-tp5714234p5714283.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: fcl-stl in 2.6.2 packaged release (not source code)

2013-04-22 Thread Sven Barth
Am 22.04.2013 11:24 schrieb leledumbo leledumbo_c...@yahoo.co.id:

  Generics are less advanced in 2.6 compared to trunk, so most generic
 changes
 are not merged back atm.

 Yes, but 2.6.0 and 2.6.2 sources contain fcl-stl source, and it can be
 compiled with either.

Compiled: yes. Linked: not so much. The problem is the nested enumerator of
TVector which isn't handled correctly by a pre-trunk compiler. And all
other fcl-stl depend on TVector some way or the other...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: fcl-stl in 2.6.2 packaged release (not source code)

2013-04-22 Thread Marco van de Voort
In our previous episode, leledumbo said:
 Yes, but 2.6.0 and 2.6.2 sources contain fcl-stl source, and it can be
 compiled with either.

There is a reason why 2.6.x doesn't compile and package fcl-stl. Sleeping
source is considered unsupported.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] How to detect connection status of a socket

2013-04-22 Thread Xiangrong Fang
Hi All,

I am writing a redis client in fpc and found that even when the connection
is closed by server (via redis CLIENT KILL),  send and receive can still be
done without error.  i.e.:

- fpsend returns the number of bytes sent
- fprecv returns 0 (but NOT -1, which indicate a detectable error, as per
the document)

I also checked socketerror after send/recv, no error is reported.

How do I tell if a socket is still connected or not?

Thanks
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to detect connection status of a socket

2013-04-22 Thread Marco van de Voort
In our previous episode, Xiangrong Fang said:
 I am writing a redis client in fpc and found that even when the connection
 is closed by server (via redis CLIENT KILL),

I don't know the redis protocol is, but CLIENT KILL sounds like redis
protocol, while you are trying to detect disconnect at socket level. And is
your socket layer really connection oriented ?

IOW does the remote server really actively close the socket?

Maybe stracing the application during a disconnect event might yield some
more information.

 How do I tell if a socket is still connected or not?

Limit the timeout time (some socketoption or ioctl iirc, search the web),
send something, and wait the timeout time.  Then read something.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to detect connection status of a socket

2013-04-22 Thread Michael Schnell

On 04/22/2013 02:23 PM, Xiangrong Fang wrote:


How do I tell if a socket is still connected or not?


The connected State of a TCP/IP socket is a rather complex issue.

A TCP IP connection is either on or off. if it gets disconnected it is 
dead and can't be reactivated but by a new open.


As long as no event happens to one of the sites, the socket is esteemed 
connected by this site. This does not mean that the other site thinks 
the same


Possible events after a successful open communication events are
 - data read (- stays open)
 - write acknowledge (- stays open)
 - write timeout (socked is forced close)
 - close request from the other site (- socket close)
 - close request by user (- socket close)

If there is just no communication, the socket stays open forever.

-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to detect connection status of a socket

2013-04-22 Thread Xiangrong Fang
2013/4/22 Marco van de Voort mar...@stack.nl

 In our previous episode, Xiangrong Fang said:
  I am writing a redis client in fpc and found that even when the
 connection
  is closed by server (via redis CLIENT KILL),

 I don't know the redis protocol is, but CLIENT KILL sounds like redis
 protocol, while you are trying to detect disconnect at socket level. And is
 your socket layer really connection oriented ?


Yes, it is redis protocol.  I can only be sure that it is TCP based.


 IOW does the remote server really actively close the socket?

 Maybe stracing the application during a disconnect event might yield some
 more information.


I will study stracing if necessary. But will simple netstat show the
status of a socket?


  How do I tell if a socket is still connected or not?

 Limit the timeout time (some socketoption or ioctl iirc, search the web),
 send something, and wait the timeout time.  Then read something.


I am using blocking mode, it just return immediately.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to detect connection status of a socket

2013-04-22 Thread Xiangrong Fang
2013/4/22 Michael Schnell mschn...@lumino.de

 As long as no event happens to one of the sites, the socket is esteemed
 connected by this site. This does not mean that the other site thinks the
 same


OK, as connection status is a complex issue, I try to put it in another
way:

1) fpsend() just pass data to the OS's socket layer without try to
determine if the connection is still alive, right?

2) is it normal that in BLOCK mode, recv returns 0?  i.e. if I receive a 0
from fprecv(), I can say that the connection is closed by the other end (if
there is no detectable socketerror), right?

Thanks.
___
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

2013-04-22 Thread Graeme Geldenhuys
Hi Zaher,

On 2013-04-21 21:42, Zaher Dirkey wrote:
 1 - I have the source from Git, how to start without download the binary?

The only binary I release is for DocView - simply for convenience. With
the source, switch to the 'develop' branch for the latest changes
(normally pretty stable), or stay on 'master' which is now always the
latest released version.


 2 - What the best demo to open and start new project?

fpGUI is IDE independent, but I'll assume you are using Lazarus IDE. In
that case you can look in the 'extras/lazarus_ide/' directory. Load and
install the fpgui_ide.lpk package. This will register a new fpGUI
application type with the IDE.

My preference these days is to simply use code templates. Again, look in
'extras/code_templates/' and merge the lazarus.dci file with your
existing one. You will then have two new code templates.

'fpguiapp' and 'fpguiapp2':  I use these as a starting point for a new
project, but then delete the TMainForm from that unit, as I keep forms
in separate units for larger projects. These code templates (as is) are
very nice for quick test apps though, so everything is contained in a
single unit.

The UI (forms) Designer, just like DocView, can be integrated with any
IDE too. In the case of Lazarus IDE, simply set it up as an External
Tool and use $EdFile() as a parameter value

All this and more are detailed in the docs/INSTALL.txt file.


 ​I have a new project​ i like to build it on fpgui small one :)

If you have any further questions don't hesitate to ask in the
fpgui.support newsgroup. There is a web interface to the newsgroups too.
More details at the following URL:

  http://fpgui.sourceforge.net/support.shtml


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] Re: fcl-stl in 2.6.2 packaged release (not source code)

2013-04-22 Thread leledumbo
 Compiled: yes. Linked: not so much. The problem is the nested enumerator of
TVector which isn't handled correctly by a pre-trunk compiler. And all other
fcl-stl depend on TVector some way or the other...

Hmm... then maybe I'm lucky enough to have it working, at least on 2.6.2. I
only use ghashmap unit though, without enumerator.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-stl-in-2-6-2-packaged-release-not-source-code-tp5714234p5714292.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: fcl-stl in 2.6.2 packaged release (not source code)

2013-04-22 Thread leledumbo
 There is a reason why 2.6.x doesn't compile and package fcl-stl. Sleeping 
source is considered unsupported.

OK, though that's quite weird reason. It's better not to include it at all
then.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fcl-stl-in-2-6-2-packaged-release-not-source-code-tp5714234p5714293.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
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 Thread Toru Takubo

(2013/04/22 17:06), LacaK wrote:

Toru Takubo  wrote / napísal(a):

Hi Dmitry,

Thank you very much for your advice. I am sure your
code should work, but unfortunately I can not modify
the existing stored procedures.

I will explain what I have been trying so far.
Suppose you are using the following stored procedure,

--
CREATE procedure [dbo].[IncValue]

  @Param int OUTPUT

AS

SET NOCOUNT ON

set @Param = @Param + 1

return 100
--


The original program uses TADOStoredProc in Delphi 7,
which is very easy to handle stored procedure.
How to use it is like this:

var
  r,i: Integer;
  DBP: TADOStoredProc;
begin
...
   DBP.ProcedureName:='IncValue';
   DBP.Parameters.Refresh;
   DBP.Parameters.ParamValues['@Param']:=3; //set @Param as 3
   DBP.ExecProc;
   r:=DBP.Parameters.ParamValues['@RETURN_VALUE']; //got r=100, OK!
   i:=DBP.Parameters.ParamValues['@Param']; //got i=4, incremented OK!





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.

Your program is ok from your point of view ;-))


2. TSQLQuery (or TMSSQLConnection) does not support OUTPUT parameter.

TMSSQLConnection does not support handling of return status and output 
parameters of stored procedures
Theoretically it can be added, but it will complicate things ;-)


3. TSQLQuery should be able to handle OUTPUT parameter, but currently a bug 
exists.


it is not a bug in TSQLQuery, but a missing feature in TMSSQLConnection

-Laco.



Hi Laco,

Thank you for your clarification on the above issue.

TMSSQLConnection is newly supported on FPC 2.6 so I don't expect
everything at this moment, but I would appreciate if this feature
could be supported at some future time.

Toru



  
___

fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Windows backslash

2013-04-22 Thread Bart
Fpc ParamStr() handles the \^-^\ part correctly it seems (see bugreport).

Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Windows backslash

2013-04-22 Thread Mattias Gaertner
On Mon, 22 Apr 2013 20:19:43 +0200
Bart bartjun...@gmail.com wrote:

 Fpc ParamStr() handles the \^-^\ part correctly it seems (see bugreport).

'make' writes the right file name. Next thing is FPC and that uses
the wrong path. So either 'make' is lying or FPC alters the path.

In either case it is more a FPC issue than a Lazarus issue. The bug
report should be moved to FPC.

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: ppcjvm linking jar

2013-04-22 Thread Andrew Haines

On 04/22/13 18:39, Andrew Haines wrote:

On 04/22/13 05:22, leledumbo wrote:

Just create jar file the usual way. However, you'll need to give
FPC-JVM RTL
classes as well (those in org.freepascal namespace)






Alright I've figured it out:

jar cfm trange1.jar manifest.txt trange1.class -C 
/usr/local/lib/fpc/2.7.1/units/jvm-java/rtl/ .


then

java -jar trange1.jar works

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] What's the deal with CloseThread?

2013-04-22 Thread Anthony Walter
I was looking at threading support in the System unit and also in the
TThread class.

According to the documentation at
http://www.freepascal.org/docs-html/rtl/system/closethread.html

CloseThread must be called on any thread started with BeginThread. It must
be called after the thread has ended (either by exiting the thread function
or after calling EndThread).

BUT

Looking at the TThread class, which does indeed use BeginThread in
TThread.SysCreate (tthread.inc), I see no corresponding call the
CloseThread. I grepped the entire fpc source tree and found no references
anywhere to any code which calls CloseThread.

So what's the deal? Is the documentation wrong or is there something going
on with TThread I'm not seeing?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal