DDieterich / DTGen

DTGEN Code Generation Tool for Relational Designers (See Wiki Branch)
http://dtgen.org
3 stars 0 forks source link

Faster returning FK NK lookups in _VIEW.ins and _VIEW.upd #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What will the enhancement do?

 -) Possibly make the FK NK lookups in the _VIEW.ins and _VIEW.upd procedures faster by using cached data at MT with MV.

How is this currently done or handled?

 -) A full query of the Active view record is performed when needed in the _VIEW.ins and _VIEW.upd procedures.

What version of the product are you using? On what operating system?

 -) Pre-Release 0.11

Please provide any additional information below.

View Package Return Values
--------------------------
NOTE: Path is a Natural Key value for a self-referencing Foreign Key

-) Conditions for full view query:
   1) db_constraints is true
      TAB package will not have returned any updated values
   2) Self-ref ID are set/diff and
         Self-ref NK are null/match
      Doesn't matter what the TAB package provides,
         the database table must ultimately be queried for the self-ref NK.

-) Conditions for FK function only:
   1) db_constraints is false and
         FK ID are set/diff
      TAB package will not provide FK NK,
         FK NK lookups may be cached at MT with MV.

-) Conditions for no query:
   1) db_constraints is false and
         no FKs
      TAB package will provide all returning data
   2) db_constraints is false and
         FK ID are null/match and
         FK NK are set/diff
      TAB package will provide FK IDs,
         FK NK already set to new value.
   3) db_constraints is false and
         FK ID are null/match and
         FK NK are null/match
      TAB package will provide all returning data,
         No changes to FK NK.

db_constraints  DML  FK IDs  FK NKs  Self-ref  Action
--------------  ---  ------  ------  --------  ------
FALSE            -                             No Code Generated
FALSE           INS  NULL     -       -        None
FALSE           INS  set      -      No        NK Query
FALSE           INS  set      -      Yes       Full Query
FALSE           UPD  match    -       -        None
FALSE           UPD  diff     -      No        NK Query
FALSE           UPD  diff     -      Yes       Full Query

 -  - Don't care, could be any value, existing or not
NULL - For an INSERT, The new value is not set
set  - For an INSERT, The new value is set (NOT NULL)
match - For an UPDATE, The old value and new value match
diff - For an UPDATE, The old value and new value are different
FK ID - Surrogate Key (ID) from a Foreign Key
FK NK - Natural Key data values from a Foreign Key
Self-ref - Self-Referencing Foreign Key

Original issue reported on code.google.com by Duane.Di...@gmail.com on 7 Oct 2012 at 3:45

GoogleCodeExporter commented 9 years ago
 -) The VIEW Package is the wrong place for FK lookups.  This should done in the DML package because any DML to ACTive views will through away the results of the FK lookups.

 -) Related to Issues 69

Original comment by Duane.Di...@gmail.com on 8 Oct 2012 at 3:49