Search found 77 matches

by dschuch
Fri 05 Mar 2021 11:53
Forum: PostgreSQL Data Access Components
Topic: Speeding up Master/detail browsing
Replies: 3
Views: 18570

Re: Speeding up Master/detail browsing

Hi,

are u sure that disablecontrolls diables master/detail?

I have to check this everytime again if i run through that. It disables the visual controls, but master details too?

in every case possible:
  • remove the master source and set again after
    close the detail dataset and reopen
dont forgett try finally.


Look for "NotifyDetails" as well as "ControlsDisabled "

Code: Select all

procedure TDataSet.DataEvent(Event: TDataEvent; Info: Longint);

  procedure NotifyDetails;
  var
    I: Integer;
  begin
    if Assigned(FNestedDataSets) then
    begin
      if State <> dsInsert then UpdateCursorPos;
      for I := 0 to FNestedDataSets.Count - 1 do
        with TDataSet(FNestedDataSets[I]) do
          if Active then DataEvent(deParentScroll, 0);
    end;
    if (State = dsBlockRead) then
      for I := 0 to FDataSources.Count - 1 do
        TDataSource(FDataSources[I]).NotifyLinkTypes(Event, Info, False);
  end;

var
  I: Integer;
  NotifyDataSources: Boolean;
begin
  NotifyDataSources := not (ControlsDisabled or (State = dsBlockRead));
  case Event of
    deFieldChange:
      begin
        if TField(Info).FieldKind in [fkData, fkInternalCalc] then
          SetModified(True);
        UpdateCalcFields;
      end;
    deFieldListChange:
      FieldList.Updated := False;
    dePropertyChange:
      FieldDefs.Updated := False;
    deCheckBrowseMode:
      CheckNestedBrowseMode;
    deDataSetChange, deDataSetScroll:
      NotifyDetails;
    deLayoutChange:
      begin
        FieldList.Updated := False;
        if ControlsDisabled then
          FEnableEvent := deLayoutChange;
      end;
    deUpdateState:
      if ControlsDisabled then
      begin
        Event := deDisabledStateChange;
        Info := Integer(State <> dsInactive);
        NotifyDataSources := True;
        FEnableEvent := deLayoutChange;
      end;
  end;

  if NotifyDataSources then
  begin
    for I := 0 to FDataSources.Count - 1 do
      TDataSource(FDataSources[I]).DataEvent(Event, Info);
    if FDesigner <> nil then FDesigner.DataEvent(Event, Info);
  end;
end;
by dschuch
Fri 05 Mar 2021 11:43
Forum: PostgreSQL Data Access Components
Topic: Release Note "Work in a multi-threaded environment through a single connection is supported"
Replies: 1
Views: 15331

Release Note "Work in a multi-threaded environment through a single connection is supported"

Hi,

can u give some more information about this. What das it mean?

SELECTs are isolated? Executes as well? So everything running against the server is checking if the connection is used by another thread and waits for?

I not not think that u call a syncronize for scroll events and so on?

Thanks,
Daniel.
by dschuch
Sun 19 Jan 2020 14:21
Forum: PostgreSQL Data Access Components
Topic: Bug with *TCRFieldDesc.TableInfo.TableName* (worked in Version 5)
Replies: 1
Views: 3690

Bug with *TCRFieldDesc.TableInfo.TableName* (worked in Version 5)

There is a new bug in TCRFieldDesc(FieldDesc).TableInfo.TableName since Version 6. In Versions 5.3.9 and earlier this worked fine.

I create 2 Tables and JOIN them.
TCRFieldDesc(FieldDesc).TableInfo.TableName will hold the wrong table.

Try this view lines of code and you will see it.

Create tables - Statement:

Code: Select all

DROP TABLE IF EXISTS first;
CREATE
-- TEMP
TABLE first
(
  id SERIAL,
  context character varying(32)
);

DROP TABLE IF EXISTS second;
CREATE
-- TEMP
TABLE second
(
  id integer,
  second_first_id integer,
  context character varying(32)
);

-- Query to select Data

