[firebird-support] Computed field Dependencies

2013-04-08 Thread Gugui
Hi all,


I´m just trying to increase the varchar field type, so i´ve solved all 
the dependencies, but there is one that i can´t solve and it is a 
Computed Field type !

when i try:

ALTER TABLE CLIENTE ALTER RAZAO_SOCIAL TYPE VARCHAR(60);

returns:

Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536

in the RDB$DEPENDENCIES table:

RDB#DEPENDENT_NAME   RDB$DEPEPENDED_ON_NAME  RDB$FIELD_NAME 
RDB$DEPENDENT_TYPE
RDB$1536   CLIENTE   RAZAO_SOCIAL   3
RDB$1536   CLIENTE   IDCLIENTE 
  3
RDB$1536   PEDIDO  IDCLIENTE 
3
RDB$1536   CLIENTE  [null] 
  3


RDB$DEPENDENT_TYPE = 3 = Computed Field

how to solve it ?
thanks any help




Re: [firebird-support] Computed field Dependencies

2013-04-08 Thread Martijn Tonies
Hello Gugui,

> I´m just trying to increase the varchar field type, so i´ve solved all
> the dependencies, but there is one that i can´t solve and it is a
> Computed Field type !
>
> when i try:
>
> ALTER TABLE CLIENTE ALTER RAZAO_SOCIAL TYPE VARCHAR(60);
>
> returns:
>
> Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536
>
> in the RDB$DEPENDENCIES table:
>
> RDB#DEPENDENT_NAME   RDB$DEPEPENDED_ON_NAME  RDB$FIELD_NAME
> RDB$DEPENDENT_TYPE
> RDB$1536   CLIENTE   RAZAO_SOCIAL   3
> RDB$1536   CLIENTE   IDCLIENTE
>  3
> RDB$1536   PEDIDO  IDCLIENTE
>3
> RDB$1536   CLIENTE  [null]
>  3
>
>
> RDB$DEPENDENT_TYPE = 3 = Computed Field
>
> how to solve it ?

You cannot, easily. ;)

Download Database Workbench at www.upscene.com - alter the computed by field
and it will generate the required statements for you.

Note: it's tricky, but has been proven as working.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird! 



Re: [firebird-support] Computed field Dependencies

2013-04-09 Thread Gugui
Hi Martijn, i did what u said, but when i try to alter the field in 
Database Workbenc it shows me the same thing:

Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536

i cant find this dependencie, i´m so disappointed with Firebird :-(

could u explain me in detail how to do that ?

thanks a lot



Em 08-04-2013 10:32, Martijn Tonies escreveu:
>
> Hello Gugui,
>
> > I´m just trying to increase the varchar field type, so i´ve solved all
> > the dependencies, but there is one that i can´t solve and it is a
> > Computed Field type !
> >
> > when i try:
> >
> > ALTER TABLE CLIENTE ALTER RAZAO_SOCIAL TYPE VARCHAR(60);
> >
> > returns:
> >
> > Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536
> >
> > in the RDB$DEPENDENCIES table:
> >
> > RDB#DEPENDENT_NAME RDB$DEPEPENDED_ON_NAME RDB$FIELD_NAME
> > RDB$DEPENDENT_TYPE
> > RDB$1536 CLIENTE RAZAO_SOCIAL 3
> > RDB$1536 CLIENTE IDCLIENTE
> > 3
> > RDB$1536 PEDIDO IDCLIENTE
> > 3
> > RDB$1536 CLIENTE [null]
> > 3
> >
> >
> > RDB$DEPENDENT_TYPE = 3 = Computed Field
> >
> > how to solve it ?
>
> You cannot, easily. ;)
>
> Download Database Workbench at www.upscene.com - alter the computed by 
> field
> and it will generate the required statements for you.
>
> Note: it's tricky, but has been proven as working.
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>
> Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
> Anywhere, MySQL, InterBase, NexusDB and Firebird!
>
> 





++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [firebird-support] Computed field Dependencies

2013-04-09 Thread Martijn Tonies
Hi,

