Re: [fpc-devel] TBytes

2012-02-27 Thread Michael Schnell

On 02/28/2012 07:29 AM, Martin Schreiber wrote:


Because of Delphi compatibility and code cleanness.
I see: The "Unicode Threat" that makes "String" a moving target, forcing 
the poor "String" type to be "visible Text" i.e. holding a (somehow) 
known encoding of its binary content.


Of course I do see both aspects: GUI programmers will hope that 
"strings" are just printable and thus the name of the "somehow encoded" 
type should stay "String", while technically, a String is just a 
decently managed sequence of "something".


Thus to me it's clear that a decent compiler should provide both: one or 
more types for appropriately encoded text and one or more types for 
sequences of binary objects. that both should be easily usable and 
provide fast operation as similar as possible to the legacy String 
handling.


Often we need to combine buffer data from binary pieces and character 
data/strings.



Obviously.

So why not define decent types like "ByteString", "WordString", 
"DWordString", (maybe CharString, PointerString or whatever, too) 
allowing for the legacy string operations in an appropriately overloaded 
way ?


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


Re: [fpc-devel] TBytes

2012-02-27 Thread Martin Schreiber

Am 28.02.2012 08:06, schrieb Michael Schnell:

On 02/28/2012 05:04 AM, Martin Schreiber wrote:

I read that we should use TBytes instead of AnsiString in order to
implement combined binary/character buffers with automatic memory
management.


Why ?


Because of Delphi compatibility and code cleanness.


To me ("Ansi"-) strings seem a lot more convenient in many cases (e.g.
when implementing a kind of protocol on a Byte Stream.


Me too. :-)
Often we need to combine buffer data from binary pieces and character 
data/strings.


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


Re: [fpc-devel] TBytes

2012-02-27 Thread Michael Schnell

On 02/28/2012 05:04 AM, Martin Schreiber wrote:
I read that we should use TBytes instead of AnsiString in order to 
implement combined binary/character buffers with automatic memory 
management.


Why ?

To me ("Ansi"-) strings seem a lot more convenient in many cases (e.g. 
when implementing a kind of protocol on a Byte Stream.


-Michael


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


[fpc-devel] TBytes

2012-02-27 Thread Martin Schreiber

Hi,
I read that we should use TBytes instead of AnsiString in order to 
implement combined binary/character buffers with automatic memory 
management. With AnsiString we used setlength() in order to allocate not 
initialized  memory.

TBytes is defined as
"
   TBytes = array of Byte;
"
where setlength() fills the buffer with zeros. What should we use instead?

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


Re: [fpc-devel] global property, with getter in other unit

2012-02-27 Thread Martin

On 28/02/2012 00:46, Paul Ishenin wrote:

28.02.2012 3:01, Martin пишет:

Defining a property in the interface section (outside a class), that
refers to methods in another unit, gives an *unexpected* error. It may
well be not allowed and then should give an error, but the right error
in the right place.

Btw, only tested with 2.4.4, apologies if that is fixed in 2.6.0

verified with 2.6 too


property Foo: TObject read FunctionFromOtherUnit; // OtherUnit is in 
uses


The compiler passes that line without error.

But when trying to read the property
UnitFoo.pas(999,3) Error: Wrong number of parameters specified for call
to "FunctionFromOtherUnit"


Can you submit a more complete example?


Attached.

It needed 3 units,

accessing Foo in the same unit, in which it is declared (unit2) compiles 
(not tested if it runs...)


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


Re: [fpc-devel] global property, with getter in other unit

2012-02-27 Thread Paul Ishenin

28.02.2012 3:01, Martin пишет:

Defining a property in the interface section (outside a class), that
refers to methods in another unit, gives an *unexpected* error. It may
well be not allowed and then should give an error, but the right error
in the right place.

Btw, only tested with 2.4.4, apologies if that is fixed in 2.6.0

A none existing function, reports an immediate error, on the line where
the property is declared:
property Foo: TObject read NoneExistingFunction;

But
property Foo: TObject read FunctionFromOtherUnit; // OtherUnit is in uses

The compiler passes that line without error.

But when trying to read the property
UnitFoo.pas(999,3) Error: Wrong number of parameters specified for call
to "FunctionFromOtherUnit"


Can you submit a more complete example?

Best regards,
Paul Ishenin


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


[fpc-devel] global property, with getter in other unit

2012-02-27 Thread Martin
Defining a property in the interface section (outside a class), that 
refers to methods in another unit, gives an *unexpected* error. It may 
well be not allowed and then should give an error, but the right error 
in the right place.


Btw, only tested with 2.4.4, apologies if that is fixed in 2.6.0

A none existing function, reports an immediate error, on the line where 
the property is declared:

   property Foo: TObject read NoneExistingFunction;

But
   property Foo: TObject read  FunctionFromOtherUnit;  // OtherUnit is 
in uses


The compiler passes that line without error.

But when trying to read the property
  UnitFoo.pas(999,3) Error: Wrong number of parameters specified for 
call to "FunctionFromOtherUnit"


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


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread Marcos Douglas
On Mon, Feb 27, 2012 at 5:08 AM,   wrote:
>
>
> On Mon, 27 Feb 2012, LacaK wrote:
>
>> Hi,
>> let me share same basic info/ideas about TMSSQLConnection :
>> 1. As Marcos wrote it is descendant of sql-db TSQLConnection class and
>> provides native connector for MS SQL Servers and Sybase servers
>> 2. is depends/requires on FreeTDS open-source cross platform DB-Library
>> (alternatively can be used also Microsoft db-library ntwdblib.dll)
>> 3. all what is needed are 2-3 files:
>> - mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
>> - dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows,
>> libsybdb.so on *NIX)
>> - readme.txt (some info for users/developers)
>> 4. according to market share of MS SQL Server and Sybase there may be many
>> users, which will welcome alternative to TODBCConnection
>> 5. there is on http://www.freepascal.org/future.var in "Improve the
>> database support" > "Drivers (descendants) for more database types" so I
>> understand it as FPC is open for new stuff ;-)
>> 6. if there is any problem please let us know. If you decide to include it
>> into fcl-db then you can place files for example into src/sqldb/mssql folder
>> ;-)
>
>
> I will have a look and include both units.

