Download O2 ODBC User Manual
Transcript
4 O2 SQL CREATE SCHEMA french_document CREATE TABLE Article( titre LONGVARCHAR annee INTEGER PRIMARY KEY ( title ) ) CREATE TABLE Auteur( title LONGVARCHAR nom LONGVARCHAR adresse_eletronique LONGVARCHAR PRIMARY KEY ( title ) ) CREATE TABLE Auteurs( article LONGVARCHAR auteur LONGVARCHAR FOREIGN KEY (article) REFERENCES Article FOREIGN KEY (auteur) REFERENCES Auteur ) Fi gu r e 4 .4 : Rel a t i on a l sch em a french_document 4.2 Query Translation 4.2.1 Schema Update Commands In t h is sect ion , we con sider t h e t r an slat ion of sch em a u pdat e SQL com m an ds in t o O 2 sch em a u pdat e com m an ds. Sch em a u pdat e SQL com m an ds ar e com m an ds for t able, view an d in dex cr eat ion , delet ion an d m odificat ion . Th e t r an slat ion of su ch com m an ds cor r espon ds to an u pdat e of t h e u n der lyin g O2 sch em a. Table creation command Cu r r en t ly, a sim ple tr an slat ion m ech an ism is u sed for gen er at in g, for each n ewly cr eat ed t able, a cor r espon din g class in t h e O2 sch em a wit h t h e sam e at t r ibu tes an d u sin g a defau lt t ype m appin g. Sim ple r efer en ce at t r ibu t es, i.e. on e-t o-on e r elat ion sh ips, ar e gen er at ed in t h e th e O2 class by t ak in g pr im ar y an d for eign k ey defin it ion s in t o accou n t , as th e in for m at ion pr ovided in t h e t able cr eat ion com m an d is n ot en ou gh for allowin g t h e syst em t o in fer on e-t o-m an y or m an y-to-m an y r elat ion sh ips. 42 O2 OD BC User Man u al