Re: [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Mark Morgan Lloyd

Andrew Brunner wrote:

Can someone check the status of update if the bind parameter for
double decimal values?

I'm getting unexpected rounding errors after updating - the data in
the column looks different than what was specified during the update
statement.

Value: double;
Query.Params.ParamByName(sName).AsFloat:=Value;

1.) Update Value  : 40734.825668912039
2.) Actual Value after update : 40734.8256689120
3.) Actual Value on read   :40734.825668912003


Does MySQL come with an official program that you can use to run 
queries manually? What happens when you use it to store and retrieve 
that number?


I think that SQL specifies that a double has 53 bits in the mantissa 
which is a bit better than 15 digits which is about what you're seeing.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] InstantFPC

2011-07-11 Thread dhkblaszyk
   ZeelandNet Webmail   

I would like to create a patch for instantfpc
but would like to ask first here. The patch will add a new extension
(.ppx) to instantfpc and the installers so it get's registered with the
OS after installing. 

Is this ok with everybody?

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


Re: [fpc-devel] InstantFPC

2011-07-11 Thread michael . vancanneyt



On Mon, 11 Jul 2011, dhkblas...@zeelandnet.nl wrote:


  ZeelandNet Webmail

I would like to create a patch for instantfpc
but would like to ask first here. The patch will add a new extension
(.ppx) to instantfpc and the installers so it get's registered with the
OS after installing.

Is this ok with everybody?


It is OK.

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


Re: [fpc-devel] Const optimization is a serious bug

2011-07-11 Thread Jonas Maebe

On 11 Jul 2011, at 02:08, Chad Berchek wrote:

 Even if the calling convention does not change, the semantics can, as 
 currently implemented. Even within a single platform const is ill-defined. 
 Consider the case of AnsiString. There are three cases as it is currently 
 implemented:
 
 1) Ref count  1 when passed as const parameter results in strict 
 pass-by-value semantics
 2) Ref count = 1 and you modify the original instance in-place results in the 
 value of the parameter changing
 3) Ref count = 1 and you modify the original reference such that the 
 instance's ref count decreases to zero and it may crash or just give weird 
 behavior

Case 1) is the same as 2) and 3). Even if the reference count is initially 100, 
the called routine can overwrite all but one of them first and then either do 
2) or 3).


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


RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands
 
 1.) Update Value  : 40734.825668912039
 2.) Actual Value after update : 40734.825668912
 3.) Actual Value on read   : 40734.825668912003
 

Several things here:
- floattostr(40734.825668912039) equals 40734.825668912.
- update table set t_double = 40734.825668912039 where id =123; in the mysql
client or the MySQL browser returns 40734.825668912 on a subsequent select
(mysql 5.0.51 ubuntu) 
- 40734.825668912003 and 40734.825668912039 are beyond the precision of ieee
double (2^52 = 4503599627370496 values which is 15 digits) 

How do you get the 40734.825668912003 value?

Ludo



 

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


Re: [fpc-devel] Const optimization is a serious bug

2011-07-11 Thread Alexander Klenin
On Mon, Jul 11, 2011 at 15:35, Hans-Peter Diettrich
drdiettri...@aol.com wrote:
 Alexander Klenin schrieb:
 To which data type do you want apply your constval modifier, with which
 concrete effects?

 To any datatype, of course. The result should be:
 1) Parameter is passed by value

 How to pass objects by value?
That, as I said above, is a separate good question.
Until it is resolved, I agree with your suggestion of giving warning
(or even error) on const and constval object parameters.

 Records with embedded AnsiStrings or other managed types?
That is already done in the usual by-value mechanism.

-- 
Alexander S. Klenin
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Re: MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
On Sun, Jul 10, 2011 at 8:00 PM, Andrew Brunner
andrew.t.brun...@gmail.com wrote:

 2.) Actual Value after update : 40734.825668912

