Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-26 Thread patspiper

On 26/09/12 08:58, Vincent Snijders wrote:

2012/9/25 Bernd:

2012/9/25 patspiper:

procedure test;
begin
   Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1);
end;

and if you cast it to some other pointer type before dereferencing the
error goes away:

procedure test;
begin
   Move(MyClass1.Ref.Data^, PByte(MyClass2.Ref.Data)^, 1);
end;

But this should not be necessary.

Why not?  The error is correct. By using the type cast you tell the
compiler you know what you are doing and that is should not bother
doing the sanity check.

So IMO, not a bug.

Can anybody test under Delphi? The complete unit is in the OP.

Stephano


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


Re: [fpc-pascal] Error: Can't take the address of constant expressions

2012-09-26 Thread Jonas Maebe

On 26 Sep 2012, at 07:58, Vincent Snijders wrote:

> 2012/9/25 Bernd :
>> 2012/9/25 patspiper :
>>> procedure test;
>>> begin
>>>  Move(MyClass1.Ref.Data^, MyClass2.Ref.Data^, 1);
>>> end;
>> 
>> and if you cast it to some other pointer type before dereferencing the
>> error goes away:
>> 
>> procedure test;
>> begin
>>  Move(MyClass1.Ref.Data^, PByte(MyClass2.Ref.Data)^, 1);
>> end;
>> 
>> But this should not be necessary.
> 
> Why not?  The error is correct. By using the type cast you tell the
> compiler you know what you are doing and that is should not bother
> doing the sanity check.

If that were true, then using a local variable that is an untyped pointer would 
also have to fail. It is in fact a compiler bug.


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


[fpc-pascal] Re: SDFDataset users!?

2012-09-26 Thread Reinier Olislagers


On 25-9-2012 11:05, michael.vancanneyt-0is9kj9s...@public.gmane.org
> Well, in the not-too-far future, I'll spend time on improving the DB
> testsuite.
> 

In that not-too-far future, you might want to have a look at the
following patches ;)
22970 [Patch] Database test suite: expanded readme
22972 Firebird EXECUTE BLOCK RETURNS test
22976 [Patch] Database test suite: temporary table test: add support for
Firebird

thanks,
Reinier


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


[fpc-pascal] Problems with Postgresql Character Encoding

2012-09-26 Thread Andrew Brunner
My cloud file/folder sync client desktop app builds and maintains a 
manifest of all files and folders from a specified starting point. I use 
this manifest to synchronize disk entries across devices.  It uses HTTP 
requests and XML to carry out all transactions.  Meaning there is no 
TSQLConnection.  The problem is that the HTTP server receives the data 
as XML and refuses to post changes.  If data (in updates or inserts) 
contains non-supported UTF8 characters postgresql rejects with character 
encoding notices.


I've tried with using AnsiToUTF8 and UTF8toAnsi.  That works for email 
messages.  However, since sync code has to scan tens of thousands of 
disk files/folders I don't think it's good for battery and memory 
consumption for a background app to consume cpu resources in this case 
going between 2 forms of the same file/folder name.


I need to be able to take advantage of Postgresql's client encoding 
method.  I know postgresql allows me to tell the server that the 
connection is presently character set "LATIN1".  And presumably 
postgresql server will convert what it needs to my database encoding of 
UTF8.



SystemP^.Connection.Charset:='LATIN1';

This does nothing for me when Connection is a postgresql connection.

Anyone have any experience with postgresql character sets / encoding???

I can't hard-code any one character set because users from 1 region will 
have different encoding needs than another.


Any help, or comments is greatly needed.

--
Andrew Brunner

Aurawin LLC
512.574.6298
http://aurawin.com/

Aurawin is a great new place to store, share, and enjoy your
photos, videos, music and more.

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


Gmane list address mangling (was Re: [fpc-pascal] Re: SDFDataset users!?)

2012-09-26 Thread Jonas Maebe

On 25 Sep 2012, at 13:59, Reinier Olislagers wrote:

> In that not-too-far future, you might want to have a look at the
> following patches ;)
> 22970 [Patch] Database test suite: expanded readme
> 22972 Firebird EXECUTE BLOCK RETURNS test
> 22976 [Patch] Database test suite: temporary table test: add support for
> Firebird

It seems that gmane has started mangling the mailing list address (the above 
mail was sent to 
public-fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@plane.gmane.org rather than 
to fpc-pascal@lists.freepascal.org). The result is that such mails are held for 
moderator approval (not including the list's address amongst the recipents is a 
spammy property). Please either ask gmane to fix this, or manually change the 
to-address when replying via gmane to the proper mailing list address (if that 
is possible).

Thanks,


Jonas
FPC mailing lists admin___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Problems with Postgresql Character Encoding

2012-09-26 Thread Mark Morgan Lloyd

Andrew Brunner wrote:
My cloud file/folder sync client desktop app builds and maintains a 
manifest of all files and folders from a specified starting point. I use 
this manifest to synchronize disk entries across devices.  It uses HTTP 
requests and XML to carry out all transactions.  Meaning there is no 
TSQLConnection.  The problem is that the HTTP server receives the data 
as XML and refuses to post changes.  If data (in updates or inserts) 
contains non-supported UTF8 characters postgresql rejects with character 
encoding notices.


