Dataphor SQL RAC (Relational Application Companion)


A site of hope for those looking for a true relational database system

Saturday, June 16, 2007

Dataphor - Intelligent views

This is in response to the thread:

Saturday, June 16, 2007 10:10 AM
microsoft.public.sqlserver.programming
How to make a view as input???
http://tinyurl.com/2o5q8h

MS Sql Server 2005 Bol on View:
 'Creates a virtual table that represents the data in one or more tables
  in an alternative way.' 
  
This is a good and accurate defintion. It is a 'representation' of a 
select statement. But it does not 'capture' the relationship(s) of the
representation. It is unaware of any key(s) and most importantly unaware
of any constraints between tables, ie. reference(s). It thus suffers from
a deficit disorder as far as application development goes. This retardation
causes developers to assume responsibilities the db should handle amongst
which is the use of the nightmare t-sql trigger.

Here is a very simple example of intelligent view behavior for application
development. It uses the D4 language of Dataphor and uses sql server 2005
as the data respository.

create table MyOrders
{
 order_nbr:Integer,
 some_col:Integer,
 key{order_nbr}
}; 

create table MyOrderDetails
 {
  order_nbr:Integer,
  sku:Integer,
  item_price:Integer,
  key{order_nbr,sku},
  reference MyDetails_MyOrders{ order_nbr } 
  references MyOrders { order_nbr }
 };

insert table
 {
  row{1 order_nbr, 15 some_col},
  row{2,30},
  row{3,14}
 } into MyOrders;
 
insert table
 {
  row{1 order_nbr, 1 sku, 500 item_price},
  row{1, 2, 205},
  row{2, 1, 490},
  row{3, 1, 480}
 } into MyOrderDetails ; 

This is a natural join. The sql "on MyOrders.order_nbr=MyOrderDetails.order_nbr"
is implied by a natural join.

create view MyOrdersView
  MyOrders join MyOrderDetails 

The keys of each table and the constraint (reference) between the
tables are used to resolve each insert into the view. The view inherits
the keys of each table and the reference between the tables.

insert row{1 order_nbr,3 sku,253 item_price} into MyOrdersView;
insert row{2 order_nbr,2 sku,321 item_price} into MyOrdersView;
insert row{4 order_nbr,1 sku,42 some_col,321 item_price} into MyOrdersView;

select MyOrdersView;
order_nbr some_col sku item_price 
--------- -------- --- ---------- 
1         15       1   500        
1         15       2   205        
1         15       3   253        
2         30       1   490        
2         30       2   321        
3         14       1   480        
4         42       1   321        

An insert should be resolved to a delete followed by an insert from the
view to each base table, ie. an update.
(The "adorn" is meta-data attached to the insert allowing the update
 behavior to take place thru the view).

insert row{1 order_nbr,3 sku,25 some_col,632 item_price} into MyOrdersView
                           adorn with { PropagateInsert = "Ensure" };

select MyOrdersView;                         
order_nbr some_col sku item_price 
--------- -------- --- ---------- 
1         25       1   500        
1         25       2   205        
1         25       3   632        
2         30       1   490        
2         30       2   321        
3         14       1   480        
4         42       1   321           

select MyOrders;
order_nbr some_col 
--------- -------- 
1         25       
2         30       
3         14       
4         42       

select MyOrderDetails;
order_nbr sku item_price 
--------- --- ---------- 
1         1   500        
1         2   205        
1         3   632        
2         1   490        
2         2   321        
3         1   480        
4         1   321        

Before one asks the question of whether or not there is intelligence
in the universe, developers should ask if there is intelligence in
their application tools -:)
bye for now,
steve

10 comments:

free incest porn pics and stories said...

I wanted to feel every inch of this black cock. I didnt do nothing.
stories bisexual first time
free 3d xxx toon stories
free ture sex stories gay
interracial stories with pictures
embarrassing animal sex stories
I wanted to feel every inch of this black cock. I didnt do nothing.

Anonymous said...

لدي بعض الحكمة الرائعة.

Anonymous said...

Das war wirklich interessant. Ich liebte es zu lesen

Anonymous said...

There is obviously a lot to know about this. I think you made some good points in Features also. Keep working ,great job!.

muebles torrejon de ardoz said...

I believe everyone ought to browse on it.

Anonymous said...