This is the value as read in the MYSQL admin program table data.

This is under Ubuntu 10.10 x64.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Jonas Maebe

On 11 Jul 2011, at 13:41, Andrew Brunner wrote:

 On Mon, Jul 11, 2011 at 4:53 AM, Ludo Brands ludo.bra...@free.fr wrote:
 
 How do you get the 40734.825668912003 value?
 
 Fields.FieldByName(Value).AsFloat();

You are probably assigning the result to a variable of the type extended, or 
directly passing it a routine that accepts parameters of the type extended. 
The digits beyond the precision guaranteed by the double type are undefined in 
that case (at least in case the number cannot be represented exactly by a 
double precision value).


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


Re: RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
Declaraions are all double.

Value: double;

Query.Params.ParamByName(sName).AsFloat:=Value;

Also:
Test:double;

Test:=Query.Params.ParamByName(sName).AsFloat;

Test=Value  ok here.  Problem must be somwhere else.

1.) Update Value  : 40734.825668912039
2.) Actual Value after update : 40734.825668912
3.) Actual Value on read   : 40734.825668912003

As far as I know this is a relatively new problem.  Could be with
Ubuntu but was someone doing MYSQL work lately?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
Hi all,

I'm trying to set-up a VM with Solaris (x86_64).

Problem is that fpc refuses to link applications. It complains that
there is a syntax error in the build-in linker scripts. How that's
possible, I don't know.

When I use -T, so that the default linker scripts are not used, linking
goes well, but the application terminates immediately: 'Bad entry
point'. That's probably because the link.res link-script is missing too
much info to be used without the default linker-scripts.

Does this ring a bell to anyone? And maybe someone know where I can find
the default-linker scripts?

Joost.

-- 
My Lazarus blog: http://www.lazarussupport.com/lazarus/weblog

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


Re: RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Jonas Maebe

On 11 Jul 2011, at 15:02, Andrew Brunner wrote:

 Declaraions are all double.

You don't show what you do with the value before writing it out, nor how you 
write it out and determine that its value is 40734.825668912003 (which is 
probably also what Ludo meant with How do you get the 40734.825668912003 
value?). As I mentioned in my previous reply, the value is probably simply 
getting converted to extended in the mean time and that is where the other 
digits come from.


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