And the dream will become true... Thanks Michael.
Any chance to merge in fixes_2_6 in short time?

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


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread michael . vancanneyt



On Mon, 27 Feb 2012, LacaK wrote:


Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and 
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library 
(alternatively can be used also Microsoft db-library ntwdblib.dll)

3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows, 
libsybdb.so on *NIX)

- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be many 
users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in "Improve the database 
support" > "Drivers (descendants) for more database types" so I understand it 
as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include it 
into fcl-db then you can place files for example into src/sqldb/mssql folder 
;-)


I will have a look and include both units.

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


Re: [fpc-devel] TMSSQLConnection - sqlDB component for accessing MS SQL Server

2012-02-27 Thread LacaK

Hi,
let me share same basic info/ideas about TMSSQLConnection :
1. As Marcos wrote it is descendant of sql-db TSQLConnection class and 
provides native connector for MS SQL Servers and Sybase servers
2. is depends/requires on FreeTDS open-source cross platform DB-Library 
(alternatively can be used also Microsoft db-library ntwdblib.dll)

3. all what is needed are 2-3 files:
- mssqlconn.pp (implementation of TMSSQLConnection and TSybaseConnection)
- dblib.pp (interface to FreeTDS db-library ABI dblib.dll on Windows, 
libsybdb.so on *NIX)

- readme.txt (some info for users/developers)
4. according to market share of MS SQL Server and Sybase there may be 
many users, which will welcome alternative to TODBCConnection
5. there is on http://www.freepascal.org/future.var in "Improve the 
database support" > "Drivers (descendants) for more database types" so I 
understand it as FPC is open for new stuff ;-)
6. if there is any problem please let us know. If you decide to include 
it into fcl-db then you can place files for example into src/sqldb/mssql 
folder ;-)

TIA
-Laco.

Hi,

As you can see here http://bugs.freepascal.org/view.php?id=17303 the
developer known to LacaK developed a new connector for MSSQLServer,
descendant of TSQLConnection class, and sent the beta code in
2010-08-30.

Some developers discussed the new code here:
http://lazarus.freepascal.org/index.php/topic,15135.msg80922.html#msg80922

I'm already using this connector in production without problems.

To FPC core team:
Could you take a look in that component and think about included this
code in SVN to new developers use too, please?

Thanks,
Marcos Douglas

PS: this message was posted in lazarus-list and fpc-pascal, but I was
wrong because nobody answer me about YES or NOT. So, I think this is
the right list, don't?
___
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