Re: Migrations: A result was returned when none was expected.
Re: Migrations: A result was returned when none was expected.
- Subject: Re: Migrations: A result was returned when none was expected.
- From: Chuck Hill <email@hidden>
- Date: Fri, 07 Sep 2012 10:50:38 -0700
On 2012-09-07, at 10:30 AM, Miguel Torres wrote:
> public class DInAdminEOModel17 implements IERXMigration {
> public NSArray<ERXModelVersion> modelDependencies() {
> return null;
> }
>
> public void upgrade(EOEditingContext editingContext,
> EOAdaptorChannel channel, EOModel model) throws Throwable {
> ERXJDBCUtilities.executeUpdateScriptFromResourceNamed(channel, "Migrations/DInAdminEOModel17_Upgrade.sql", null);
The update will not expect a result. You probably need to split this into four steps and use executeSelect to run the procedure.
Chuck
> }
>
>
>
> public void downgrade(EOEditingContext editingContext,
> EOAdaptorChannel channel, EOModel model) throws Throwable {
> // whatever it takes to invert those
> }
> }
>
>
> On 07/09/2012, at 12:20, Chuck Hill <email@hidden> wrote:
>
>> How are you running this in Java?
>>
>>
>> On 2012-09-07, at 7:37 AM, Miguel Torres wrote:
>>
>>> Hi List,
>>>
>>> I am getting this error:
>>>
>>> A result was returned when none was expected.
>>>
>>> I am executing a migration that creates a new table and a new procedure to insert some records to that table, because it has a reference to a table that already exists and may have some records. At the end of the migration, the procedure is dropped.
>>>
>>> I am calling the procedure using a SELECT statement (Postgresql).
>>>
>>> This is the content of my migration:
>>>
>>> CREATE TABLE empresa_pacs (
>>> tf_habilitar character varying(5) NOT NULL,
>>> tf_modo character varying,
>>> tf_certificado character varying,
>>> tf_vencimiento_certificado date,
>>> tf_contrasena character varying,
>>> empresa_id integer PRIMARY KEY REFERENCES empresa ON DELETE CASCADE
>>> );
>>>
>>>
>>> CREATE FUNCTION inserta_empresa_pacs() RETURNS VOID
>>> AS 'DECLARE empresa_temp empresa%ROWTYPE;
>>> BEGIN FOR empresa_temp IN SELECT * FROM empresa LOOP INSERT INTO empresa_pacs(empresa_id, tf_habilitar) VALUES(empresa_temp.empresa_id, ''false'');
>>> END LOOP;
>>> END;'
>>> LANGUAGE plpgsql;
>>>
>>> SELECT inserta_empresa_pacs() ;
>>>
>>> DROP FUNCTION inserta_empresa_pacs();
>>>
>>> I understand the error's meaning, I am asking if there are any other way to execute the migration to avoid the error.
>>>
>>> Thanks in advance.
>>>
>>> Miguel Torres.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>> --
>> Chuck Hill Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden