You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Meikel Bisping <M....@gmx.de> on 2005/02/12 20:33:23 UTC
Are there macros for generating SQL-dialects?
Hello,
has anyone created macros for generating SQL-dialects?
I'm thinking about using Velocity to write SQL queries which can be
processed to Postgres or Informix dialect.
e.g.
#macro( date $val )
#if ( $database == "Informix") date('$val')
#end
#if ( $database == "Postgres") date_val('$val')
#end
#end
select .. from .. where entry_date>#date('2005-01-01')
Cheers,
Meikel Bisping
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Are there macros for generating SQL-dialects?
Posted by Peter Harrison <pe...@nothingbutnet.co.nz>.
On Sunday 13 February 2005 08:33, Meikel Bisping wrote:
> Hello,
>
> has anyone created macros for generating SQL-dialects?
> I'm thinking about using Velocity to write SQL queries which can be
> processed to Postgres or Informix dialect.
Not exactly, but I have something that might do something similar,
The open source sysmod project is a code and schema generator. Basically the
schema is defined in a xml document. From the XML the persistance code and
database schema is generated.
Velocity is used to generate each file using templates. Currently we support
primarily postgresql, but there is no reason that other schemas couldn't be
supported. It has been designed in such a way that additional modules can be
added.
Although we mainly work with Java there is also basic PHP, Python and Delphi
generators. We only use Java however, so I'm not sure what state the other
generators are in.
The purpose of Sysmod is very similar to Hibernate and Middlegen together. It
certainly could create different SQL Schemas for different databases.
http://sysmod.sf.net
PS : Get it from CVS, as the current release is a tad broken.
PPS: I'm also working on views so you can hand code SQL.
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: Are there macros for generating SQL-dialects?
Posted by Florin Vancea <fv...@maxiq.ro>.
Torque does that, at least for DDL purposes. I don't know about Q and DML.
----- Original Message -----
From: "Meikel Bisping" <M....@gmx.de>
To: <ve...@jakarta.apache.org>
Sent: Saturday, February 12, 2005 9:33 PM
Subject: Are there macros for generating SQL-dialects?
> Hello,
>
> has anyone created macros for generating SQL-dialects?
> I'm thinking about using Velocity to write SQL queries which can be
> processed to Postgres or Informix dialect.
>
> e.g.
> #macro( date $val )
> #if ( $database == "Informix") date('$val')
> #end
> #if ( $database == "Postgres") date_val('$val')
> #end
> #end
>
> select .. from .. where entry_date>#date('2005-01-01')
>
> Cheers,
>
> Meikel Bisping
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org