You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Eric Schmidt <Er...@concur.com> on 2001/12/14 02:02:12 UTC

Turbine 2.1 / Torque / Oracle

I am working with Turbine 2.1 / Torque for Oracle and considering submittal
of a patch. I am new to all of this so I would appreciate it if someone
let's me know if I'm wasting my time; I haven't found any related
discussion.

Using the org.apache.turbine.torque.TorqueSQLTask class and the release
version of torque\templates\sql\base\oracle\drop.vm results in a schema.sql
that does non-conditional DROPs of tables:

	drop table $table.name cascade constraints;

	create table $table.name
	{...};

The resulting sql will only work against instances where tables of name
$table.name exist; i.e. the script can't (as far as I can tell) be used to
create the initial schema structure.

I see two options

1.
Don't do anything in drop.vm
Prepare the database by calling another script which drops the tables

This allows the sql to be used against new and existing instances. It puts
the burden of clearing out any schema on the caller / build step

2.
Modify drop.vm to do conditional drops. Something like the following:

begin for r in 
	(select 1 from user_tables where table_name = $table.name)
	loop
		execute immediate 'drop table $table.name';
	end loop;
end;


Any comments or suggestions would be appreciated.

Thanks,

Eric Schmidt

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Turbine 2.1 / Torque / Oracle

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Eric Schmidt <Er...@concur.com> writes:

> I am working with Turbine 2.1 / Torque for Oracle and considering submittal
> of a patch. I am new to all of this so I would appreciate it if someone
> let's me know if I'm wasting my time; I haven't found any related
> discussion.

If you do want to submit patches for Torque, please do it against the
standalone repository (jakarta-turbine-torque CVS module).

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Turbine 2.1 / Torque / Oracle

Posted by Age Mooy <am...@home.nl>.
If you use the insert-sql (and insert-sql-file) targets in the project build file to insert you schema into
Oracle you will have no problems. "Table does not exist" errors will be ignored and your schema is created
fine the first time.

Age

> -----Original Message-----
> From: Eric Schmidt [mailto:EricS@concur.com]
> Sent: Friday, December 14, 2001 02:02
> To: 'turbine-dev@jakarta.apache.org'
> Subject: Turbine 2.1 / Torque / Oracle
>
>
> I am working with Turbine 2.1 / Torque for Oracle and considering submittal
> of a patch. I am new to all of this so I would appreciate it if someone
> let's me know if I'm wasting my time; I haven't found any related
> discussion.
>
> Using the org.apache.turbine.torque.TorqueSQLTask class and the release
> version of torque\templates\sql\base\oracle\drop.vm results in a schema.sql
> that does non-conditional DROPs of tables:
>
> 	drop table $table.name cascade constraints;
>
> 	create table $table.name
> 	{...};
>
> The resulting sql will only work against instances where tables of name
> $table.name exist; i.e. the script can't (as far as I can tell) be used to
> create the initial schema structure.
>
> I see two options
>
> 1.
> Don't do anything in drop.vm
> Prepare the database by calling another script which drops the tables
>
> This allows the sql to be used against new and existing instances. It puts
> the burden of clearing out any schema on the caller / build step
>
> 2.
> Modify drop.vm to do conditional drops. Something like the following:
>
> begin for r in
> 	(select 1 from user_tables where table_name = $table.name)
> 	loop
> 		execute immediate 'drop table $table.name';
> 	end loop;
> end;
>
>
> Any comments or suggestions would be appreciated.
>
> Thanks,
>
> Eric Schmidt
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>