Troubles with datasetfield and Zeoslib

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
robsonselzelin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 09.07.2006, 20:56
Contact:

Troubles with datasetfield and Zeoslib

Post by robsonselzelin »

Hello everyone.

I'm using Zeoslib 6.5.1 Alpha (to access MySQL 5) on Delphi 6.

I'm using master/detail relationship between clientdasets by a datasetfield on the master clientdataset, but, when I open the master clientdataset, the detail fields have null values, although the detail clientdataset's recordcount property is greater than zero.

The same application with BDE (with ODBC) works fine. Debugging the Delphi's VCL, I noticed that in DB.pas unit, on TDataSet.OpenCursorComplete method, when the clientdataset state is changed to dsBrowse (in SetState method, line FState := Value;), with BDE, the Active property became True and fields got their values, but with Zeos that doesn't happen.

Can someone tell me what Zeoslib is supose to do, in the detail clientdataset, to get field values on this kind of master/detail relationship? Thanx.

P.S. Is necessary to say how to make the relationship between clientdatasets?
robsonselzelin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 09.07.2006, 20:56
Contact:

Post by robsonselzelin »

Well, I believe is better describe how to do the master/detail relationship:

- Create a Form and a DataModule;
- Change the creation order (Project/Options menu, Auto-create forms). Datamodule must be created first;
- Add one ZConection, two ZQuerys, two Clientdatasets, one Datasource and one DatasetProvider on the Datamodule;
- Set following propertys:

- Configure ZConnection;

- DataSource1:
DataSet: ZQuery1

- ZQuery1:
- Set Connection property;
SQL: select fields from master_table
- Double click on ZQuery1, right mouse button click, option Add All fields;

- ZQuery2:
- Set Connection property;
SQL: select fields from detail_table
- Double click on ZQuery2, right mouse button click, option Add All fields;
MasterSource: DataSource1
MasterField: Master field
IndexFieldNames: Detail field

- DatasetProvider:
Dataset: ZQuery1

- ClientdataSet1:
ProviderName: DataSetProvider1
- Double click on ClientdataSet1, right mouse button click, option Add All fields;

- ClientdataSet2:
DatasetField: ClientdataSet1ZQuery2 //Yes, this is the name of the TDataSetField created by ClientDataSet1
- Double click on ClientdataSet2, right mouse button click, option Add All fields;

The relationship is ready. File/Use Unit menu: DataModule2. To see the results, on Form1, put two dbnavigators, two dbgrids and two datasources. Configure following propertys:

- DataSource1:
DataSet: Datamodule2.ClientDataSet1

- DataSource2:
DataSet: Datamodule2.ClientDataSet2

Link dbnavigators and dbgrids properly and write following OnCreate's Form1 event:

DataModule1.ClientDataSet1.Close;
DataModule1.ClientDataSet1.Open;

For more details, see:

http://bdn1.borland.com/article/0,1410,29825,00.html
robsonselzelin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 09.07.2006, 20:56
Contact:

Post by robsonselzelin »

Hi folks.

If I can't solve this strange behavior I'll have to switch Zeos for BDE. Please, help me. Thanx.
silviogs
Junior Boarder
Junior Boarder
Posts: 42
Joined: 24.08.2005, 12:54
Location: The Most Oriental Point of America - João Pessoa - Brazil
Contact:

Post by silviogs »

Hi

first you could bring update zeoslib in link: http://users.telenet.be/mdaems/ to reinstall the package and to see if continue the error.

Yours truly

Silvio Guedes
robsonselzelin
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 09.07.2006, 20:56
Contact:

Post by robsonselzelin »

I updated my ZeosLib to the last version but, unfortunaly, nothing happened.

If you guys want a copy of the programs using BDE and Zeos with different behaviours, I can send you by email with table structures and data also.

With BDE you'll need MySQL ODBC driver that is in the following link:

http://dev.mysql.com/get/Downloads/MyOD ... .br/mysql/

To see how to set all the dataset's propertys, see this Borland article:

http://bdn1.borland.com/article/0,1410,29825,00.html

This kind of relationship between clientdatasets is recommended by Borland, i.e., it's not only me that do this :) I believe it's very important ZeosLib work fine with this kind of master/detail relationship and I hope I can help to solve the problem with my examples. Thanx.
ogecrom
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 16.12.2005, 12:47
Contact:

Post by ogecrom »

