Re: [fpc-pascal] SqlDB TSQLQuery sqoAutoApplyUpdates does not work with ExecSQL

2022-12-16 Thread Andi Friess via fpc-pascal

Am 16.12.2022 um 08:50 schrieb Michael Van Canneyt via fpc-pascal:

ApplyUpdates as you use it, is not the correct solution.
Once more: ApplyUpdates ONLY makes sense after changing data and doing a
Post. Any other use does not make any sense.


Data is changed by the SP. But this is done in a simpy open in the
query. No insert or delete of the Query is activated. It must be done
with open, because a resultset is returned. This can not be handled by
ExecSQL (maybe ia wrong).


"after changing data" must be understood as 'you change data in the
dataset', i.e. a post or delete operation on the dataset.

TDataset cannot know what happens behind the scenes in a stored procedure.

But it opens a transaction without close it.
If i look before fire the open, the transaction is inactive, after the
open it is active and after the close it is still active.

This is not expected by me. The query creates a 'dangling' transaction.


Since you are not doing a Post(), ApplyUpdates does not apply, nor does
sqoAutoCommit. Both are relevant only afer a Post()  or Delete.

I will add some remarks to the documentation to make this more clear.

Thanks,
now it will be more clear.

But will it be better to add a TStoredProcedure to the SQLdb Components
as other componentsset do. This can better fullfill the special
requirements of Stored Procedures and Functions.

I know the work, but if "someone" make it, will it be accepted ? And yes
i know the freeTDS components have (some) limitation specially with SP
and returnvalues.



Michael.

___
fpc-pascal maillist  -  
fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SqlDB TSQLQuery sqoAutoApplyUpdates does not work with ExecSQL

2022-12-15 Thread Andi Friess via fpc-pascal

Am 15.12.2022 um 14:59 schrieb Michael Van Canneyt via fpc-pascal:



On Thu, 15 Dec 2022, Andreas Frieß via fpc-pascal wrote:


Post operation.


No, if you use a stored procedure on the MSSQL Server there can be
changes on tables. Without the ApplyUpdates these changes are not
persitent. If you close and reopen the connection ALL is lost. With
ApplyUpdates it works.


Yes, but the reason is a side effect of using ApplyUpdates. See below.

ApplyUpdates as you use it, is not the correct solution.
Once more: ApplyUpdates ONLY makes sense after changing data and doing a
Post. Any other use does not make any sense.


Data is changed by the SP. But this is done in a simpy open in the
query. No insert or delete of the Query is activated. It must be done
with open, because a resultset is returned. This can not be handled by
ExecSQL (maybe ia wrong).



If you test the SP in the MSSQL-Studio it works, with Lazarus without
the ApplyUpdates not.


That is because you're not doing a commit of the transaction. It has
nothing to do with "needing to call ApplyUpdates".

By default, the transaction is rolled back when you close. You must
explicitly commit the transaction.

Only when i close the connection, but not when i close the Query.


This happens implicitly by ApplyUpdates,
which is what led you to believe there is an error.


This is correct, i have to explicit close the transaction, because
sqoAutoCommit does seems not to work as expected.

I can see the tranaction is active, but the query doesnt recognize it.
After the transaction.commit the the transaction is inactive and the
data is stored.


Michael.

___
fpc-pascal maillist  -  
fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fcl-report - Aggregates are initialized on every page - duplicat exception in expressionparser

2019-12-29 Thread Andi Friess

Hello,

i have found out, if i make a report with more than one page and with
aggregate variables, this variables are initialized more than once in
procedure TFPCustomReport.InitializeAggregates(IsFirstPass : Boolean);
 and this raise and exception, because the variables are duplicates.
The exception is correct.

The reason is, InitializeAggregates is called for every page in the
designed report and not once.

To test this, make a report with Aggregates and design more than one
page. Then run the report -> exception.

Andreas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Fwd: Re: fcl-report demos not working on windows10/64 with win64 compiled - Font Arial not found

2019-12-28 Thread Andi Friess

Hello,

i think there is a problem with definiton of HumanFriendlyName and
PostScriptName.

it looks like the Arial font is the default (parent font) under windows.
But the name Arial is not correct, it should be translated to the
correct PostScriptFontName = ArialMT. Because a search in Font(Fontname)
 is as search with the postscriptname and not with the human readable
Font name.

Actual i have fixed this for me with
  fnt := gTTFontCache.FindFont(AFontName); // we are doing a
PostScript Name lookup (it contains Bold, Italic info)
in function TFPReportExportPDF.FindFontIndex(const ADoc: TPDFDocument;
const AFontName: string): integer;
but i think, this is not the soloution. It should be done in the
prepaering of the report.

Andreas

