Re: [fpc-pascal] Patch/Test BlobSegmentSize was: IBConnection blobsegmentsize irrelevant & performance

2011-11-20 Thread Reinier Olislagers
On 19-11-2011 23:36, Michael Van Canneyt wrote:
> On Sat, 19 Nov 2011, Reinier Olislagers wrote:
>> On 19-11-2011 13:28, Reinier Olislagers wrote: I wonder
>> whether/what changes are required for reading blobs...
> 
> The following function needs adapting:
> 
> function TIBConnection.getMaxBlobSize(blobHandle : TIsc_Blob_Handle)
> : longInt; var iscInfoBlobMaxSegment : byte =
> isc_info_blob_max_segment; blobInfo : array[0..50] of byte;
> 
> begin if isc_blob_info(@Fstatus[0], @blobHandle, 
> sizeof(iscInfoBlobMaxSegment), pchar(@iscInfoBlobMaxSegment), 
> sizeof(blobInfo) CheckError('isc_blob_info', FStatus); if blobInfo[0]
> = isc_info_blob_max_segment then begin result :=
> isc_vax_integer(pchar(@blobInfo[3]), 
> isc_vax_integer(pchar(@blobInfo[1]), 2)); end else 
> CheckError('isc_blob_info', FStatus); end;
> 
> You should first check what it returns. I suspect the declared blob 
> segment size.
> 
> Michael.
getMaxBlobSize does indeed return the segment size used when writing
(i.e. 80 by default on pre 2.7.1, 65535 with my patch).

Changed ibconnection.pp:
- remove getMaxBlobSize function
- use MAXBLOBSEGMENTSIZE (65535) when reading

Tested it with existing blobs written in 80 byte and 65535 byte
segments. Works; the returned value matches what was written in the
first place:
  while FQuery.EOF=false do
  begin
if FQuery.FieldByName('BLOBCOL').AsString <> RecordText then writeln
('Error reading record');;
FQuery.Next;
  end;

Patch attached; it applies against 2.7.1.
Please let me know if you want me to open a bug for this...

Thanks,
Reinier
--- d:/cop/t/ibconnection.ppSun Nov 20 10:20:53 2011
+++ 
C:/Development/Fpc/Source/packages/fcl-db/src/sqldb/interbase/ibconnection.pp   
Sun Nov 20 10:23:10 2011
@@ -65,7 +65,6 @@
 procedure GetFloat(CurrBuff, Buffer : pointer; Size : Byte);
 procedure SetFloat(CurrBuff: pointer; Dbl: Double; Size: integer);
 procedure CheckError(ProcName : string; Status : PISC_STATUS);
-function getMaxBlobSize(blobHandle : TIsc_Blob_Handle) : longInt;
 procedure SetParameters(cursor : TSQLCursor; aTransation : 
TSQLTransaction; AParams : TParams);
 procedure FreeSQLDABuffer(var aSQLDA : PXSQLDA);
 function  IsDialectStored: boolean;
@@ -1249,22 +1248,6 @@
 end;
 
 
-function TIBConnection.getMaxBlobSize(blobHandle : TIsc_Blob_Handle) : longInt;
-var
-  iscInfoBlobMaxSegment : byte = isc_info_blob_max_segment;
-  blobInfo : array[0..50] of byte;
-
-begin
-  if isc_blob_info(@Fstatus[0], @blobHandle, sizeof(iscInfoBlobMaxSegment), 
pchar(@iscInfoBlobMaxSegment), sizeof(blobInfo) - 2, pchar(@blobInfo[0])) <> 0 
then
-CheckError('isc_blob_info', FStatus);
-  if blobInfo[0]  = isc_info_blob_max_segment then
-begin
-  result :=  isc_vax_integer(pchar(@blobInfo[3]), 
isc_vax_integer(pchar(@blobInfo[1]), 2));
-end
-  else
- CheckError('isc_blob_info', FStatus);
-end;
-
 procedure TIBConnection.LoadBlobIntoBuffer(FieldDef: TFieldDef;ABlobBuf: 
PBufBlobField; cursor: TSQLCursor; ATransaction : TSQLTransaction);
 const
   isc_segstr_eof = 335544367; // It's not defined in ibase60 but in ibase40. 
Would it be better to define in ibase60?
@@ -1273,7 +1256,6 @@
   blobHandle : Isc_blob_Handle;
   blobSegment : pointer;
   blobSegLen : word;
-  maxBlobSize : longInt;
   TransactionHandle : pointer;
   blobId : PISC_QUAD;
   ptr : Pointer;
@@ -1286,14 +1268,13 @@
   if isc_open_blob(@FStatus[0], @FSQLDatabaseHandle, @TransactionHandle, 
@blobHandle, blobId) <> 0 then
 CheckError('TIBConnection.CreateBlobStream', FStatus);
 
-  maxBlobSize := getMaxBlobSize(blobHandle);
-
-  blobSegment := AllocMem(maxBlobSize);
+  //For performance, read as much as we can, regardless of any segment size 
set in database.
+  blobSegment := AllocMem(MAXBLOBSEGMENTSIZE);
 
   with ABlobBuf^.BlobBuffer^ do
 begin
 Size := 0;
-while (isc_get_segment(@FStatus[0], @blobHandle, @blobSegLen, maxBlobSize, 
blobSegment) = 0) do
+while (isc_get_segment(@FStatus[0], @blobHandle, @blobSegLen, 
MAXBLOBSEGMENTSIZE, blobSegment) = 0) do
   begin
   ReAllocMem(Buffer,Size+blobSegLen);
   ptr := Buffer+Size;
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Graeme: FBLIB blob segment size was: [fpc-pascal] Patch/Test BlobSegmentSize

2011-11-20 Thread Reinier Olislagers
On 19-11-2011 23:36, Michael Van Canneyt wrote:
> On Sat, 19 Nov 2011, Reinier Olislagers wrote:
>> On 19-11-2011 13:28, Reinier Olislagers wrote:
>>> Hi list,
>>>
>>> The Firebird/Interbase ibconnection.pp code has this code in its
>>> SetParameters procedure to upload blobs in segments (BlobSegmentSize
>>> property is set to 80 on object creation):
>> I wonder whether/what changes are required for reading blobs...

Hi Graeme & list,

Had a look at tiOPF FBLib FBLDsql.pas. It defines
BLOB_SEGMENT_LEN = 4095;
used in both reading & writing blob data.

... might/could/should that be enlarged to 65535?

Regards,
Reinier


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


Re: [fpc-pascal] using functions from units & main programme

2011-11-20 Thread Sven Barth

On 19.11.2011 17:19, John Lee wrote:

Surprised this capability hasn't come up before because
doesn't sound technically difficult to do.


Free Pascal is a static language, as Bernd already wrote and as such the 
compiler is geared towards this fact. So what you suggest would mean to 
rewrite large parts of the compiler. Not what I'd call "not technically 
difficult to do".


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


Re: [fpc-pascal] IBConnection blobsegmentsize irrelevant & performance

2011-11-20 Thread Graeme Geldenhuys
On 20/11/2011, Michael Van Canneyt  wrote:
>
> Well, if Ann Harrison herself says it's irrelevant, then yes.
> I suspect it would indeed give a serious performance boost :)