With Zeos 6.5.1 I had to set the dataset provider poFetchDetailsOnDemand to true. Then it got the correct values from the fields.
jose fermin
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 27.03.2007, 14:35

Post by jose fermin »

Somebody solved the problem??

I am using the new zeos components (6.6.1) and I set the dataset provider poFetchDetailsOnDemand to true, but nothing happens.

Somebody help me please!!
ogecrom
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 16.12.2005, 12:47
Contact:

Post by ogecrom »

I've followed the instructions posted by robsonselzelin on 09.07.2006 18:05.

But used TZReadOnlyQuery instead of TZQuery and NOT setted the master and link fields on the detail query and setted the provider poFetchDetailsOnDemand.

I'm sending an example that works fine for fetch and update data.
(the applyupdates is fired by a double click on the form, I was in a hurry and too lazy to put a button).

Please let me know if it works or not, and what database are you using.
You do not have the required permissions to view the files attached to this post.
jose fermin
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 27.03.2007, 14:35

Post by jose fermin »

Hi ogecrom, let me tell you that it not work.

I'm using delphi 7, postgresql 8.2.1 and zeos 6.6.1.

one question,

what is the property poUseQuotechar??

When I opened your project it show a error "unknown property in datasetprovider options".

These are my tables:

CREATE TABLE facturacion.articulo
(
codigo_articulo integer NOT NULL DEFAULT nextval('articulo_codigo_articulo_seq'::regclass),
descripcion_articulo character varying(50) NOT NULL,
referencia_articulo character varying(50),
costo_articulo numeric(11,2) DEFAULT 0.00,
existencia_articulo numeric(10,2) DEFAULT 0.00,
existencia_minima_articulo numeric(10,2) DEFAULT 0.00,
unidad_medida_articulo character varying(25),
fecha_vencimiento_articulo date,
ubicacion_articulo character varying(60),
codigo_grupo integer,
CONSTRAINT articulo_pkey PRIMARY KEY (codigo_articulo),
CONSTRAINT articulo_codigo_grupo_fkey FOREIGN KEY (codigo_grupo)
REFERENCES facturacion.grupo_articulo (codigo_grupo) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE SET NULL
)

CREATE TABLE facturacion.precio
(
codigo_pre integer NOT NULL DEFAULT nextval('precio_codigo_pre_seq'::regclass),
precio_pre numeric(11,2) DEFAULT 0.00,
porciento_pre numeric(11,2) DEFAULT 0.00,
itbis_pre numeric(11,2) DEFAULT 0.00,
codigo_articulo integer DEFAULT buscar_codigo('codigo_articulo'::character varying, 'articulo'::character varying),
CONSTRAINT precio_pkey PRIMARY KEY (codigo_pre),
CONSTRAINT precio_codigo_articulo_fkey FOREIGN KEY (codigo_articulo)
REFERENCES facturacion.articulo (codigo_articulo) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE SET NULL
)

CREATE TABLE facturacion.grupo_articulo
(
codigo_grupo integer NOT NULL DEFAULT nextval('grupo_articulo_codigo_grupo_seq'::regclass),
descripcion_grupo character varying(30) NOT NULL,
observacion_grupo text,
CONSTRAINT grupo_articulo_pkey PRIMARY KEY (codigo_grupo)
)

the example is with the two first tables.

Thanks for help me my friend.
jose fermin
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 27.03.2007, 14:35

Post by jose fermin »

I did the same to you, but show a error ClientDataSet1: cannot perform this operation on a closed dataset
jose fermin
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 27.03.2007, 14:35

Troubles with datasetfield and Zeoslib

Post by jose fermin »

This is part of my project
You do not have the required permissions to view the files attached to this post.
jose fermin
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 27.03.2007, 14:35

Post by jose fermin »

I hope in the future zeos components has its own datasetproviders and clientdatasets.

Go ahead guys!!
snikolaidis
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 25.07.2007, 07:24
Location: Thessaloniki, Greece

Post by snikolaidis »

jose fermin wrote:I did the same to you, but show a error ClientDataSet1: cannot perform this operation on a closed dataset
Hi to all!

I'm new in ZeosLib; I want to replace the dbExpress library with ZeosLib, but I have exactly the same problem described by Jose.

Is there any solution?

Thank you in advance.
Stratos Nikolaidis
Thessaloniki, Greece
Post Reply