> Hi Martijn, i did what u said, but when i try to alter the field in 
> Database Workbenc it shows me the same thing:
>
> Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536
>
> i cant find this dependencie, i´m so disappointed with Firebird :-(
>
> could u explain me in detail how to do that ?

Hm, that is surprising.

Newer versions of Firebird support altering the COMPUTED BY clause.

What version of Firebird are you using?

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird! 





++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [firebird-support] Computed field Dependencies

2013-04-09 Thread Gugui
hi Marijn,

i´m using firebird-server-classic-2.1.3.18185.0-5mdv2010.0






Em 09-04-2013 10:31, Martijn Tonies escreveu:
> Hi,
>
>> Hi Martijn, i did what u said, but when i try to alter the field in
>> Database Workbenc it shows me the same thing:
>>
>> Column RAZAO_SOCIAL from table CLIENTE is referenced in RDB$1536
>>
>> i cant find this dependencie, i´m so disappointed with Firebird :-(
>>
>> could u explain me in detail how to do that ?
> Hm, that is surprising.
>
> Newer versions of Firebird support altering the COMPUTED BY clause.
>
> What version of Firebird are you using?
>
> With regards,
>
> Martijn Tonies
> Upscene Productions
> http://www.upscene.com
>
> Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
> Anywhere, MySQL, InterBase, NexusDB and Firebird!
>
>
>
> 
>
> ++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu.  Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++
> Yahoo! Groups Links
>
>
>
>





++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [firebird-support] Computed field Dependencies

2013-04-09 Thread Martijn Tonies
Hi,

> i´m using firebird-server-classic-2.1.3.18185.0-5mdv2010.0

In that case, here's how DBW does it for you:

// delete field dependencies for field "MYTESTFIELD"
delete from rdb$dependencies
where rdb$dependent_name = (select f.rdb$field_name
from rdb$fields f
join rdb$relation_fields rf on rf.rdb$field_source = f.rdb$field_name
where rf.rdb$relation_name = 'DML_TEST1' and rf.rdb$field_name = 
'MYTESTFIELD');

// add temporary test field
ALTER TABLE DML_TEST1 ADD DBW$$TEMP COMPUTED BY ( 'test' || 'moere' );

// copy generated BLR from temp test field to your test field
UPDATE rdb$fields SET RDB$COMPUTED_BLR = (select RDB$COMPUTED_BLR from 
rdb$fields where rdb$field_name = (select rdb$field_source from 
rdb$relation_fields where rdb$field_name = 'DBW$$TEMP' and rdb$relation_name 
= 'DML_TEST1')),
RDB$COMPUTED_SOURCE = (select RDB$COMPUTED_SOURCE from rdb$fields where 
rdb$field_name = (select rdb$field_source from rdb$relation_fields where 
rdb$field_name = 'DBW$$TEMP' and rdb$relation_name = 'DML_TEST1'))
WHERE rdb$field_name = (select rdb$field_source from rdb$relation_fields 
where rdb$relation_name = 'DML_TEST1' and rdb$field_name = 'MYTESTFIELD');
COMMIT;

// create valid new dependencies
insert into rdb$dependencies
select * from rdb$dependencies
where rdb$dependent_name = (select f.rdb$field_name
from rdb$fields f
join rdb$relation_fields rf on rf.rdb$field_source = f.rdb$field_name
where rf.rdb$relation_name = 'DML_TEST1' and rf.rdb$field_name = 
'DBW$$TEMP');

// drop temporary computed field
ALTER TABLE DML_TEST1 DROP DBW$$TEMP;



If this doesn't help for you, I'd be interested in a copy of the database to 
see what's going on. ;)


Hope this helps.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird! 





++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/firebird-support/join
(Yahoo! ID required)

<*> To change settings via email:
firebird-support-dig...@yahoogroups.com 
firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [firebird-support] Computed field Dependencies

2013-04-09 Thread Mark Rotteveel
On Tue, 09 Apr 2013 10:51:43 -0300, Gugui
 wrote:
> hi Marijn,
> 
> i´m using firebird-server-classic-2.1.3.18185.0-5mdv2010.0

Alter table for computed fields was added in Firebird 2.5:
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-ddl-table.html#langrefupd25-alter-table

Mark