Showing my ignorance by not knowing who Ann Harrison was, I Google'd
her. I found this post on the Firebird website. A bit of history about
Firebird (or rather Interbase). It was very entertaining to read. A
pity one can't start software companies like that any more. :-) It
sure does sound like they had fun though.

  
http://www.firebirdsql.org/en/ann-harrison-s-reminiscences-on-interbase-s-beginnings/


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: Graeme: FBLIB blob segment size was: [fpc-pascal] Patch/Test BlobSegmentSize

2011-11-20 Thread Graeme Geldenhuys
On 20/11/2011, Reinier Olislagers  wrote:
>
> Had a look at tiOPF FBLib FBLDsql.pas. It defines
> BLOB_SEGMENT_LEN = 4095;
> used in both reading & writing blob data.
>
> ... might/could/should that be enlarged to 65535?

Based on the new information, it should be changed. I'll update FBlib.
Thanks for noticing this.

Is there a directly link to Ann's answer to you in the Firebird
mailing list, which I can reference in the commit message? Otherwise
I'll simply reference your reply with Ann's quote from the FPC-Pascal
mailing list.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: Graeme: FBLIB blob segment size was: [fpc-pascal] Patch/Test BlobSegmentSize

2011-11-20 Thread Reinier Olislagers
On 20-11-2011 13:06, Graeme Geldenhuys wrote:
> On 20/11/2011, Reinier Olislagers  wrote:
>>
>> Had a look at tiOPF FBLib FBLDsql.pas. It defines
>> BLOB_SEGMENT_LEN = 4095;
>> used in both reading & writing blob data.
>>
>> ... might/could/should that be enlarged to 65535?
> 
> Based on the new information, it should be changed. I'll update FBlib.
> Thanks for noticing this.
> 
> Is there a directly link to Ann's answer to you in the Firebird
> mailing list, which I can reference in the commit message? Otherwise
> I'll simply reference your reply with Ann's quote from the FPC-Pascal
> mailing list.

http://tech.groups.yahoo.com/group/firebird-support/message/115826
Thanks,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Advantages of THTMLPageProducer

2011-11-20 Thread leledumbo
What are the advantages of using THTMLPageProducer compared to directly
generate HTML output (or via THTMLWriter)?

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Advantages-of-THTMLPageProducer-tp5008206p5008206.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] Indy example returns Runtime Error (211)

2011-11-20 Thread Frank Church
I am trying to use an Indy example from stackoverflow -
http://stackoverflow.com/questions/576538/delphi-how-to-get-all-local-ipsand
I always get Runtime Error (211). It is more of a language issue than
a
network related question, which is why I am reposting it here.

Is it due to some difference between Delphi and Free Pascal


 idStack := TIdStack.Create;
>   TIdStack.IncUsage;
>   try
> network := idStack.LocalAddress;
> mmoResults01.Lines.Assign(idStack.LocalAddresses);
> //PrintLines(idStrings);
>   finally
> TIdStack.DecUsage;
>   end;
>   FreeAndNil(idstack);
>
>
Any ideas?