-- Human readable ... PostScriptname...Filename ---
Arial...ArialMT...C:\WINDOWS\Fonts\arial.ttf
Arial Bold...Arial-BoldMT...C:\WINDOWS\Fonts\arialbd.ttf
Arial Bold Italic...Arial-BoldItalicMT...C:\WINDOWS\Fonts\arialbi.ttf
Arial Italic...Arial-ItalicMT...C:\WINDOWS\Fonts\ariali.ttf
Arial Narrow...ArialNarrow...C:\WINDOWS\Fonts\ARIALN.TTF
Arial Narrow Bold...ArialNarrow-Bold...C:\WINDOWS\Fonts\ARIALNB.TTF
Arial Narrow Bold
Italic...ArialNarrow-BoldItalic...C:\WINDOWS\Fonts\ARIALNBI.TTF
Arial Narrow Italic...ArialNarrow-Italic...C:\WINDOWS\Fonts\ARIALNI.TTF
Arial Unicode MS...ArialUnicodeMS...C:\WINDOWS\Fonts\ARIALUNI.TTF
Arial Black...Arial-Black...C:\WINDOWS\Fonts\ariblk.ttf
AR JULIAN...ARJULIAN...C:\WINDOWS\Fonts\ARJULIAN.ttf

Liberation Sans
Bold...LiberationSans-Bold...C:\WINDOWS\Fonts\LiberationSans-Bold.ttf
Liberation Sans Bold
Italic...LiberationSans-BoldItalic...C:\WINDOWS\Fonts\LiberationSans-BoldItalic.ttf
Liberation Sans
Italic...LiberationSans-Italic...C:\WINDOWS\Fonts\LiberationSans-Italic.ttf
Liberation
Sans...LiberationSans...C:\WINDOWS\Fonts\LiberationSans-Regular.ttf
Liberation Sans Narrow
Bold...LiberationSansNarrow-Bold...C:\WINDOWS\Fonts\LiberationSansNarrow-Bold.ttf
Liberation Sans Narrow Bold
Italic...LiberationSansNarrow-BoldItalic...C:\WINDOWS\Fonts\LiberationSansNarrow-BoldItalic.ttf
Liberation Sans Narrow
Italic...LiberationSansNarrow-Italic...C:\WINDOWS\Fonts\LiberationSansNarrow-Italic.ttf
Liberation Sans
Narrow...LiberationSansNarrow...C:\WINDOWS\Fonts\LiberationSansNarrow-Regular.ttf
L

Am 27.12.2019 um 23:03 schrieb Michael Van Canneyt:


Hello,

Can we please tackle one problem at a time ?

The first problem is: Why is the "liberation sans" not found ?

Once we've established that, we can check why the fallback is not found,
and
perhaps the error message.

Michael.

On Fri, 27 Dec 2019, Andreas Frieß wrote:


Hello Michael,

if the font is not found, why is there not the correct indication of the
missing font ? The errormessage is in this case completly wrong.

If a fallback should be possible, it should work and not mask the
problem and create a false errormessage.

Maybe the font liberation Sans is not on a Windows10/64 machine, if this
is true i should see the message -> fpreport: Could not find the font
 in the font cache.
Or
-> EReportFontNotFound: >> Font not found: "Liberation Sans".

Andreas

Am 27.12.2019 um 16:00 schrieb Michael Van Canneyt:


As I said:

The demos do not use Arial on purpose. Probably it is used as a
fallback somewhere.

So the question is: why is the demo falling back to Arial ?

It means the actually used font (Liberation Sans, line 74 of rptjson)
is not found.

Michael.

On Fri, 27 Dec 2019, Andreas Frieß wrote:


The reason (with ReadStandardfonts inserted):

---
D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d
jsondata -f pdf
0 : Name -> Afghanistan
0 : Population -> 31628000
0 : Name -> Afghanistan
0 : Population -> 31628000
0 : Name -> Afghanistan
0 : Population -> 31628000
1 : Name -> Albania
1 : Population -> 2894000
2 : Name -> Algeria
2 : Population -> 38934000
3 : Name -> Angola
3 : Population -> 24228000
 some lines skipped .
155 : Name -> Zambia
155 : Population -> 15721000
156 : Name -> Zimbabwe
156 : Population -> 15246000
Exception at 0001000631E0: Exception:
fpreport: Could not find the font  in the font cache.
Heap dump by heaptrc unit of
"D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos\fcldemo.exe"
74069 memory blocks allocated : 101484860/101702272
74069 memory blocks freed : 101484860/101702272
0 unfreed memory blocks : 0
True heap size : 2785280 (320 used in System startup)
True free heap : 2784960

D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>
-
Original (without ReadStandardfonts) = Original

--
D:\data\lazdev\trunk64\fpcsrc\packages\fcl-report\demos>fcldemo -d
jsondata -f pdf
0 : Name -> Afghanistan
0 : Population -> 31628000
0 : Name -> Afghanistan
0 : Population -> 31628000
0 : Name -> Afghanistan
0 : Population -> 31628000
Exception at 00010004C36F: EReportFontNotFound:
Font not found: "Arial".
Heap dump by heaptrc unit of