ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <>
Subject Re: Using SQL query result as a property, how?
Date Thu, 08 Feb 2007 15:48:15 GMT
On 2/8/07, Hans Schwaebli <> wrote:
> I have a SQL query which returns one result like 388291. I want to use that result as
a property.
>   How can this be done in Ant?
>   In a script language like Python (haha) this is no problem. But how to solve it with
>   If I use the SQL-Task I only can write the result to disk. It looks like this:
>    78721
>    0 rows affected
>   If I could return the result in a result property, it would be okay, if "0 rows affected"
would not be part of it.
>   Any solution?

Write custom tasks, in Java, to encapsulate your specific needs. As
evidenced by your other posts, you are misinterpreting the purpose of
Ant. Ant is designed to declaratively express the steps of the builds,
and their interdependencies. It also provides high level declarative
tasks expressing actions to perform for each step. But the complex
programmatic logic (or scripted logic) is hidden in these high level
"action" tasks, where you have access to a "real" programming
language, Java.

Until you realize this, you'll "pollute" your Ant build files (which
are abusively called Ant scripts) with low-level scripting aspects.
I'm not trying to insult you Hans. I'm trying to express, perhaps a
bit forcefully after reading your other posts, that you seem to be
"fighting" Ant, by ignoring the "Ant way", which is again to create
new Java tasks for the more complex logic that cannot easily be, and
shouldn't be in fact, expressed in the build file directly.

That said, I'll go back in my little corner, having expressed my own
opinion, as you've said in your recent posts. Good luck with Ant.
Cheers, --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message