-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Compilation error in crosscompiling lNet to arm-linux

2011-11-20 Thread Torsten Bonde Christiansen

Hi List.

I get the following error when crosscompiling lNet to arm-linux.

$ fpc -MObjFPC -Sgim -CX -O2 -Parm -gs -gl -vew -l -Fi../lib/sys 
-Fu../lib -Fu. -FUlib/arm-linux/ -dLNET_BASE -fPIC lnetbase.pas

Free Pascal Compiler version 2.4.4 [2011/11/14] for arm
Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for ARMEL
Compiling lnetbase.pas
Compiling /home/torsten/FreePascal/lnet/lib/lnet.pp
Compiling /home/torsten/FreePascal/lnet/lib/levents.pp
Compiling /home/torsten/FreePascal/lnet/lib/lcommon.pp
*lcommon.pp(370,13) Fatal: Internal error 200502052*
Fatal: Compilation aborted
Error: /usr/bin/ppcrossarm returned an error exitcode (normal if you did 
not specify a source file to be compiled)


Is this a bug in the compiler?

Kind regards,
Torsten Bonde Christiansen.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Compilation error in crosscompiling lNet to arm-linux

2011-11-20 Thread Jonas Maebe

On 20 Nov 2011, at 21:30, Torsten Bonde Christiansen wrote:

> I get the following error when crosscompiling lNet to arm-linux.
> 
> $ fpc -MObjFPC -Sgim -CX -O2 -Parm -gs -gl -vew -l -Fi../lib/sys -Fu../lib 
> -Fu. -FUlib/arm-linux/ -dLNET_BASE -fPIC lnetbase.pas
> Free Pascal Compiler version 2.4.4 [2011/11/14] for arm
> Copyright (c) 1993-2010 by Florian Klaempfl
> Target OS: Linux for ARMEL
> Compiling lnetbase.pas
> Compiling /home/torsten/FreePascal/lnet/lib/lnet.pp
> Compiling /home/torsten/FreePascal/lnet/lib/levents.pp
> Compiling /home/torsten/FreePascal/lnet/lib/lcommon.pp
> *lcommon.pp(370,13) Fatal: Internal error 200502052*
> Fatal: Compilation aborted
> Error: /usr/bin/ppcrossarm returned an error exitcode (normal if you did not 
> specify a source file to be compiled)
> 
> Is this a bug in the compiler?

It's a missing feature. The problem is that you are trying to generate PIC ARM 
code, which is not yet implemented/supported.


Jonas

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


Re: [fpc-pascal] Compilation error in crosscompiling lNet to arm-linux

2011-11-20 Thread Torsten Bonde Christiansen

On 2011-11-20 21:36, Jonas Maebe wrote:

On 20 Nov 2011, at 21:30, Torsten Bonde Christiansen wrote:


I get the following error when crosscompiling lNet to arm-linux.

$ fpc -MObjFPC -Sgim -CX -O2 -Parm -gs -gl -vew -l -Fi../lib/sys -Fu../lib -Fu. 
-FUlib/arm-linux/ -dLNET_BASE -fPIC lnetbase.pas
Free Pascal Compiler version 2.4.4 [2011/11/14] for arm
Copyright (c) 1993-2010 by Florian Klaempfl
Target OS: Linux for ARMEL
Compiling lnetbase.pas
Compiling /home/torsten/FreePascal/lnet/lib/lnet.pp
Compiling /home/torsten/FreePascal/lnet/lib/levents.pp
Compiling /home/torsten/FreePascal/lnet/lib/lcommon.pp
*lcommon.pp(370,13) Fatal: Internal error 200502052*
Fatal: Compilation aborted
Error: /usr/bin/ppcrossarm returned an error exitcode (normal if you did not 
specify a source file to be compiled)

Is this a bug in the compiler?

It's a missing feature. The problem is that you are trying to generate PIC ARM 
code, which is not yet implemented/supported.


Is it going to be in 2.6. Perhaps in trunk?

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


Re: [fpc-pascal] Compilation error in crosscompiling lNet to arm-linux

2011-11-20 Thread Jonas Maebe

On 20 Nov 2011, at 21:41, Torsten Bonde Christiansen wrote:

> On 2011-11-20 21:36, Jonas Maebe wrote:
>> It's a missing feature. The problem is that you are trying to generate PIC 
>> ARM code, which is not yet implemented/supported.
>> 
> Is it going to be in 2.6. Perhaps in trunk?

It's not implemented anywhere currently.


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


[fpc-pascal] Is there a bug in TStrings.Delimiter handling?

2011-11-20 Thread Frank Church
adapterVals: TStringList

adapterVals.Delimiter := ';';
adapterVals.DelimitedText := '192.168.1.2,00:0E:08:E0:7C:ED,Word Space';
adapterVals[0] = '192.168.1.2'
adapterVals[1] = '00:0E:08:E0:7C:ED'
adapterVals[2] = 'Word' - this should be 'Word Space'

Is this a bug or the expected output? If the delimiter is set to a comma it
shouldn't treat a space as a delimter as well.
-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal