Re: [fpc-pascal] FPC scripting suport

2008-05-29 Thread Lee Jenkins

MihaiR wrote:

Hello all,

Is there any component for FPS/Lazarus I can succesfully
use for scripting? I'd like to build an application that
can be enhanced by some simple functions stored into an
external script file so that functions can be edited. There
are simple functions with few parameters and which return
the result to the main application.
It is something like VAT calculation: main (compiled
application send price to the script function and script
function returns the VAT value). Of course this is a
simplified example, on my situation there are many
functions and I want one function to have configurable
formula content.



Also, Fast-Report's FastScript worksing FreePascal now.  It support 
PascalScript, JavaScript, BasicScript (ACK!) and C++Script.


It's commercial though.

--

Warm Regards,

Lee

"When my company started out, we were really, really, really, really small. 
Now...we're just really small."

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


[fpc-pascal] fpdoc enhancements

2008-05-29 Thread Michael Van Canneyt
Hi,

At the request of some people on the lists, 
I added the following enhancement to fpdoc:

If a method has no documentation node, the documentation will be searched
in the ancestor tree. The first parent with a documented node will be used,
and will be referred to from all overview pages.

This actually already existed. However, since makeskel emits nodes for
all methods, it probably was never noticed. 

So I have enhanced it with the following:

You can add a link tag:



This will look for the documentation in tparent.method. 
This can be used to speed up the process, and can also be used
to skip certain parents.

Note that this mechanism only works with methods of classes.

Additionally, I have enhanced makeskel, so it now has an option 
--disable-override
It will then no longer emit nodes for methods which have the 'override' 
directive.

Being busy with it anyway, I also added 2 more things:

--emit-declaration
which will put the declaration of an identifier in front of an element
node, in a comment node.

--sort-nodes
Writes the nodes sorted alphabetically - within the limit of a unit.
(obviously TChild.Method comes before TParent.Assign and so on)
 
Finally, the makeskel code has been cleaned up in general as well.

I didn't merge this to fixes.

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


Re: [fpc-pascal] Connecting SQL components to a propriety SQL server

2008-05-29 Thread Andreas Berger



I have a friend that has a product which is composed of an embedded system
spread around Brazil and communicating with a central PC. I am convincing him
to migrate some of his PC tools to Pascal in order to ease my help for him.
The question I have is this:  He has his own small SQL server on some of these
embedded cards and I would need to establish a connection via the database
components in Free Pascal to his SQL. I know nothing about SQL, only that Free
Pascal has interfaces to various SQL servers. How hard would it be to make an
interface to his SQL servers?



It depends very much. Does he have an API to access this SQL server ?
If so, it's just a matter of using this API to create an TSQLConnection.

If the connection happens on a low level, then it will be a bit harder.

  
By API do you mean an interpreter of the SQL commands, then yes. The 
connection is made either via Internet/TCP or Modem/PPP.


Andreas

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


Re: [fpc-pascal] another pqconnection patch

2008-05-29 Thread Joao Morais

Joao Morais wrote:
There are other problems, at least with timestamp field. Please wait 
another patch soon.


The following patch fixes the storage of floating point, time and 
timestamp fields on a pgsql database.


Patch is against trunk.

Joao Morais
Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp
===
--- packages/fcl-db/src/sqldb/postgres/pqconnection.pp  (revision 11126)
+++ packages/fcl-db/src/sqldb/postgres/pqconnection.pp  (working copy)
@@ -568,10 +568,16 @@
 for i := 0 to AParams.count -1 do if not AParams[i].IsNull then
   begin
   case AParams[i].DataType of
-ftdatetime : s := 
formatdatetime('-MM-DD',AParams[i].AsDateTime);
-ftdate : s := 
formatdatetime('-MM-DD',AParams[i].AsDateTime);
-  else
-s := AParams[i].asstring;
+ftDateTime:
+  s := FormatDateTime('-mm-dd hh:nn:ss', 
AParams[i].AsDateTime);
+ftDate:
+  s := FormatDateTime('-mm-dd', AParams[i].AsDateTime);
+ftTime:
+  s := FormatDateTime('hh:nn:ss', AParams[i].AsDateTime);
+ftFloat, ftCurrency:
+  Str(AParams[i].AsFloat, s);
+else
+  s := AParams[i].AsString;
   end; {case}
   GetMem(ar[i],length(s)+1);
   StrMove(PChar(ar[i]),Pchar(s),Length(S)+1);
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Connecting SQL components to a propriety SQL server

2008-05-29 Thread Michael Van Canneyt


On Thu, 29 May 2008, Andreas Berger wrote:

> I have a friend that has a product which is composed of an embedded system
> spread around Brazil and communicating with a central PC. I am convincing him
> to migrate some of his PC tools to Pascal in order to ease my help for him.
> The question I have is this:  He has his own small SQL server on some of these
> embedded cards and I would need to establish a connection via the database
> components in Free Pascal to his SQL. I know nothing about SQL, only that Free
> Pascal has interfaces to various SQL servers. How hard would it be to make an
> interface to his SQL servers?