SELECT
 first.context AS first_ctx,
 second.context AS second_ctx,
 *
FROM
 first LEFT JOIN second ON first.id = second_first_id

Code: Select all

 var Q1 : TPgQuery;
 ...
 for I := 0 to Q1.FieldCount - 1 do begin
     FieldDesc := TCustomDADataSet(Q1).GetFieldDesc(Q1.Fields[I]);
     MemoSQLLog.Lines.Add(Q1.Fields[I].FieldName + ' -> ' + TCRFieldDesc(FieldDesc).TableInfo.TableName)
 end;
if you execute this - this error occurs:

Code: Select all

first_ctx -> first
second_ctx -> first   !!!!!!!!!!!!!!!!!!!!! WRONG !!!!!!!!!!!!!!!!!!!!!!!
id -> first
context -> first
id_1 -> second
second_first_id -> second
context_1 -> second
BTW:
if you execute this with temp tables everything is fine:
commt in the --TEMP blocks

Code: Select all

-- CREATE TABLES as TEMP tables (use Script above)
SELECT
 first.context AS first_ctx,
 second.context AS second_ctx
FROM
 first LEFT JOIN second ON first.id = second_first_id
 ========================== 
first_ctx -> first
second_ctx -> second
by dschuch
Sun 19 Jan 2020 11:31
Forum: PostgreSQL Data Access Components
Topic: Strange Bug with Comments and PGScript
Replies: 2
Views: 4931

Re: Strange Bug with Comments and PGScript

Hi, anyone took a look into this? The bug is also in the latest release: 6.1.2.

See first posting. Try to execute this lines in PgScript with ";" es default delemiter.
by dschuch
Tue 08 Oct 2019 13:45
Forum: PostgreSQL Data Access Components
Topic: Strange Bug with Comments and PGScript
Replies: 2
Views: 4931

Re: Strange Bug with Comments and PGScript

Another Example: try to execute this statement in a PGScript. (With comment Lines at the end)

Code: Select all

-- Info: "WITHOUT TIME ZONE" nicht mehr nötig - TIMESTAMP wurde mit Postgre 7.3 dem SQL-Standard angepasst und ist jetzt standardmäßig ohne TIMEZONE
CREATE OR REPLACE FUNCTION currenttime() 
RETURNS timestamp AS $$
  SELECT date_trunc(
      'second', 
      transaction_timestamp()::timestamp
  )
$$ LANGUAGE sql --
--
by dschuch
Tue 08 Oct 2019 11:30
Forum: PostgreSQL Data Access Components
Topic: Strange Bug with Comments and PGScript
Replies: 2
Views: 4931

Strange Bug with Comments and PGScript

Hi,

if u use a code like this, the PGScript will just do nothing. The reason is that the last comment is before the ";" (which is also the Default Delimiter)

Code: Select all

INSERT INTO a VALUES
 ('A'), -- Comment
 ('B')  -- Comment Last line
 ;
 
-Attached you find a TestApplication.-

* unable to find a button to upload an example. just execute this SQL Statement in a simple PGScript and you will see: nothing happens

Question: is there is any way to prevent the PGScripter from splitting the Statement? We want to execute the Script as one statement (with comments, which are also thrown away)
Actually i made it with typing "NEVER FIND THIS DELIMITER" in the Delimited Property.
by dschuch
Wed 06 Mar 2019 13:39
Forum: PostgreSQL Data Access Components
Topic: Clear DataSet Records without Server call (Primary Key is NULL)
Replies: 1
Views: 5174

Clear DataSet Records without Server call (Primary Key is NULL)

Hi,
i'm looking for a possibility to clear all the actuall loaded data in a PGQuery. (Only Records, Fields should stay)

Background: we have a rule, if a parameter is NULL than there is never a result.

So i want to implement for example before refresh: if param is null then dataset.ClearRecords to avoid the server call. (there are very many null requests). additionally its important to keep the dataset open.

so is there is a way to do this? PGQuery.TData.??? or override some function?