writing enhancement software top ten review http://buysoftwareonline.co.uk/product-36627/Allynova-HTML-Password-Wizard-3-6 tally accounting software china [url=http://buysoftwareonline.co.uk/es/product-36558/GrenSoft-PetManager-2-1]blu ray software[/url] blackberry 8100 free software download
[url=http://buysoftwareonline.co.uk/product-37128/PostgreSQL-Data-Wizard-7-8]PostgreSQL Data Wizard 7.8 - Download OEM, Software Sale, OEM Software[/url] palm pilot desktop software
[url=http://buysoftwareonline.co.uk/es/product-35727/ContrastMaster-1-0-for-Adobe-Photoshop][img]http://buyoem.co.uk/image/6.gif[/img][/url]

Anonymous said...

[url=http://onlinemedistore.com/products/celebrex.htm][img]http://onlinemedistore.com/10.jpg[/img][/url]
apothecary pharmacy los angeles http://onlinemedistore.com/catalogue/d.htm marchese pharmacy in hamilton ontario [url=http://onlinemedistore.com/products/azulfidine.htm]phentermine without a prescription at a us pharmacy[/url]
virginia board of pharmacy http://onlinemedistore.com/products/avodart.htm rite aid pharmacy mount vernon [url=http://onlinemedistore.com/products/celebrex.htm]celebrex[/url]
formulary nas jrb pharmacy http://onlinemedistore.com/products/ventolin.htm online pharmacy for dexedrine [url=http://onlinemedistore.com/products/diflucan.htm]pharmacy technician jobs dallas texas[/url]
dispan pharmacy definition http://onlinemedistore.com/products/rogaine-5-.htm wegmans pharmacy perington ny [url=http://onlinemedistore.com/products/activ8--energy-booster-.htm]activ8 energy booster [/url]

Anonymous said...

[url=http://englandpharmacy.co.uk/products/oxytrol.htm][img]http://onlinemedistore.com/1.jpg[/img][/url]
sunset pharmacy http://englandpharmacy.co.uk/products/cialis-professional.htm walgeen pharmacy online [url=http://englandpharmacy.co.uk/products/doxazosin.htm]nd board of pharmacy[/url]
naval medical center portsmouth pharmacy http://englandpharmacy.co.uk/products/zofran.htm pharmacy manufacturer 3592 [url=http://englandpharmacy.co.uk/products/vitamin-c.htm]vitamin c[/url]
a new rx pharmacy http://englandpharmacy.co.uk/catalogue/u.htm anabolic steroid pharmacy sites [url=http://englandpharmacy.co.uk/products/hair-loss-cream.htm]genovis pharmacy[/url]
canadian levitra lipitor mexican online pharmacy pharmacy http://englandpharmacy.co.uk/products/cefadroxil.htm omnicare pharmacy new jersey [url=http://englandpharmacy.co.uk/products/kamasutra-ribbed-condoms.htm]kamasutra ribbed condoms[/url]

Anonymous said...

When you are purchasing, you are much more likely to stick to your finances when you pay only with cash. Select how a lot you will invest. Choose the amount of financial savings from coupon codes you will acquire. Then just take that quantity of money with you purchasing. You will simply acquire the thing you need and you may be encouraged to employing all of your coupon codes should you retail outlet with income only. [url=http://abbeydigital.com.au/ixs/gallery.asp]Tiffany And Co[/url]
Make unsubscribing to the portable ad simple and easy to improve your impression with all the consumer. As challenging as it may be to produce unsubscribing easy, your people will look at you as a reasonable and worthwhile vendor that they could rely on. Chances are great that anyone that unsubscribes was not going to obtain anyways which means you save yourself some useless advertising as well! [url=http://justquotes.com.au/suntrap/new/PrinterFriendly-TBA.html]Nike Shox Australia[/url]
When you're employed as a system online marketer, you certainly must be responsible. If a person feels the item you offered them is false, or should it be bogus, you ought to be liable. Dismissing your responsibility might cause expression to spread, producing a diminishing community with out income. [url=http://altag.it/_interno/list.asp]Scarpe Mbt[/url]
One particular wonderful suggestion for deciding on what pumping systems to utilize is to go with kinds that match the colour of the epidermis. Not merely could this be just going to be strategies for what is going to more often than not look really good, but it will even help to extend the look of your thighs. [url=http://abbeydigital.com.au/p3p/w3c/include.html]Michael Kors[/url]
Look for a whitening teeth program which fits into your life and plan. Some demand long periods of time using a gel or some other product on your teeth. When you have a busy routine with little down time, this can not meet your needs. Other programs need several therapies throughout a day. Select one which fits your life-style. Network is among the brightest issues you can do while you are in school. This will help not only to widen your band of good friends, but in addition develop your possibilities when you find yourself out of college or university searching for a work. Will not dismiss any individual in college, as they might be important for your future. [url=http://questcollege.com.au/old-placeholder/files.html]Nike High Heels[/url]

Anonymous said...

essex dating http://loveepicentre.com/testimonials/ free intimate encounter dating sites
dating tips for kids [url=http://loveepicentre.com/map/]speed dating rules prices[/url] dating checklist
virtual dating flash games [url=http://loveepicentre.com/]atheists dating[/url] who is john alagia dating [url=http://loveepicentre.com/user/jazmine/]jazmine[/url] dating free internet services totally

About Me

My photo
Phoenix, Arizona, United States