It depends very much. Does he have an API to access this SQL server ?
If so, it's just a matter of using this API to create an TSQLConnection.

If the connection happens on a low level, then it will be a bit harder.

Without more information, it's hard to give advice.

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


[fpc-pascal] Connecting SQL components to a propriety SQL server

2008-05-29 Thread Andreas Berger
I have a friend that has a product which is composed of an embedded 
system spread around Brazil and communicating with a central PC. I am 
convincing him to migrate some of his PC tools to Pascal in order to 
ease my help for him. The question I have is this:  He has his own small 
SQL server on some of these embedded cards and I would need to establish 
a connection via the database components in Free Pascal to his SQL. I 
know nothing about SQL, only that Free Pascal has interfaces to various 
SQL servers. How hard would it be to make an interface to his SQL servers?


I'm sorry if the question may be unclear, but I don't know enough about 
SQL to ask more specifically. Maybe during the progress of this thread I 
can up my understanding and ask better questions :)


Regards,
Andreas

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


Re: [fpc-pascal] another pqconnection patch

2008-05-29 Thread Joao Morais

Joost van der Sluis wrote:

Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao
Morais:
the following patch fixes the storage of floating point numbers where 
the decimal point isn't a dot.


Two questions: does postgres always request a dot as decimal point?


Yes.


Or is 'str' locale-dependent?


Str is a fast and jurassic procedure declared in the system unit, which 
know nothing about locale.


There are other problems, at least with timestamp field. Please wait 
another patch soon.


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


Re: [fpc-pascal] another pqconnection patch

2008-05-29 Thread Jonas Maebe


On 29 May 2008, at 11:09, Joost van der Sluis wrote:

Two questions: does postgres always request a dot as decimal point?  
And

dos your code guarantee to use a dot as decimal point? Or is 'str'
locale-dependent?


str() is never locale-dependent.


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


Re: [fpc-pascal] another pqconnection patch

2008-05-29 Thread Joost van der Sluis
Op woensdag 28-05-2008 om 18:33 uur [tijdzone -0300], schreef Joao
Morais:
> the following patch fixes the storage of floating point numbers where 
> the decimal point isn't a dot.

Two questions: does postgres always request a dot as decimal point? And
dos your code guarantee to use a dot as decimal point? Or is 'str'
locale-dependent? Maybe better use FloatToStr with a given
locale-setting?

Joost

> Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp
> ===
> --- packages/fcl-db/src/sqldb/postgres/pqconnection.pp(revision
> 11085)
> +++ packages/fcl-db/src/sqldb/postgres/pqconnection.pp(working copy)
> @@ -568,6 +568,8 @@
>case AParams[i].DataType of
>  ftdatetime : s :=
> formatdatetime('-MM-DD',AParams[i].AsDateTime);
>  ftdate : s :=
> formatdatetime('-MM-DD',AParams[i].AsDateTime);
> +ftFloat,
> +ftCurrency : str(AParams[i].AsFloat, s);
>else
>  s := AParams[i].asstring;
>end; {case}


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


Re: [fpc-pascal] pqconnection patch

2008-05-29 Thread Joost van der Sluis
Op woensdag 28-05-2008 om 13:52 uur [tijdzone -0300], schreef Joao
Morais:

> The following patch fixes the reading of a bytea field from a PgSQL 
> database.

Thanks, applied.

> Btw is there someone working on pg's blob storage?

I don't know anything about pg's blob storage, except for the separate
functions to store and read blob-fields, given an OID. Problem with that
approach is that you can't tell if a field contains a blob or not.
Because the field doesn't contain a blob but a reference to a blob. How
can you detect that this a field in fact is such a reference?

So the only way to use pg's blob's is to let the programmer store the
blob's. But it would be usefull if we build a wrapper around this, yes.

Joost.

> Joao Morais
> platte tekst document bijlage (pgconnection.pp.patch)
> Index: packages/fcl-db/src/sqldb/postgres/pqconnection.pp
> ===
> --- packages/fcl-db/src/sqldb/postgres/pqconnection.pp(revision 11085)
> +++ packages/fcl-db/src/sqldb/postgres/pqconnection.pp(working copy)
> @@ -103,6 +103,7 @@
>SErrPrepareFailed = 'Preparation of query failed.';
>  
>  const Oid_Bool = 16;
> +  Oid_Bytea= 17;
>Oid_Text = 25;
>Oid_Oid  = 26;
>Oid_Name = 19;
> @@ -395,6 +396,7 @@
>   end;
>  //Oid_text   : Result := ftstring;
>  Oid_text   : Result := ftBlob;
> +Oid_Bytea  : Result := ftBlob;
>  Oid_oid: Result := ftInteger;
>  Oid_int8   : Result := ftLargeInt;
>  Oid_int4   : Result := ftInteger;
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-- 

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