Thanks.
by dschuch
Fri 12 Aug 2016 19:18
Forum: PostgreSQL Data Access Components
Topic: FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)
Replies: 4
Views: 7170

Re: FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)

dschuch wrote:? Please take a look in your sources:

The question is why you switch of the DetailDelay functionality on Android.
There is no Error, the function is just switched out by your compilerdirectives and the question is why.

Your Source:

Code: Select all

Unit MemDS

uses
{$IFDEF MSWINDOWS}
  {$IFNDEF FPC}Windows,{$ENDIF}
  CRTimer,
{$ENDIF}
IFDEF MSWindows > Use crTimer, FMX no? Why?

Your Source: we modified it by commenting out the IFDEF MSWINDOWS

Code: Select all

procedure TMemDataSet.MasterRecordChanged;
    if MDLinksRefreshed then begin // need refresh
//        {$IFDEF MSWINDOWS}
      if (FDetailRefreshTimer <> nil) and (FDetailRefreshTimer.Interval <> 0) then begin
        FDetailRefreshTimer.Enabled := False; //reset time period
        FDetailRefreshTimer.Enabled := True;
      end
      else
//    {$ENDIF}
        RefreshDetail(nil);
Why this compiler directives? Why switch out the DetailDelay functionality on Android. We commented out all your compilerswitches and immediatly its working with crTimer on Android.

Daniel.
by dschuch
Fri 12 Aug 2016 19:17
Forum: PostgreSQL Data Access Components
Topic: FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)
Replies: 4
Views: 7170

Re: FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)

? Please take a look in your sources:

The question is why you switch of the DetailDelay functionality on Android.
There is no Error, the function is just switched out by your compilerdirectives and the question is why.

Your Source:

Code: Select all

Unit MemDS

uses
{$IFDEF MSWINDOWS}
  {$IFNDEF FPC}Windows,{$ENDIF}
  CRTimer,
{$ENDIF}
IFDEF MSWindows > Use crTimer, Android no? Why?

Your Source:

Code: Select all

procedure TMemDataSet.MasterRecordChanged;
    if MDLinksRefreshed then begin // need refresh
//        {$IFDEF MSWINDOWS}
      if (FDetailRefreshTimer <> nil) and (FDetailRefreshTimer.Interval <> 0) then begin
        FDetailRefreshTimer.Enabled := False; //reset time period
        FDetailRefreshTimer.Enabled := True;
      end
      else
//    {$ENDIF}
        RefreshDetail(nil);
Why this compiler directives? Why switch out the DetailDelay functionality on Android. We commented out all your compilerswitches and immediatly its working with crTimer on Android.

Daniel.
by dschuch
Wed 10 Aug 2016 16:38
Forum: PostgreSQL Data Access Components
Topic: FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)
Replies: 4
Views: 7170

FMX/Android, crTimer / TCRTimer Disabled (Compilerswitch)

Hi,

currently we port some parts of our application to Android. Everything is working fine.

But why do you have switched of crTimer? It seems useless. If we undo the compilerdirectives, everything is working fine. DetailDelay ...

Bug/ from older Version?

Daniel.
by dschuch
Thu 21 Apr 2016 07:31
Forum: PostgreSQL Data Access Components
Topic: Clientside Locate, Indexes, Speed, Locate Options
Replies: 1
Views: 5445

Clientside Locate, Indexes, Speed, Locate Options

Hi,

we have some bigger Clientside DataSets, that hold cached informations, for example FieldStructures and so on. The DataSet can be lets say 20.000 Records.

The Problem is that the Locate Speed is very very slow and so we are looking for a way how to speed up this. It seems there is no option to use Local Indexes for speeding up Locate? Locate calls can be up to 3000 on a Form Creation and it takes nearly one second.

Out current solution is to use a TDictionary and Save the locate Keys and there corresponding RecNo. If the Key is Searched a 2nd one the TDictionary will give back the Recno and so its fast.

Perhaps there is another Solution how to speed up locate?

Code: Select all

