ZQuery.MacroByName()

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

Moderators: gto, EgonHugeist

rodrigosd
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 14.10.2009, 15:59

ZQuery.MacroByName()

Postby rodrigosd » 15.10.2009, 13:12

In a "very old" version of Zeos we had the property "Macros" and we could use "MacroByName()" ...
There is some way to do that in Zeos 6.6.5 ?
Thanks

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

Postby mdaems » 16.10.2009, 19:06

No idea what the functionality of this property was. That's long before my zeoslib time, I'm afraid.
If you explain the function we could see
- if there's something similar
- if it would be right to re-implement

Of course, if you still have the right version where it existed, that could be very helpful.

Mark
Image

rodrigosd
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 14.10.2009, 15:59

Postby rodrigosd » 16.10.2009, 20:20

I'm using the version '50300' as zeos.inc. Now I'm tring to update to the newest one. I know that I could reformulate all the querys to use "query.sql[X] := something", but all the system is implemented using macros and params. An example:

SQL

Code: Select all

 SELECT *
 FROM people
 WHERE age > 30
 %macro

CODE

Code: Select all

if z then
  query.MacroByName('macro').AsString := 'AND gender = ''M'''
else
  query.MacroByName('macro').AsString := '';


if true the result query will be:

Code: Select all

SELECT *
 FROM people
 WHERE age > 30
 and gender = 'M'

else, just:

Code: Select all

SELECT *
 FROM people
 WHERE age > 30

I think that explains the use of macros.
Rodrigo

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

Postby mdaems » 18.10.2009, 12:42

Thanks. That explains the use of macro's very well.

Now, I have some little problems.
The main one is time. Just take it as a fact I can't spend time building new stuff at the moment. Just merging patches and getting/keeping the current stuff working is enough for me.

The second problem (compared to the original implementation that I don't know) might be the way to implement it in the current design. If you do it : keep it in the components layer. It might be a relatively easy job when you add a FRawSQL field to the TZReadOnly Query component and use it to set the FSQL property using Setter functions for a MacroParameters Array.

Would you think about adding the functionality? It's certainly not the same as using parameters. Parameters usually don't allow changes to the structure of the query. Your macro's would also allow new parts being added to the query.

Mark
Image

rodrigosd
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 14.10.2009, 15:59

Postby rodrigosd » 20.10.2009, 13:06

I'll try to add that.

Rodrigo

designshouse
Fresh Boarder
Fresh Boarder
Posts: 20
Joined: 21.11.2005, 10:13
Location: Pieštany
Contact:

Postby designshouse » 20.10.2009, 22:51

hi

i didnt test it but maybe this may work

query.Sql.Add('SELECT * FROM people');
query.Sql.Add('WHERE age > 30');
query.Sql.Add(':macro ');

if z then
query.ParamByName('macro').AsString := 'AND gender = ''M'''
else
query.ParamByName('macro').AsString := '';

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

Postby mdaems » 24.10.2009, 14:36

designshouse,
This can't work. When substituting the parameter zeoslib will add quotes around the value to be inserted in the string.

Mark
Image

rodrigosd
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 14.10.2009, 15:59

Postby rodrigosd » 28.10.2009, 20:41

So...
I already did the Macro's implementation.
Now I have to test it and all the other differences between the new version and the old version of zeos that I was ussing.

When I finish all that, how could I "commit" my implementations?!

Rodrigo

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

Postby mdaems » 01.11.2009, 22:50

Rodrigo,

You can send your changes to zeoslib at gmail dot com.
You're talking about 'other changes' you did. You'll have to explain them too when you want those applied as well.
So please, provide different patches for different changes. Normally the base version I'm working on is Testing branch, but when you provide patches against trunk or even 6.6-Patches that will do as well.
When you become more active and want SVN access I can arrange that, but you'll have to 'prove' your intensions first. Too much people have asked for it and when they got it they didn't use it.

Mark

Mark
Image

User avatar
tomazeli
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 21.11.2005, 17:08
Location: Montreal, Canada
Contact:

Re: ZQuery.MacroByName()

Postby tomazeli » 21.07.2014, 19:31

Hi Mark,

I know that is long time ago but I'm wondering if this functionality was implemented later on.
Did Rodrigo committed the actual code?

I'm converting an huge application from Delphi 6 +MySQL 4.01 + ZeosDB 5 with this feature and is heavy used to Delphi 6 + MySQL 5.6 + ZeosDB 6.6.6.

Any information will be very useful.

Thanks
Odimar Tomazeli


Return to “6.6 - stable”

Who is online

Users browsing this forum: No registered users and 1 guest