[fdo-commits] r677 - in
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS: . sql
svn_fdo at osgeo.org
svn_fdo at osgeo.org
Mon Jan 22 21:09:46 EST 2007
Author: mloskot
Date: 2007-01-22 21:09:46 -0500 (Mon, 22 Jan 2007)
New Revision: 677
Added:
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_associationdefinition.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedefinition.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedependencies.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classdefinition.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classtype.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_dbopen.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_feature.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_options.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_sad.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemainfo.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemaoptions.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontext.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgeom.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgroup.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys.sql
branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys_idx.sql
Log:
Added 'sql' module for PostGIS with SQL templates for FDO meta schema scripts.
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_associationdefinition.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_associationdefinition.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_associationdefinition.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,19 @@
+--
+-- f_associationdefinition
+--
+DROP TABLE IF EXISTS f_associationdefinition;
+
+create table f_associationdefinition (
+ pseudocolname varchar(64) not null,
+ pktablename varchar(64) not null,
+ pkcolumnnames varchar(1056),
+ fktablename varchar(64) not null,
+ fkcolumnnames varchar(1056),
+ multiplicity varchar(5),
+ reversemultiplicity varchar(5),
+ cascadelock char(1),
+ deleterule integer,
+ reversename varchar(200)
+);
+
+COMMENT ON TABLE f_associationdefinition IS 'TODO';
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedefinition.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedefinition.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedefinition.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,68 @@
+--
+-- f_attributedefinition
+--
+DROP TABLE IF EXISTS f_attributedefinition;
+
+create table f_attributedefinition (
+ tablename varchar(64) not null,
+ classid integer not null,
+ columnname varchar(255) not null,
+ attributename varchar(4000) not null,
+ idposition smallint,
+ columntype varchar(30) not null,
+ columnsize bigint not null,
+ columnscale smallint,
+ attributetype varchar(512) not null,
+ geometrytype varchar(64),
+ isnullable smallint not null,
+ isfeatid smallint not null,
+ issystem smallint not null,
+ isreadonly smallint not null,
+ isautogenerated smallint,
+ isrevisionnumber smallint,
+ sequencename varchar(30),
+ owner varchar(255),
+ description varchar(255),
+ rootobjectname varchar(64),
+ isfixedcolumn smallint,
+ iscolumncreator smallint,
+ haselevation smallint,
+ hasmeasure smallint
+);
+
+COMMENT ON TABLE f_attributedefinition IS 'Definition of properties for classes from FDO feature schema.';
+
+-- Base properties common to all classes
+
+insert into f_classdefinition
+(classname, schemaname, tablename,classtype, description, isabstract, parentclassname, istablecreator, isfixedtable, hasversion, haslock)
+values
+('ClassDefinition', 'F_MetaClass', 'f_classdefinition', 1, 'Base for all metaclasses', 1, null, 0, 1, 0, 0);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_classdefinition', currval('f_classdefinition_classid_seq'), 'classname', 'ClassName', 'CHAR', 30, 0, 'string', 0, 0, 1, 1, 0, 0,
+current_user, 'FDO base property: object class name', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_classdefinition', currval('f_classdefinition_classid_seq'), 'schemaname', 'SchemaName', 'CHAR', 255, 0, 'string', 1, 0, 1, 1, 0, 0,
+current_user, 'FDO base property: object class schema name', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, idposition, columntype, columnsize, columnscale, attributetype,
+isnullable, isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_feature', currval('f_classdefinition_classid_seq'), 'classid', 'ClassId', 1, 'BIGINT', 0, 0, 'int64', 0, 0, 1, 1, 1, 0,
+current_user, 'Class id number (uniquely identifies a class)', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, geometrytype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('n/a', currval('f_classdefinition_classid_seq'), 'n/a', 'Bounds', 'GEOMETRY', 0, 0, '4', '84224', 1, 0, 1, 1, 0, 0,
+current_user, 'Bounding box for the feature', 0, 0);
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedependencies.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedependencies.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_attributedependencies.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,24 @@
+--
+-- f_attributedependencies
+--
+DROP TABLE IF EXISTS f_attributedependencies;
+
+create table f_attributedependencies (
+ pktablename varchar(64) not null,
+ pkcolumnnames varchar(1056),
+ fktablename varchar(64) not null,
+ fkcolumnnames varchar(1056),
+ fkcardinality integer not null,
+ identitycolumn varchar(64),
+ ordertype char(1)
+);
+
+COMMENT ON TABLE f_attributedependencies IS 'Definition of attribute dependencies.';
+
+-- Add dependency for navigating from a feature to its class and schema name
+
+insert into f_attributedependencies
+( pktablename, pkcolumnnames, fktablename, fkcolumnnames, fkcardinality )
+values
+( 'F_FEATURE', 'CLASSID', 'F_CLASSDEFINITION', 'CLASSID', 1 );
+
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classdefinition.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classdefinition.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classdefinition.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,34 @@
+--
+-- f_classdefinition -
+--
+DROP TABLE IF EXISTS f_classdefinition;
+
+create table f_classdefinition (
+ classid serial not null,
+ classname varchar(255) not null,
+ schemaname varchar(255),
+ tablename varchar(64) not null,
+ roottablename varchar(64),
+ tableowner varchar(64),
+ tablelinkname varchar(128),
+ tablemapping varchar(64),
+ classtype smallint not null,
+ description varchar(255),
+ isabstract smallint not null,
+ parentclassname varchar(512),
+ isfixedtable smallint,
+ istablecreator smallint,
+ hasversion smallint,
+ haslock smallint,
+ geometryproperty varchar(4000),
+
+ CONSTRAINT f_classdefinition_pk PRIMARY KEY (classid)
+);
+COMMENT ON TABLE f_classdefinition IS 'Definition of classes from FDO feature schema.';
+
+-- insert only classes that do not require any data in the F_AttributeDefinition table
+
+insert into f_classdefinition
+(classname, schemaname, tablename,classtype, description, isabstract, parentclassname, istablecreator, isfixedtable, hasversion, haslock)
+values
+('Class', 'F_MetaClass', ' ', 1, 'Non-feature metaclass', 0, 'ClassDefinition', 0, 1, 0, 0);
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classtype.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classtype.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_classtype.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,15 @@
+--
+-- f_classtype
+--
+DROP TABLE IF EXISTS f_classtype;
+
+create table f_classtype (
+ classtype integer not null,
+ classtypename varchar(255) not null
+);
+
+COMMENT ON TABLE f_classtype IS 'Definition of types for FDO classes.';
+
+-- Lookups for class type enums-string pairs
+insert into f_classtype (classtype, classtypename) values (1, 'Class');
+insert into f_classtype (classtype, classtypename) values (2, 'Feature');
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_dbopen.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_dbopen.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_dbopen.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,16 @@
+--
+-- f_dbopen -
+--
+DROP TABLE IF EXISTS f_dbopen;
+
+create table f_dbopen (
+ usernum integer not null,
+ dbuser varchar(30) not null,
+ accessmode varchar(1),
+ activescid bigint,
+ opendate timestamp,
+ sessionid smallint,
+ process varchar(128)
+);
+
+COMMENT ON TABLE f_dbopen IS 'TODO';
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_feature.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_feature.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_feature.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,29 @@
+--
+-- f_feature -
+--
+DROP TABLE IF EXISTS f_feature;
+
+-- #ifdef FDO_FEATURE
+create table f_feature (
+ featid bigint not null,
+ classid numeric(20),
+-- #ifdef FDO_VERSIONS
+ ltid numeric(20),
+ nextltid numeric(20),
+ ltgeneration numeric(20),
+-- #endif
+-- #ifdef FDO_LOCKS
+ rowlockid numeric(20),
+ rowlocktype varchar(1)
+-- #endif
+);
+
+COMMENT ON TABLE f_feature IS 'Definition of FDO spatial feature types.';
+
+-- #ifndef FDO_VERSIONS
+-- #ifndef FDO_LOCKS
+alter table f_feature add (constraint f_feature_pk primary key (featid));
+-- #endif
+-- #endif
+
+-- #endif
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_options.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_options.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_options.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,12 @@
+--
+-- f_options - store different options used by the datastore
+--
+DROP TABLE IF EXISTS f_options;
+
+create table f_options (
+ name varchar(100),
+ value varchar(100)
+);
+
+insert into f_options values ('LT_MODE', '1');
+insert into f_options values ('LOCKING_MODE', '1');
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_sad.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_sad.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_sad.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,14 @@
+--
+-- f_sad - Schema Attribute Dictionary table
+--
+DROP TABLE IF EXISTS f_sad;
+
+create table f_sad (
+ ownername varchar(512) not null,
+ elementname varchar(255) not null,
+ elementtype varchar(30) not null,
+ name varchar(255) not null,
+ value varchar(4000)
+);
+
+COMMENT ON TABLE f_sad IS 'Definition of schema attribute dictionary for FDO meta schema.';
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemainfo.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemainfo.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemainfo.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,24 @@
+--
+-- f_schemainfo
+--
+DROP TABLE IF EXISTS f_schemainfo;
+
+create table f_schemainfo (
+ schemaname varchar(255) not null,
+ description varchar(255),
+ owner varchar(255) not null,
+ creationdate timestamp,
+ schemaversionid numeric(5,3) not null,
+ tableowner varchar(64),
+ tablelinkname varchar(128),
+ tablemapping varchar(30)
+);
+
+COMMENT ON TABLE f_schemainfo IS 'Definition of information properties for FDO meta schema.';
+
+insert into f_schemainfo (schemaname, description, creationdate, owner, schemaversionid )
+values (current_schema(), 'System Metaschema', current_timestamp, current_user, 3.000);
+
+-- F_MetaClass is a special schema with a class for each FDO Feature schema class type
+insert into f_schemainfo (schemaname, description, creationdate, owner, schemaversionid )
+values ('F_MetaClass', 'Special classes for FDO Feature metaclasses', current_timestamp, current_user, 3.000);
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemaoptions.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemaoptions.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_schemaoptions.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,14 @@
+--
+-- f_schemaoptions - Schema Options table, based on the f_sad table design
+--
+DROP TABLE IF EXISTS f_schemaoptions;
+
+create table f_schemaoptions (
+ ownername varchar(512) not null,
+ elementname varchar(255) not null,
+ elementtype varchar(30) not null,
+ name varchar(255) not null,
+ value varchar(4000)
+);
+
+COMMENT ON TABLE f_schemaoptions IS 'Definition of options for FDO meta schema.';
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontext.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontext.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontext.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,26 @@
+--
+-- f_spatialcontext
+--
+DROP TABLE IF EXISTS f_spatialcontext;
+
+create table f_spatialcontext (
+ scid serial not null,
+ scname varchar(255) not null,
+ description varchar(255),
+ scgid bigint null,
+-- #ifdef FDO_LOCKS
+ rowlockid bigint null,
+ rowlocktype varchar(1) null,
+-- #endif
+
+ CONSTRAINT f_spatialcontext_pk PRIMARY KEY (scid)
+);
+
+COMMENT ON TABLE f_spatialcontext IS 'Definition of FDO spatial context.';
+
+-- Insert default spatial context
+
+insert into f_spatialcontext
+(scname, description, scgid)
+values
+('Default', 'Default Database Spatial Context', 1);
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgeom.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgeom.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgeom.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,13 @@
+--
+-- f_spatialcontextgeom
+--
+DROP TABLE IF EXISTS f_spatialcontextgeom;
+
+create table f_spatialcontextgeom (
+ scid serial not null,
+ geomtablename varchar(64) not null,
+ geomcolumnname varchar(64) not null,
+ dimensionality smallint not null
+);
+
+COMMENT ON TABLE f_spatialcontextgeom IS 'TODO';
\ No newline at end of file
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgroup.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgroup.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/f_spatialcontextgroup.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,36 @@
+--
+-- f_spatialcontextgroup
+--
+DROP TABLE IF EXISTS f_spatialcontextgroup;
+
+create table f_spatialcontextgroup (
+ scgid serial not null,
+ crsname varchar(255),
+ crswkt varchar(2048),
+ srid bigint,
+ areaunit varchar(30),
+ lengthunit varchar(30),
+ positionxyunit varchar(30),
+ positionzunit varchar(30),
+ volumeunit varchar(30),
+ measureunit varchar(30),
+ xtolerance double precision not null,
+ ztolerance double precision,
+ minx double precision not null, -- TODO: xmin is a system column name
+ miny double precision not null,
+ minz double precision,
+ maxx double precision not null, -- TODO: xmax is a system column name
+ maxy double precision not null,
+ maxz double precision,
+ extenttype varchar(1) not null,
+
+ CONSTRAINT f_spatialcontextgroup_pk PRIMARY KEY (scgid)
+);
+
+COMMENT ON TABLE f_spatialcontextgroup IS 'TODO';
+
+insert into f_spatialcontextgroup
+(crsname, xtolerance, ztolerance, minx, miny, maxx, maxy, extenttype)
+values
+('', 0.001, 0.001, -2000000, -2000000, 2000000, 2000000, 'S');
+
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,299 @@
+#ifndef VISION_noschema
+
+#ifdef PostGIS
+
+/*****************************************************************************/
+create table f_schemainfo (
+ schemaname varchar(255) not null,
+ description varchar(255),
+ owner varchar(255) not null,
+ creationdate timestamp,
+ schemaversionid numeric(5,3) not null,
+ tableowner varchar(64),
+ tablelinkname varchar(128),
+ tablemapping varchar(30)
+);
+COMMENT ON TABLE f_schemainfo IS 'Definition of information properties for FDO meta schema.';
+
+insert into f_schemainfo
+(schemaname, description, creationdate, owner, schemaversionid )
+values
+(current_schema(), 'System Metaschema', current_timestamp, current_user, 3.000);
+
+insert into f_schemainfo
+(schemaname, description, creationdate, owner, schemaversionid )
+values
+('F_MetaClass', 'Special classes for FDO Feature metaclasses', current_timestamp, current_user, 3.000);
+
+/*****************************************************************************/
+create table f_options (
+ name varchar(100),
+ value varchar(100)
+);
+
+insert into f_options values ('LT_MODE', '1');
+insert into f_options values ('LOCKING_MODE', '1');
+
+/*****************************************************************************/
+create table f_schemaoptions (
+ ownername varchar(512) not null,
+ elementname varchar(255) not null,
+ elementtype varchar(30) not null,
+ name varchar(255) not null,
+ value varchar(4000)
+);
+COMMENT ON TABLE f_schemaoptions IS 'Definition of options for FDO meta schema.';
+
+/*****************************************************************************/
+create table f_sad (
+ ownername varchar(512) not null,
+ elementname varchar(255) not null,
+ elementtype varchar(30) not null,
+ name varchar(255) not null,
+ value varchar(4000)
+);
+COMMENT ON TABLE f_sad IS 'Definition of schema attribute dictionary for FDO meta schema.';
+
+/*****************************************************************************/
+create table f_dbopen (
+ usernum integer not null,
+ dbuser varchar(30) not null,
+ accessmode varchar(1),
+ activescid bigint,
+ opendate timestamp,
+ sessionid smallint,
+ process varchar(128)
+);
+COMMENT ON TABLE f_dbopen IS 'TODO';
+
+/*****************************************************************************/
+#ifdef FDO_FEATURE
+create table f_feature (
+ featid bigint not null,
+ classid numeric(20)
+#ifdef FDO_VERSIONS
+ ,ltid numeric(20),
+ nextltid numeric(20),
+ ltgeneration numeric(20)
+#endif
+#ifdef FDO_LOCKS
+ ,rowlockid numeric(20),
+ rowlocktype varchar(1)
+#endif
+);
+COMMENT ON TABLE f_feature IS 'Definition of FDO spatial feature types.';
+
+#ifndef FDO_VERSIONS
+#ifndef FDO_LOCKS
+alter table f_feature add (constraint f_feature_pk primary key (featid));
+#endif
+#endif
+
+#endif
+
+/*****************************************************************************/
+create table f_classdefinition (
+ classid serial not null,
+ classname varchar(255) not null,
+ schemaname varchar(255),
+ tablename varchar(64) not null,
+ roottablename varchar(64),
+ tableowner varchar(64),
+ tablelinkname varchar(128),
+ tablemapping varchar(64),
+ classtype smallint not null,
+ description varchar(255),
+ isabstract smallint not null,
+ parentclassname varchar(512),
+ isfixedtable smallint,
+ istablecreator smallint,
+ hasversion smallint,
+ haslock smallint,
+ geometryproperty varchar(4000),
+
+ CONSTRAINT f_classdefinition_pk PRIMARY KEY (classid)
+);
+COMMENT ON TABLE f_classdefinition IS 'Definition of classes from FDO feature schema.';
+
+/* insert only classes that do not require any data in the F_AttributeDefinition table */
+
+insert into f_classdefinition
+(classname, schemaname, tablename,classtype, description, isabstract, parentclassname, istablecreator, isfixedtable, hasversion, haslock)
+values
+('Class', 'F_MetaClass', ' ', 1, 'Non-feature metaclass', 0, 'ClassDefinition', 0, 1, 0, 0);
+
+/*****************************************************************************/
+create table f_attributedefinition (
+ tablename varchar(64) not null,
+ classid integer not null,
+ columnname varchar(255) not null,
+ attributename varchar(4000) not null,
+ idposition smallint,
+ columntype varchar(30) not null,
+ columnsize bigint not null,
+ columnscale smallint,
+ attributetype varchar(512) not null,
+ geometrytype varchar(64),
+ isnullable smallint not null,
+ isfeatid smallint not null,
+ issystem smallint not null,
+ isreadonly smallint not null,
+ isautogenerated smallint,
+ isrevisionnumber smallint,
+ sequencename varchar(30),
+ owner varchar(255),
+ description varchar(255),
+ rootobjectname varchar(64),
+ isfixedcolumn smallint,
+ iscolumncreator smallint,
+ haselevation smallint,
+ hasmeasure smallint
+);
+COMMENT ON TABLE f_attributedefinition IS 'Definition of properties for classes from FDO feature schema.';
+
+/* Base properties common to all classes */
+
+insert into f_classdefinition
+(classname, schemaname, tablename,classtype, description, isabstract, parentclassname, istablecreator, isfixedtable, hasversion, haslock)
+values
+('ClassDefinition', 'F_MetaClass', 'f_classdefinition', 1, 'Base for all metaclasses', 1, null, 0, 1, 0, 0);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_classdefinition', currval('f_classdefinition_classid_seq'), 'classname', 'ClassName', 'CHAR', 30, 0, 'string', 0, 0, 1, 1, 0, 0,
+current_user, 'FDO base property: object class name', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_classdefinition', currval('f_classdefinition_classid_seq'), 'schemaname', 'SchemaName', 'CHAR', 255, 0, 'string', 1, 0, 1, 1, 0, 0,
+current_user, 'FDO base property: object class schema name', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, idposition, columntype, columnsize, columnscale, attributetype,
+isnullable, isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('f_feature', currval('f_classdefinition_classid_seq'), 'classid', 'ClassId', 1, 'BIGINT', 0, 0, 'int64', 0, 0, 1, 1, 1, 0,
+current_user, 'Class id number (uniquely identifies a class)', 0, 1);
+
+insert into f_attributedefinition
+(tablename, classid, columnname, attributename, columntype, columnsize, columnscale, attributetype, geometrytype, isnullable,
+isfeatid, issystem, isreadonly, isautogenerated, isrevisionnumber, owner, description, iscolumncreator, isfixedcolumn)
+values
+('n/a', currval('f_classdefinition_classid_seq'), 'n/a', 'Bounds', 'GEOMETRY', 0, 0, '4', '84224', 1, 0, 1, 1, 0, 0,
+current_user, 'Bounding box for the feature', 0, 0);
+
+/*****************************************************************************/
+create table f_spatialcontextgroup (
+ scgid serial not null,
+ crsname varchar(255),
+ crswkt varchar(2048),
+ srid bigint,
+ areaunit varchar(30),
+ lengthunit varchar(30),
+ positionxyunit varchar(30),
+ positionzunit varchar(30),
+ volumeunit varchar(30),
+ measureunit varchar(30),
+ xtolerance double precision not null,
+ ztolerance double precision,
+ minx double precision not null, -- TODO: xmin is a system column name
+ miny double precision not null,
+ minz double precision,
+ maxx double precision not null, -- TODO: xmax is a system column name
+ maxy double precision not null,
+ maxz double precision,
+ extenttype varchar(1) not null,
+
+ CONSTRAINT f_spatialcontextgroup_pk PRIMARY KEY (scgid)
+);
+COMMENT ON TABLE f_spatialcontextgroup IS 'TODO';
+
+insert into f_spatialcontextgroup
+(crsname, xtolerance, ztolerance, minx, miny, maxx, maxy, extenttype)
+values
+('', 0.001, 0.001, -2000000, -2000000, 2000000, 2000000, 'S');
+
+/*****************************************************************************/
+create table f_spatialcontextgeom (
+ scid serial not null,
+ geomtablename varchar(64) not null,
+ geomcolumnname varchar(64) not null,
+ dimensionality smallint not null
+);
+COMMENT ON TABLE f_spatialcontextgeom IS 'TODO';
+
+/*****************************************************************************/
+create table f_attributedependencies (
+ pktablename varchar(64) not null,
+ pkcolumnnames varchar(1056),
+ fktablename varchar(64) not null,
+ fkcolumnnames varchar(1056),
+ fkcardinality integer not null,
+ identitycolumn varchar(64),
+ ordertype char(1)
+);
+COMMENT ON TABLE f_attributedependencies IS 'TODO';
+
+#ifdef FDO_FEATURE
+/* Add dependency for navigating from a feature to its class and schema name */
+insert into f_attributedependencies
+( pktablename, pkcolumnnames, fktablename, fkcolumnnames, fkcardinality )
+values ( 'F_FEATURE', 'CLASSID', 'F_CLASSDEFINITION', 'CLASSID', 1 );
+#endif
+
+/*****************************************************************************/
+create table f_associationdefinition (
+ pseudocolname varchar(64) not null,
+ pktablename varchar(64) not null,
+ pkcolumnnames varchar(1056),
+ fktablename varchar(64) not null,
+ fkcolumnnames varchar(1056),
+ multiplicity varchar(5),
+ reversemultiplicity varchar(5),
+ cascadelock char(1),
+ deleterule integer,
+ reversename varchar(200)
+);
+COMMENT ON TABLE f_associationdefinition IS 'TODO';
+
+/*****************************************************************************/
+create table f_spatialcontext (
+ scid serial not null,
+ scname varchar(255) not null,
+ description varchar(255),
+ scgid bigint null,
+#ifdef FDO_LOCKS
+ rowlockid bigint null,
+ rowlocktype varchar(1) null,
+#endif
+
+ CONSTRAINT f_spatialcontext_pk PRIMARY KEY (scid)
+);
+COMMENT ON TABLE f_spatialcontext IS 'Definition of FDO spatial context.';
+
+insert into f_spatialcontext
+(scname, description, scgid)
+values
+('Default', 'Default Database Spatial Context', 1);
+
+/*****************************************************************************/
+create table f_classtype (
+ classtype integer not null,
+ classtypename varchar(255) not null
+);
+COMMENT ON TABLE f_classtype IS 'Definition of types for FDO classes.';
+
+insert into f_classtype (classtype, classtypename) values (1, 'Class');
+insert into f_classtype (classtype, classtypename) values (2, 'Feature');
+
+/*****************************************************************************/
+
+#endif /* PostGIS */
+
+#endif /* VISION_noschema */
+
+/* End */
Added: branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys_idx.sql
===================================================================
--- branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys_idx.sql 2007-01-23 02:08:10 UTC (rev 676)
+++ branches/fdordbms-postgis/Providers/GenericRdbms/Src/PostGIS/sql/postgis_fdo_sys_idx.sql 2007-01-23 02:09:46 UTC (rev 677)
@@ -0,0 +1,229 @@
+/*----------------------------------------------------------------------*/
+/* Name */
+/* g_sys_i.sql - create indexes for standard system tables schema */
+/* */
+/* Description */
+/* Command file to create indexes for standard schema and system */
+/* tables in a newly granted database. */
+/* */
+/* Remarks */
+/* This file is executed by a call to adb_exec_file(). Portions */
+/* of this script are enabled or disabled via #ifdef variables. */
+/* In particular defining VISION_noschema disables the creation of */
+/* the so called schema table indexes. */
+/* */
+/*----------------------------------------------------------------------*/
+
+#ifndef VISION_noschema
+
+create unique index f_schemainfo_idx on f_schemainfo(schemaname)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_dbopen_usrnum_idx on f_dbopen(usernum)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+#ifdef FDO_FEATURE
+#ifdef FDO_VERSIONS
+create unique index f_feature_pk_idx on f_feature(featid, ltid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+
+create index f_feature_class_idx on f_feature(featid, classid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+
+
+create index f_feature_lt_idx on f_feature(ltid, nextltid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+
+
+create unique index f_geometry_0_pk_idx on f_geometry_0(featid, scid, seq, ltid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+
+create index f_geometry_0_lt_idx on f_geometry_0(ltid, nextltid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+#endif
+#endif
+
+create unique index f_classdef_pk_idx on f_classdefinition(classid)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_classdef_schnm_idx on f_classdefinition(classname, schemaname)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_attributedef_pk_idx on f_attributedefinition(tablename, classid, columnname)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_attributedep_pk_idx on f_attributedependencies(pktablename, fktablename)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_association_pk_idx on f_associationdefinition(pseudocolname, pktablename, fktablename)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_sad_pk_idx on f_sad(ownername, elementname, elementtype, name)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_schemaoptions_pk_idx on f_schemaoptions(ownername, elementname, elementtype, name)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+/* F_SEQUNCE table primary key */
+#ifdef Oracle
+create unique index f_sequence_seq_id on f_sequence(seqid)
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5);
+#endif
+
+/* Create the G_PLAN table indexes. */
+
+/* Primary Key */
+create unique index f_spatialcontext_scid_pk_idx on f_spatialcontext(scid)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+create unique index f_spatialcontext_name_pk_idx on f_spatialcontext(scname)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+
+/* Create the G_PLAN_GROUPS index */
+create unique index f_spatialcontextgroup_pk_idx on f_spatialcontextgroup(scgid)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+/*#endif VISION_sdo */
+
+/* create the f_spatialcontextgeom index */
+create unique index f_spatialcontextgeom_pk_idx on f_spatialcontextgeom(scid, geomtablename, geomcolumnname)
+#ifdef Oracle
+ pctfree 5
+ storage (initial 4K
+ next 4K
+ minextents 1
+ maxextents 9999
+ pctincrease 5)
+#endif
+;
+
+#endif
+
+/* End */
More information about the fdo-commits
mailing list