Re: [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Mark Morgan Lloyd

Joost van der Sluis wrote:

Hi all,

I'm trying to set-up a VM with Solaris (x86_64).

Problem is that fpc refuses to link applications. It complains that
there is a syntax error in the build-in linker scripts. How that's
possible, I don't know.

When I use -T, so that the default linker scripts are not used, linking
goes well, but the application terminates immediately: 'Bad entry
point'. That's probably because the link.res link-script is missing too
much info to be used without the default linker-scripts.

Does this ring a bell to anyone? And maybe someone know where I can find
the default-linker scripts?


Which version of the compiler? I didn't see this on SPARC but I think 
the first thing I'd check would be which linker (ld) was actually being 
used- I had to do a lot of tweaking to get paths right.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands

  How do you get the 40734.825668912003 value?
 
 Fields.FieldByName(Value).AsFloat();

Floattostr limits precision to 15 digits (40734.8256689120). When updating
the mysql database it converts the float to a string and looses the last 2
digits. The last digits are returned by gdb or the str procedure with
precision 15, but won't be displayed in data controls. 

Ludo

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


RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Ludo Brands
You need to get the gnu binutils from sunfreeware.com and set your path to
include /usr/local/bin.
If you want to build the compiler you'll also need the gnu make from the
same source.

Ludo



 -Message d'origine-
 De : fpc-devel-boun...@lists.freepascal.org 
 [mailto:fpc-devel-boun...@lists.freepascal.org] De la part de 
 Joost van der Sluis
 Envoyé : lundi 11 juillet 2011 15:06
 À : FPC developers' list
 Objet : [fpc-devel] Getting fpc to work on Solaris (11)
 
 
 Hi all,
 
 I'm trying to set-up a VM with Solaris (x86_64).
 
 Problem is that fpc refuses to link applications. It 
 complains that there is a syntax error in the build-in linker 
 scripts. How that's possible, I don't know.
 
 When I use -T, so that the default linker scripts are not 
 used, linking goes well, but the application terminates 
 immediately: 'Bad entry point'. That's probably because the 
 link.res link-script is missing too much info to be used 
 without the default linker-scripts.
 
 Does this ring a bell to anyone? And maybe someone know where 
 I can find the default-linker scripts?
 
 Joost.
 
 -- 
 My Lazarus blog: http://www.lazarussupport.com/lazarus/weblog
 
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org 
 http://lists.freepascal.org/mailman/listinfo/fpc-devel
 

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


Re: [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
On Mon, 2011-07-11 at 15:52 +0200, Ludo Brands wrote:
 You need to get the gnu binutils from sunfreeware.com and set your path to
 include /usr/local/bin.

I have them installed. (Well, using 'pkg install gnu-binutils') Or else
gld wouldn't be available at all.
And there is no '/usr/local/bin'?

Do you think I can better try the binutils at the sunfreeware website?

 If you want to build the compiler you'll also need the gnu make from the
 same source.

To my surprise was 'gmake' installed by default. 

Joost.

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


Re: RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Hans-Peter Diettrich

Ludo Brands schrieb:

How do you get the 40734.825668912003 value?

Fields.FieldByName(Value).AsFloat();


Floattostr limits precision to 15 digits (40734.8256689120). When updating
the mysql database it converts the float to a string and looses the last 2
digits. The last digits are returned by gdb or the str procedure with
precision 15, but won't be displayed in data controls.


It doesn't make sense to display more digits than stored in the binary 
variable. There is no loss, only rounding errors in the conversion from 
binary to decimal text.


DoDi

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


Re: RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
On Mon, Jul 11, 2011 at 10:19 AM, Hans-Peter Diettrich

 It doesn't make sense to display more digits than stored in the binary
 variable. There is no loss, only rounding errors in the conversion from
 binary to decimal text.

I need to compare values with complete precision.  I don't think this
problem was present a while ago.

When the memory is copied is there a missing 12bits?  Is there going
to be a fix for this?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Ludo Brands
  You need to get the gnu binutils from sunfreeware.com and set your 
  path to include /usr/local/bin.
 
 I have them installed. (Well, using 'pkg install 
 gnu-binutils') Or else gld wouldn't be available at all. And 
 there is no '/usr/local/bin'?
 
 Do you think I can better try the binutils at the sunfreeware website?
 

I replied a little bit too quick. You're using solaris 11 and
sunfreeware.com supports up to solaris 10.

When you write When I use -T, I guess that is -st ? What command line did
you use to link with link.res?


Ludo


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


Re: [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
On Mon, 2011-07-11 at 16:47 +0200, Ludo Brands wrote:
   You need to get the gnu binutils from sunfreeware.com and set your 
   path to include /usr/local/bin.
  
  I have them installed. (Well, using 'pkg install 
  gnu-binutils') Or else gld wouldn't be available at all. And 
  there is no '/usr/local/bin'?
  
  Do you think I can better try the binutils at the sunfreeware website?
  
 
 I replied a little bit too quick. You're using solaris 11 and
 sunfreeware.com supports up to solaris 10.
 
 When you write When I use -T, I guess that is -st ? What command line did
 you use to link with link.res?

Application name is test. (It's a hello world)

/usr/bin/gld -s -L. -o test link.res
result:
/usr/bin/gld:built in linker script:21: syntax error

When I use this: (-T, not -st)
/usr/bin/gld -s -L. -o test -T link.res
result: link succeed, but running:
./test
test: Bad entry point
Killed

Joost.



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


RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands
  How do you get the 40734.825668912003 value?
  Fields.FieldByName(Value).AsFloat();
  
  Floattostr limits precision to 15 digits (40734.8256689120). When 
  updating the mysql database it converts the float to a string and 
  looses the last 2 digits. The last digits are returned by 
 gdb or the 
  str procedure with precision 15, but won't be displayed in data 
  controls.
 
 It doesn't make sense to display more digits than stored in 
 the binary variable. 

I agree. I just tried to explain what happens behind the scenes. 

 There is no loss, only rounding errors in the 
 conversion from 
 binary to decimal text.
 

There is a small loss. 2^52 = 4503599627370496 which is almost 16 digits. 15
digits can be represented by a 50 bits mantissa. So you're losing 2 bits in
precision by truncating to 15 digits. 
I wrote earlier that the mysql client returned 40734.825668912 when set to
40734.825668912039. That is mysql truncating to 15 characters the string
representation of the double for displaying. But when I do a select t_double
- 40734.825668 I do get 9.1204e-07. In case of fpc setting the same
value select t_double - 40734.825668 returns 9.1200e-07. And that is
because fpc converts to a string when updating the value losing the last 2
bits. 

Ludo


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


Re: RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
On Mon, Jul 11, 2011 at 10:14 AM, Ludo Brands ludo.bra...@free.fr wrote:
 So you're losing 2 bits in precision by truncating to 15 digits.

Ok, so I'm going to go out on a limb here and propose the question:
How to we fix this 2bit loser ;-)
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands
  It doesn't make sense to display more digits than stored in 
 the binary 
  variable. There is no loss, only rounding errors in the conversion 
  from binary to decimal text.
 
 I need to compare values with complete precision.  I don't 
 think this problem was present a while ago.
 
 When the memory is copied is there a missing 12bits?  Is 
 there going to be a fix for this? 

Exact compare with double is never a good idea. For MySQL read more here:
http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html

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


RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Ludo Brands
 Application name is test. (It's a hello world)
 
 /usr/bin/gld -s -L. -o test link.res
 result:
 /usr/bin/gld:built in linker script:21: syntax error


If you add --verbose it'll print out the internal ld script. See what line
21 corresponds with.

 
 When I use this: (-T, not -st)
 /usr/bin/gld -s -L. -o test -T link.res

OK. I was thinking of the fpc option.

Ludo
 

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


Re: RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Hans-Peter Diettrich

Andrew Brunner schrieb:


It doesn't make sense to display more digits than stored in the binary
variable. There is no loss, only rounding errors in the conversion from
binary to decimal text.


I need to compare values with complete precision.  I don't think this
problem was present a while ago.


Floating point numbers never should be compared for equality. Better:
  if abs(a-b)  delta then ...
with delta corresponding to the available accuracy (e.g. 1E-15).

As a rule of thumb: 10^3 ~ 2^10, i.e. 3 decimal digits require 10 bits 
in the significand, so that 52 bits allow for 52*3/10 ~ 15 digits.



When the memory is copied is there a missing 12bits?  Is there going
to be a fix for this?


The binary value consists of an exponent and an significand (mantissa), 
most probably you forgot to count the exponent and sign bits.



I'd suggest that you read a bit about using floating point numbers. They 
never are accurate, and every decimal representation adds more 
inaccuracy :-(


DoDi

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


Re: [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
On Mon, 2011-07-11 at 18:08 +0200, Ludo Brands wrote:
  Application name is test. (It's a hello world)
  
  /usr/bin/gld -s -L. -o test link.res
  result:
  /usr/bin/gld:built in linker script:21: syntax error
 
 
 If you add --verbose it'll print out the internal ld script. See what line
 21 corresponds with.

Tried that, but it shows nothing. (Apparently it parses the script
first)

But what I did find out was that some of the scripts in 
/usr/gnu/i386-pc-solaris2.11/lib/ldscripts are incomplete! For example
the file elf_i386.xcs is only 21 lines long. It looks like the effect in
this bug-report:
http://lists.gnu.org/archive/html/bug-binutils/2010-04/msg0.html

Only not all files are truncated, and on another offset. Any idea how to
get the right scripts? (Can I force a re-install of the package? Or an
older version)

  When I use this: (-T, not -st)
  /usr/bin/gld -s -L. -o test -T link.res
 
 OK. I was thinking of the fpc option.

Oh, yes, sure. I was running the linker manually.

Joost

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


RE : RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Ludo Brands


 
 If you add --verbose it'll print out the internal ld script. 
 See what line 21 corresponds with.
 
  

I've attached the internal script for the gnu ld 2.21.1 on Solaris 10. 
Try 
/usr/bin/gld -s -L. -o test -T ld_internal_script link.res

Ludo


ld_internal_script
Description: Binary data
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
On Mon, 2011-07-11 at 18:29 +0200, Ludo Brands wrote:
 
  
  If you add --verbose it'll print out the internal ld script. 
  See what line 21 corresponds with.
  
   
 
 I've attached the internal script for the gnu ld 2.21.1 on Solaris 10. 
 Try 
 /usr/bin/gld -s -L. -o test -T ld_internal_script link.res

At first it did not work. I've edited the file, changed the
output-format in the script from 'elf32-i386-sol2' to 'elf32-i386' and
now it works.

I'll use this script for now, thanks for the help. But I still wonder
why it doesn't work by default...

Joost.

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


Re: RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
On Mon, Jul 11, 2011 at 11:55 AM, Hans-Peter Diettrich
drdiettri...@aol.com wrote:

 The binary value consists of an exponent and an significand (mantissa), most
 probably you forgot to count the exponent and sign bits.

The problem I'm trying to describe is with double precision floating
point values.  When the query is open and one of the parameters is
double MySQL does not receive all of the memory.  It's missing two
bits.  That is a problem with either the mysql5.1 driver or with the
mysql51 component w/r/t the double data type.

 I'd suggest that you read a bit about using floating point numbers. They
 never are accurate, and every decimal representation adds more inaccuracy

I could understand if you wanted to bring this fact into argument over
arithmetic and cumulative error.  But the fact is - if I send a double
precision data value to a double precision field in the SQL database -
that value had better be the same - bit for bit.  Now if someone is
being bit shifty on the conversion - that needs to be a addressed.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


RE : RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Ludo Brands
 
 I'll use this script for now, thanks for the help. But I 
 still wonder why it doesn't work by default...
 

Probably the bug you mentioned in the other URL.

Here's another report of exactly the same problem:
http://permalink.gmane.org/gmane.comp.lang.lua.general/79592 

Ludo

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


RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands
 I could understand if you wanted to bring this fact into
 argument over arithmetic and cumulative error.  But the fact 
 is - if I send a double precision data value to a double 
 precision field in the SQL database - that value had better 
 be the same - bit for bit.  Now if someone is being bit 
 shifty on the conversion - that needs to be a addressed. 

The only way to transfer double as binary data to the server is by using
prepared statements and bound parameters. This is currently not implemented
in fcl. All data are transferred as text to the database and are subject to
conversion errors.

I don't think zeoslib uses prepared statements for mysql either.

Ludo

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


Re: RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Andrew Brunner
On Mon, Jul 11, 2011 at 12:55 PM, Ludo Brands ludo.bra...@free.fr wrote:

 The only way to transfer double as binary data to the server is by using
 prepared statements and bound parameters. This is currently not implemented
 in fcl. All data are transferred as text to the database and are subject to
 conversion errors.

Hmmm... I seem to recall prepare and bind parameters in fcl-db/mySQL
component source?.  Are you sure about this?  I really, really, really
need double precision data to work.  I know i've used binary binds
with Int64 arrays and things well beyond 8 bytes binary.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


RE : RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Ludo Brands


 Hmmm... I seem to recall prepare and bind parameters in 
 fcl-db/mySQL component source?.  Are you sure about this?  I 
 really, really, really need double precision data to work.  I 
 know i've used binary binds with Int64 arrays and things well 
 beyond 8 bytes binary. ___

I see that the functions and structures are defined in mysql.inc but they
aren't used anywhere. Parameter values are substituted in the sql string
that is sent to the db and TConnectionName.PrepareStatement doesn't send
anything to the db.
The Oracle component fe. uses bindings.  

Ludo

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


Re: RE : RE : RE : RE : [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Michael Van Canneyt



On Mon, 11 Jul 2011, Ludo Brands wrote:





Hmmm... I seem to recall prepare and bind parameters in
fcl-db/mySQL component source?.  Are you sure about this?  I
really, really, really need double precision data to work.  I
know i've used binary binds with Int64 arrays and things well
beyond 8 bytes binary. ___


I see that the functions and structures are defined in mysql.inc but they
aren't used anywhere. Parameter values are substituted in the sql string
that is sent to the db and TConnectionName.PrepareStatement doesn't send
anything to the db.
The Oracle component fe. uses bindings.


So does Firebird, and I think postgres, but I'm not sure about the latter.

The reason is that when sqldb was created, MySQL (4.0 or 4.1) didn't support 
parameters yet. Support for this would mean that the mysql connection component 
needs to be rewritten for MySQL 5.0 and higher.


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


Re: RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Mark Morgan Lloyd

Joost van der Sluis wrote:

On Mon, 2011-07-11 at 18:29 +0200, Ludo Brands wrote:
If you add --verbose it'll print out the internal ld script. 
See what line 21 corresponds with.


 
I've attached the internal script for the gnu ld 2.21.1 on Solaris 10. 
Try 
/usr/bin/gld -s -L. -o test -T ld_internal_script link.res


At first it did not work. I've edited the file, changed the
output-format in the script from 'elf32-i386-sol2' to 'elf32-i386' and
now it works.

I'll use this script for now, thanks for the help. But I still wonder
why it doesn't work by default...


Can't find any reference to a -sol2 suffix even looking at (SPARC) 
Solaris 8. For that matter I can't find it in the FPC sources, except 
very obtusely referring to a version of gcc. Has install put something 
suspect in fpc.cfg?


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: RE : [fpc-devel] Getting fpc to work on Solaris (11)

2011-07-11 Thread Joost van der Sluis
On Mon, 2011-07-11 at 19:59 +, Mark Morgan Lloyd wrote:
 Joost van der Sluis wrote:
  On Mon, 2011-07-11 at 18:29 +0200, Ludo Brands wrote:
  If you add --verbose it'll print out the internal ld script. 
  See what line 21 corresponds with.
 
   
  I've attached the internal script for the gnu ld 2.21.1 on Solaris 10. 
  Try 
  /usr/bin/gld -s -L. -o test -T ld_internal_script link.res
  
  At first it did not work. I've edited the file, changed the
  output-format in the script from 'elf32-i386-sol2' to 'elf32-i386' and
  now it works.
  
  I'll use this script for now, thanks for the help. But I still wonder
  why it doesn't work by default...
 
 Can't find any reference to a -sol2 suffix even looking at (SPARC) 
 Solaris 8. For that matter I can't find it in the FPC sources, except 
 very obtusely referring to a version of gcc. Has install put something 
 suspect in fpc.cfg?

It was in the linker-script that Ludo Brands send to this list.

Joost

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


Re: [fpc-devel] MySQL 5.1 and Double (trouble)

2011-07-11 Thread Martin Schreiber
On Monday 11 July 2011 19:55:25 Ludo Brands wrote:

 I don't think zeoslib uses prepared statements for mysql either.

MSEgui tmysqlconnection uses prepared statements and binary parameters.

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