I've tried with using AnsiToUTF8 and UTF8toAnsi.  That works for email 
messages.  However, since sync code has to scan tens of thousands of 
disk files/folders I don't think it's good for battery and memory 
consumption for a background app to consume cpu resources in this case 
going between 2 forms of the same file/folder name.


I need to be able to take advantage of Postgresql's client encoding 
method.  I know postgresql allows me to tell the server that the 
connection is presently character set "LATIN1".  And presumably 
postgresql server will convert what it needs to my database encoding of 
UTF8.



SystemP^.Connection.Charset:='LATIN1';

This does nothing for me when Connection is a postgresql connection.

Anyone have any experience with postgresql character sets / encoding???


No, but I'm interested since this is something that I anticipate having 
to do.


You might need to issue an explicit instruction to the PostgreSQL server 
telling it to assume that the current session is encoded as /whatever/. 
If you have to do that then you might find yourself having to use the 
PQConnection's (or whatever the correct name is) low-level handle, since 
working from memory the .Exec method uses a temporary handle so any 
state change isn't retained. I had to delve into this when getting 
listen/notify running reliably.


--
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] Problems with Postgresql Character Encoding

2012-09-26 Thread LacaK

Mark Morgan Lloyd  wrote / napísal(a):

Andrew Brunner wrote:
My cloud file/folder sync client desktop app builds and maintains a 
manifest of all files and folders from a specified starting point. I 
use this manifest to synchronize disk entries across devices.  It 
uses HTTP requests and XML to carry out all transactions.  Meaning 
there is no TSQLConnection.  The problem is that the HTTP server 
receives the data as XML and refuses to post changes.  If data (in 
updates or inserts) contains non-supported UTF8 characters postgresql 
rejects with character encoding notices.


I've tried with using AnsiToUTF8 and UTF8toAnsi.  That works for 
email messages.  However, since sync code has to scan tens of 
thousands of disk files/folders I don't think it's good for battery 
and memory consumption for a background app to consume cpu resources 
in this case going between 2 forms of the same file/folder name.


I need to be able to take advantage of Postgresql's client encoding 
method.  I know postgresql allows me to tell the server that the 
connection is presently character set "LATIN1".  And presumably 
postgresql server will convert what it needs to my database encoding 
of UTF8.



SystemP^.Connection.Charset:='LATIN1';

This does nothing for me when Connection is a postgresql connection.

Anyone have any experience with postgresql character sets / encoding???


No, but I'm interested since this is something that I anticipate 
having to do.


You might need to issue an explicit instruction to the PostgreSQL 
server telling it to assume that the current session is encoded as 
/whatever/. If you have to do that then you might find yourself having 
to use the PQConnection's (or whatever the correct name is) low-level 
handle, since working from memory the .Exec method uses a temporary 
handle so any state change isn't retained. I had to delve into this 
when getting listen/notify running reliably.



Do you have tried SQL:  SET CLIENT_ENCODING TO 'LATIN1' ?
May be that better would be add support for PQsetClientEncoding into 
TPQConnection ... I can look at it if you want.

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


Re: [fpc-pascal] Problems with Postgresql Character Encoding

2012-09-26 Thread LacaK




May be that better would be add support for PQsetClientEncoding into 
TPQConnection ... I can look at it if you want.

Patch is here http://bugs.freepascal.org/view.php?id=22985
(I did only basic testing)


-Laco.


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


Re: [fpc-pascal] Problems with Postgresql Character Encoding

2012-09-26 Thread Andrew Brunner

On 09/26/2012 04:30 AM, LacaK wrote:

Do you have tried SQL:  SET CLIENT_ENCODING TO 'LATIN1' ?
May be that better would be add support for PQsetClientEncoding into 
TPQConnection ... I can look at it if you want.

-Laco.


Hi Laco,

Thanks for the help.  Yes I did on connection I tried 
Connection.onConnected... ExecuteDirect ('SET CLIENT_ENCODING TO 
LATIN1).  It didn't help.


Failed to insert UTF8 database with a string like ' the © character test.'

Postgres wants the data to be converted... ie.) AnsiToUTF8 would get the 
data to post.


Thanks for the patch - I'm updating my FPC /Lazarus and building now...



--
Andrew Brunner

Aurawin LLC
512.574.6298
http://aurawin.com/

Aurawin is a great new place to store, share, and enjoy your
photos, videos, music and more.

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


Re: [fpc-pascal] Problems with Postgresql Character Encoding

2012-09-26 Thread Andrew Brunner

This did the trick!

I added a comment on reporting too.  I say this one is good to go.


On 09/26/2012 07:41 AM, LacaK wrote:




May be that better would be add support for PQsetClientEncoding into 
TPQConnection ... I can look at it if you want.

Patch is here http://bugs.freepascal.org/view.php?id=22985
(I did only basic testing)


-Laco.


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




--
Andrew Brunner

Aurawin LLC
512.574.6298
http://aurawin.com/

Aurawin is a great new place to store, share, and enjoy your
photos, videos, music and more.

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