DataType - Property Datatype
----------------------------

                 Key: CORE-3507
                 URL: http://tracker.firebirdsql.org/browse/CORE-3507
             Project: Firebird Core
          Issue Type: New Feature
          Components: Engine
         Environment: ALL
            Reporter: Sérgio
            Priority: Critical


DataType - Property Datatype

Develop a new datatype kind of property with setter and getter.

When we read Executes one Function (PSQL) and Returns the function result       
 when we write Execute other Function (PSQL) . should accept  the  as input 
param also a  ( this type of structure   resulting from other stored proc    
select * from table  -  Table type results );



So we even can read and write nested  tables with this   : )    like oracle 
nested. that what i ( ask 3 times  nested tables )

//This is Not a trigger   


For each Table Row (which have this fieldtype ) returned, on a query  will 
execute the getter.



Create Function MyGetter 
begin
end;

Create Function MySetter
begin
end;

property MyField : TSETGETField read MyGetter write MySetter;

// This is a simple example of what we can do with this    
***********************

Create Function MyInvoiceLineGetter(aParentKey )
begin
 return select * from InvoiceLines where Parent_NInvoice=aParentKey;
end;

Create Function MyInvoiceLineSetter(aParentKey , aLines TDynField)
begin
delete from InvoiceLines where Parent_NInvoice=aParentKey;
for each aLines insert into 
invoiceLines(aParentKey,aLines.f1,aLines.f2,aLines.f3,aLines.f4);
end;


Create Table InvoiceLines (Parent_NInvoice int, ProductName Varchar [30],Qnt 
integer, price Float, forein key Invoice_NInvoice); 

Create Table Invoice (NInvoice int, Name varchar[30],Address[30], city 
varchar[30],InvoiceLines TDynField Read MyInvoiceLineGetter write 
MyInvoiceLineSetter, primary key NInvoice)


This is an emulation of a nested table,  will use the stored proces to read and 
write to a table  being faster because is server internal insert , delete 
,search....


/ Other Example  /******

Create Function MyCalcGetter 
begin
  return current.qnt * current.price;
end;

Create Table InvoiceLines (Parent_NInvoice int, ProductName Varchar [30],Qnt 
integer, price Float, forein key Invoice_NInvoice; LINETOTAL TDynField Read 
MyCalcGetter); 


So each time a invoiceLine is return executes the MyCalcGetter and retrieves 
the function value


Sérgio Francisco

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to