CacheGridFilter.Locate('il_group;il_item;gf_minr;gf_default;gf_deleted',
[ClassName, GridFilterSaveName(GridView), NULL, True, False])
Daniel.
by dschuch
Thu 09 Jul 2015 09:46
Forum: PostgreSQL Data Access Components
Topic: Stream Error/Manipulation with BYTEA and Unprepared Execute=True
Replies: 4
Views: 2483

Re: Stream Error/Manipulation with BYTEA and Unprepared Execute=True

thx, is it is possible to get the sourcecode-snipped (diff), so we can checkout the fix it and fix it in our release immediatly. if it is much work we will wait for the next relase, no problem. (acutally we switched PreparedExecute to true for the affected Query)
by dschuch
Fri 03 Jul 2015 10:05
Forum: PostgreSQL Data Access Components
Topic: Stream Error/Manipulation with BYTEA and Unprepared Execute=True
Replies: 4
Views: 2483

Stream Error/Manipulation with BYTEA and Unprepared Execute=True

Hi,

PGDAC 4.5.14

When storing binary data in a BYTEA field with unpreparedExecute=True, the data is manipulated and corrupted. Please check out the following Testcode. Attached u have an example file (this is a DevExpress Filter File).

http://prodat-sql.de/tmp/Testfilter.dat

Can u reproduce the error?

Thanks, Daniel.

Code: Select all

procedure TForm1.Button4Click(Sender: TObject);
var
  Data1, Data2: TFileStream;
  B:            Byte;
  A1, A2:       TBytes;
begin
  Data1 := TFileStream.Create('S:\Testfilter.dat', fmOpenRead);
  Data2 := TFileStream.Create('S:\Testfilter_pg.dat', fmCreate);
  try
    PgQuery2.Connection := DM1.DataBase1;
    PgQuery1.Connection := DM1.DataBase1;

    //PgQuery1.Options.UnknownAsString := True;  // This one has no effect.
    PgQuery1.Options.UnpreparedExecute := True;  // The GUILTY.

    PgQuery1.SQL.Text :=
        'CREATE TABLE IF NOT EXISTS datatest ( '#10
      + '  ident SERIAL PRIMARY KEY, '#10
      + '  data  BYTEA '#10
      + ');';
    PgQuery1.Execute;

    PgQuery1.Close;
    PgQuery1.SQL.Text := 'SELECT * FROM datatest';
    PgQuery1.Open;
    PgQuery1.Locate('ident', 0, []);
    PgQuery1.Edit;
    PgQuery1.FieldByName('ident').AsInteger := 0;
    //TBlobField(PgQuery1.FieldByName('data')).LoadFromFile('S:\Testfilter.dat');
    TBlobField(PgQuery1.FieldByName('data')).LoadFromStream(Data1);
    PgQuery1.Post;

    PgQuery2.Close;
    PgQuery2.SQL.Text := 'SELECT * FROM datatest WHERE ident = 0';
    PgQuery2.Open;
    //TBlobField(PgQuery2.FieldByName('data')).SaveToFile('S:\Testfilter_pg.dat');
    TBlobField(PgQuery2.FieldByName('data')).SaveToStream(Data2);

    Data2.Position := $34;
    Data2.ReadBuffer(B, 1);
    if B <> $85 then
      ShowMessage('byte modified');

    SetLength(A1, Data1.Size);
    SetLength(A2, Data2.Size);
    Data1.Position := 0;
    Data2.Position := 0;
    Data1.ReadBuffer(A1[0], Length(A1));
    Data2.ReadBuffer(A2[0], Length(A2));
    if (Length(A1) <> Length(A2)) or not CompareMem(@A1[0], @A2[0], Length(A1)) then
      ShowMessage('data modified');
  finally
    Data1.Free;
    Data2.Free;
  end;
end;
by dschuch
Sun 26 Apr 2015 13:49
Forum: SQLite Data Access Components
Topic: Can SQLite Access other DevArt DataSet?
Replies: 7
Views: 3221

Re: Can SQLite Access other DevArt DataSet?

Thanks, please inform us, if ready, so we can kill FireDAC SQL Lite from our Project. ;)