How to use OnRefreshSQL on ZUpdateSQL & SVN

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
irw10062
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 27.02.2009, 07:12

How to use OnRefreshSQL on ZUpdateSQL & SVN

Post by irw10062 »

i'm trying migrate to Zeos from MySQLDAC, (for multidatabase purpose).
Spek, MySQL5.0.41 + WinXPSP3

i have 4 question :

1. I'm using ZUpdateSQL and found OnRefreshSQL, how and when i use this property


2.Because i'm using join query, i use ZQuery and ZUpdateSQL, but afer insert row, i got blank field on join field after post. after i refresh dataset i got correct field join. why it could be... when i m using DAC, it didn't, i miss something ...???


3.And sometime, i got message Error Post like this "field nm_pejatasan is required, but not supplied", i checked InsertSQL is right. when i create field in design time, and set required = false, and run, the error message doesn't appear. may i use it without create field in design time..


4.I'm using SVN, and got direktori structure :
-branches
-tags
-trunk
for latest source, where should i use when i want use latest fix from ZeosTeam

(i'm include attach sample+sql file for someone want to test & help me)

Thanks for response

Salam
You do not have the required permissions to view the files attached to this post.
irw10062
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 27.02.2009, 07:12

Post by irw10062 »

User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

1. OnRefreshSQL : I suppose there's no Event with this name? I didn't find it in the code. Probably you're talking about the RefreshSQL property. This property is the query you can use to refresh an updated row. It's used the same way you use the UpdateSql property. The fetched fields that have a corresponding column in the dataset are used to refresh the data in that column for the updated row.
2. When doing automatic updates the auto increment ID's are fetched automatically by zeoslib (for mysql), but when using the TZUpdateSQL component you'll need RefreshSQL. I suppose MyDAC had a special handling to fetch the last_insert_id automatically.
When using multidatabase stuff it will be difficult anyway. Not all databases provide an easy way to show what columns are auto-incremented and have a function to retrieve the last_insert_id automatically.
3. I suppose nm_pejatasan is defined as 'not null' on the database. So zeoslib supposes it must be filled by the user. Best way is to do it like you did and set the required property to false. In some cases zeoslib is smart enough to recognize the field as autoinc, but I don't know if that's true in your case. And we had a bug quite recently, so it may even be version dependent.
4. Short SVN summary :
/trunk/ : stablest development version. NOT STABLE (use at own risk)
/tags/ : contains every version we released
/branches/testing/ : the development branch we we develop and test before moving a feature to trunk (even less stable than trunk)
/branches/6.6-patches/ : the version you may need. It contains the stable version AND the bug fixes we did to that version.

As a normal user of zeoslib you need only a checkout of the /branches/6.6-patches/ directory. So never checkout the full structure. That eats disk space and is useless.

Mark
Image
irw10062
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 27.02.2009, 07:12

Post by irw10062 »

Tq 4 attention,

1. yes, it's property, not event. is there any sample how to use this property, i dont know
how to write RefreshSQL property , if my ZQuery SQL like this :

SELECT
tblpejabat.kd_pejabat,
tblpejabat.nm_pejabat,
tblpejabat.tipePejabat,
tbltipekaryawan.nm_typekary,
tblpejabat.kd_pejAtasan,
tblpejatasan.nm_pejabat as nm_pejAtasan,
tblpejabat.kd_divisisls,
tbldivisisls.nm_divisisls,
tblpejabat.kum
FROM tblpejabat
left outer join tblpejabat as tblpejatasan on (tblpejabat.kd_pejAtasan = tblpejatasan.kd_pejabat)
left outer join tbldivisisls on (tblpejabat.kd_divisisls = tbldivisisls.kd_divisisls)
left outer join tbltipekaryawan on (tblpejabat.tipepejabat = tbltipekaryawan.kd_typekary)

u can use my sample & structure sql, may be i miss something.... i'm new on zeos....

2. so i must knew how to get last insert id and refresh it.... but dont know how to do that...

3. if u see my ZQuery SQL, nm_pejatasan is "left outer join" table, and if u see Query on ModifySQL or InsertSQL,
nm_pejatasan is not in query, this is on ModifySQL :

UPDATE tblpejabat SET
tblpejabat.kd_pejabat = :kd_pejabat,
tblpejabat.nm_pejabat = :nm_pejabat,
tblpejabat.tipePejabat = :tipePejabat,
tblpejabat.kd_pejAtasan = :kd_pejAtasan,
tblpejabat.kd_divisisls = :kd_divisisls,
tblpejabat.kum = :kum
WHERE
tblpejabat.kd_pejabat = :OLD_kd_pejabat

if i didn't update nm_pejatasan field, why should i set required to false, i think this field must be ignore because it's not update ????
and if i use like this, i should always create design time table ???? i dont like to use design time table


4. good explain Sir


Regards,


Irwan
Post Reply