Using multiversioned views |
|
Release 9.3 |
sdetable –o create_mv_view –T mv_parcels –t parcels -i 5100 –D landbase –u bjorn –p a.secret
sdetable –o delete_mv_view –t parcels -i 5100 –D landbase –u bjorn –p a.secret
CALL sde.setcurrentversion('<version_name>',?,?)
CALL sde.setcurrentversion('edits',?,?)
NOTE: Multiversioned views should not be used to access or modify complex features—features that participate in geometric networks, topologies, or relationships or have specific geodatabase behavior. You should use ArcGIS to view and modify these types of features.
Editing with multiversioned viewsWhen you edit versioned tables through multiversioned views, changes are made to the delta tables, and row ID values for new records are automatically generated. However, unlike editing versioned data in an ArcGIS edit session, no internal version reconciliation is done with these edits. Therefore, it is strongly recommended that multiversioned views not be used to edit the DEFAULT version or any version that may be subject to simultaneous editing or reconciliation by other users because conflicts will not be detected. Instead, create your own version specifically for editing with multiversioned views.NOTE: If you need to perform version management operations, such as reconciling, resolving conflicts, and posting, you need to use the ArcGIS software. Improper version management can lead to geodatabase corruption when working with views. Also note that you should never use DBMS tools to update any row ID (ObjectID) field maintained by ArcSDE in the database. These row ID fields are allocated and managed by the geodatabase and should not be altered.
There are several stored procedures installed with the ArcSDE component that help you work with multiversioned views. The stored procedure used to set which version the multiversioned view will work with was discussed in the previous section. There are also stored procedures to create a version in which you can do your editing, start and stop an edit session, and delete your edit version. The following set of steps takes you through creating a multiversioned view, creating a version in which to perform edits, setting the version to edit, starting an edit session, performing some edits through the multiversioned view, stopping the edit session, committing your edits to the database, and deleting the version created for the edits. In the examples, the multiversioned view created to perform the edits on the table is permits_mv, and the version created and used for editing is mvedits. Remember that the dataset you edit through a multiversioned view must already have been registered as versioned through ArcGIS. For this example, the permits feature class would need to have already been registered as versioned in ArcCatalog to be able to edit it through a multiversioned view.sdetable –o create_mv_view –T permits_mv –t permits –i 4400 –D code –u sarja –p not4u
CALL sde.create_version
('<parent_version>', '<child_version>', <name_rule>, <access>, '<description>',
<message_code_output>, <message_output>)
CALL sde.create_version
('sde.DEFAULT', 'mvedits', 1, 1, 'multiversioned view edit version', ?, ?)
NOTE: The message_code_output and message_output are the SQL codes and messages returned after you execute the function. You pass in question marks, and the code and message are returned to you.
CALL sde.setcurrentversion('<version_name>', <message_code_output>, <message_output>)
CALL sde.setcurrentversion('mvedits', ?, ?)
CALL sde.edit_version('<version_name>', 1, <message_code_output>, <message_output>)
CALL sde.edit_version('mvedits', 1, ?, ?)
UPDATE permits_mv
SET permittee_name = 'Cpt. Industry'
WHERE business_name = 'Body Electric'
INSERT INTO permits_mv
(bid, business_name, business_type, permittee_name)
VALUES (117,
'Bionix',
'engineering',
'Anjo Badsu')
CALL sde.edit_version('<version_name>', 2, <message_code_output>, <message_output>)
CALL sde.edit_version('mvedits', 2, ?, ?)
COMMIT
CALL sde.delete_version('<version_name>', <message_code_output>, <message_output>)
CALL sde.delete_version('mvedits', ?,?)
EXECUTE FUNCTION sde.set_current_version('<version_name>')
EXECUTE FUNCTION sde.set_current_version('edits')
NOTE: Multiversioned views should not be used to access or modify complex features—features that participate in geometric networks, topologies, or relationships or have specific geodatabase behavior. You should use ArcGIS to view and modify these types of features.
Editing with multiversioned viewsWhen you edit versioned tables through multiversioned views, changes are made to the delta tables, and row ID values for new records are automatically generated. However, unlike editing versioned data in an ArcGIS edit session, no internal version reconciliation is done with these edits. Therefore, it is strongly recommended that multiversioned views not be used to edit the DEFAULT version or any version that may be subject to simultaneous editing or reconciliation by other users because conflicts will not be detected. Instead, create your own version specifically for editing with multiversioned views.NOTE: If you need to perform version management operations, such as reconciling, resolving conflicts, and posting, you need to use the ArcGIS software. Improper version management can lead to geodatabase corruption when working with views. Also note that you should never use DBMS tools to update any row ID (ObjectID) field maintained by ArcSDE in the database. These row ID fields are allocated and managed by the geodatabase and should not be altered.
There are several stored procedures installed with the ArcSDE component that help you work with multiversioned views. The stored procedure used to set which version the multiversioned view will work with was discussed in the previous section. There are also stored procedures to create a version in which you can do your editing, start and stop an edit session, and delete your edit version. The following set of steps takes you through creating a multiversioned view, creating a version in which to perform edits, setting the version to edit, starting an edit session, performing some edits through the multiversioned view, stopping the edit session, committing your edits to the database, and deleting the version created for the edits. In the examples, the multiversioned view created to perform the edits on the business table is permits_mv; the version created and used for editing is mvedits; and the coordinate system is a geographic coordinate system, datum NAD27, using the Clarke 1866 spheroid and decimal degree units. Remember that the dataset you edit through a multiversioned view must already have been registered as versioned through ArcGIS. For this example, the permits feature class would need to have already been registered as versioned in ArcCatalog to be able to edit it through a multiversioned view.sdetable –o create_mv_view –T permits_mv –t permits –i 4400 –D code –u sarja –p not4u
EXECUTE FUNCTION sde.create_version
('<parent_version>', '<child_version>', <name_rule>, <access>, '<description>')
EXECUTE FUNCTION sde.create_version
('sde.DEFAULT', 'mvedits', 1, 1, 'multiversioned view edit version')
EXECUTE FUNCTION set_current_version('<version_name>')
EXECUTE FUNCTION set_current_version('mvedits')
EXECUTE FUNCTION sde.edit_version('<version_name>',1)
EXECUTE FUNCTION sde.edit_version('mvedits',1)
UPDATE businesses_mvw
SET name = 'Cpt. Industry'
WHERE business_name = 'Body Electric'
INSERT INTO businesses_mvw
(bid, business_name, business_type, owner_name, location)
VALUES (117,
'Bionix',
'engineering',
'Anjo Badsu',
ST_PointFromText('point (40 40))', 12)
EXECUTE FUNCTION sde.edit_version('<version_name>',2)
EXECUTE FUNCTION sde.edit_version('mvedits',2)
COMMIT WORK
EXECUTE FUNCTION sde.delete_version('<version_name>')
EXECUTE FUNCTION sde.delete_version('mvedits')
EXEC sde.version_util.set_current_version('<version_name>')
EXEC sde.version_util.set_current_version('edits')
EXEC <user_schema_name>.version_user.set_current_version('<version_name>')
EXEC usertwo.version_user.set_current_version('edits')
NOTE: Multiversioned views should not be used to access or modify complex features—features that participate in geometric networks, topologies, or relationships or have specific geodatabase behavior. You should use ArcGIS to view and modify these types of features.
Editing with multiversioned viewsWhen you edit versioned tables through multiversioned views, changes are made to the delta tables, and row ID values for new records are automatically generated. However, unlike editing versioned data in an ArcGIS edit session, no internal version reconciliation is done with these edits. Therefore, it is strongly recommended that multiversioned views not be used to edit the DEFAULT version or any version that may be subject to simultaneous editing or reconciliation by other users because conflicts will not be detected. Instead, create your own version specifically for editing with multiversioned views.NOTE: If you need to perform version management operations, such as reconciling, resolving conflicts, and posting, you need to use the ArcGIS software. Improper version management can lead to geodatabase corruption when working with views. Also note that you should never use DBMS tools to update any row ID (ObjectID) field maintained by ArcSDE in the database. These row ID fields are allocated and managed by the geodatabase and should not be altered.
There are several stored procedures installed with the ArcSDE component that help you work with multiversioned views. The stored procedure used to set which version the multiversioned view will work with was discussed in the previous section. There are also stored procedures to create a version in which you can do your editing, start and stop an edit session, and delete your edit version. The following set of steps takes you through creating a multiversioned view, creating a version in which to perform edits, setting the version to edit, starting an edit session, performing some edits through the multiversioned view, stopping the edit session, committing your edits to the database, and deleting the version created for the edits. In the examples, the multiversioned view created to perform the edits on the business table is permits_mv; the version created and used for editing is mvedits; and the coordinate system is a geographic coordinate system, datum NAD27, using the Clarke 1866 spheroid and decimal degree units. Remember that the dataset you edit through a multiversioned view must already have been registered as versioned through ArcGIS. For this example, the permits feature class would need to have already been registered as versioned in ArcCatalog to be able to edit it through a multiversioned view. These edits are performed in the master SDE geodatabase (as opposed to being performed in a geodatabase in a user's schema).sdetable –o create_mv_view –T permits_mv –t permits –i 4400 –u sarja –p not4u
VARIABLE <variable_name> <string_data_type>;
EXEC :<variable_name> := '<version_name>';
VARIABLE mv_version NVARCHAR2(10);
EXEC :mv_version := 'mvedits';
EXEC sde.version_user_ddl.create_version
('<parent_version>', :<child_version_variable>, <name_rule>, <access>, '<description>')
EXEC sde.version_user_ddl.create_version
('sde.DEFAULT', :mv_version, sde.version_util.C_take_name_as_given, sde.version_util.C_version_private, 'multiversioned view edit version');
EXEC sde.version_util.set_current_version('<version_name>')
EXEC sde.version_util.set_current_version('mvedits');
EXEC sde.version_user_ddl.edit_version('<version_name>',1)
EXEC sde.version_user_ddl.edit_version('mvedits',1);
UPDATE businesses_mvw
SET owner_name = 'Cpt. Industry'
WHERE business_name = 'Body Electric';
INSERT INTO businesses_mvw
(bid, business_name, business_type, owner_name, location)
VALUES (117,
'Bionix',
'engineering',
'Anjo Badsu',
sde.ST_PointFromText('point (40 40))', 12);
EXEC sde.version_user_ddl.edit_version('<version_name>',2)
EXEC sde.version_user_ddl.edit_version('mvedits',2);
COMMIT
EXEC sde.version_user_ddl.delete_version('<version_name>')
EXEC sde.version_user_ddl.delete_version('mv_version');
SELECT sde.sde_set_current_version('<version_name>')
SELECT sde.sde_set_current_version('edits')
NOTE: Multiversioned views should not be used to access or modify complex features—features that participate in geometric networks, topologies, or relationships or have specific geodatabase behavior. You should use ArcGIS to view and modify these types of features.
Editing with multiversioned viewsWhen you edit versioned tables through multiversioned views, changes are made to the delta tables, and row ID values for new records are automatically generated. However, unlike editing versioned data in an ArcGIS edit session, no internal version reconciliation is done with these edits. Therefore, it is strongly recommended that multiversioned views not be used to edit the DEFAULT version or any version that may be subject to simultaneous editing or reconciliation by other users because conflicts will not be detected. Instead, create your own version specifically for editing with multiversioned views.NOTE: If you need to perform version management operations, such as reconciling, resolving conflicts, and posting, you need to use the ArcGIS software. Improper version management can lead to geodatabase corruption when working with views. Also note that you should never use DBMS tools to update any row ID (ObjectID) field maintained by ArcSDE in the database. These row ID fields are allocated and managed by the geodatabase and should not be altered.
There are several functions installed with the ArcSDE component that help you work with multiversioned views. The function used to set which version the multiversioned view will work with was discussed in the previous section. There are also functions to create a version in which you can do your editing, start and stop an edit session, and delete your edit version. The following set of steps takes you through creating a multiversioned view, creating a version in which to perform edits, setting the version to edit, starting an edit session, performing some edits through the multiversioned view, stopping the edit session, committing your edits to the database, and deleting the version created for the edits. In the examples, the multiversioned view created to perform the edits on the business table is permits_mv; the version created and used for editing is mvedits; and the coordinate system is a geographic coordinate system, datum NAD27, using the Clarke 1866 spheroid and decimal degree units. Remember that the dataset you edit through a multiversioned view must already have been registered as versioned through ArcGIS. For this example, the permits feature class would need to have already been registered as versioned in ArcCatalog to be able to edit it through a multiversioned view.sdetable –o create_mv_view –T permits_mv –t permits –i 4400 –D code –u sarja –p not4u
SELECT sde.sde_create_version
('<parent_name>', '<version_name>', <rule_code>, <access_code>, '<description>')
SELECT sde.sde_create_version('DEFAULT', 'mvedits', 2, 1, 'version for edits');
SELECT sde.sde_set_current_version('<version_name>');
SELECT sde.sde_set_current_version('mvedits');
SELECT sde.sde_edit_version('<version_name>',1);
SELECT sde.sde_edit_version('mvedits',1);
UPDATE businesses_mvw
SET owner_name = 'Cpt. Industry'
WHERE business_name = 'Body Electric';
INSERT INTO businesses_mvw
(bid, business_name, business_type, owner_name, location)
VALUES (117,
'Bionix',
'engineering',
'Anjo Badsu',
ST_Point('point (40 40))', 12);
SELECT registration_id FROM sde.sde_table_registry
WHERE table_name = 'businesses' and owner = 'editor';
registration_id
- ---------------
49
INSERT INTO businesses_mvw
(objectid, bid, business_name, business_type, owner_name, location)
VALUES ((SELECT o_base_id FROM editor.i49_get_ids(2,1)),
119
'Info4U',
'consultant',
'Neville Sorth',
ST_Point('point (12 36))', 12);
SELECT sde.sde_edit_version('<version_name>',2);
SELECT sde.sde_edit_version('mvedits',2);
SELECT sde.sde_delete_version('<version_name>');
SELECT sde.sde_delete_version('mvedits');
SELECT sde_clean_rule_functions();
EXEC sde.set_current_version '<version_name>'
EXEC sde.set_current_version 'edits'
EXEC dbo.set_current_version '<version_name>'
EXEC dbo.set_current_version 'edits'
NOTE: Multiversioned views should not be used to access or modify complex features—features that participate in geometric networks, topologies, or relationships or have specific geodatabase behavior. You should use ArcGIS to view and modify these types of features.
Editing with multiversioned viewsWhen you edit versioned tables through multiversioned views, changes are made to the delta tables, and row ID values for new records are automatically generated. However, unlike editing versioned data in an ArcGIS edit session, no internal version reconciliation is done with these edits. Therefore, it is strongly recommended that multiversioned views not be used to edit the DEFAULT version or any version that may be subject to simultaneous editing or reconciliation by other users because conflicts will not be detected. Instead, create your own version specifically for editing with multiversioned views.NOTE: If you need to perform version management operations, such as reconciling, resolving conflicts, and posting, you need to use the ArcGIS software. Improper version management can lead to geodatabase corruption when working with views. Also note that you should never use DBMS tools to update any row ID (ObjectID) field maintained by ArcSDE in the database. These row ID fields are allocated and managed by the geodatabase and should not be altered.
There are several stored procedures installed with the ArcSDE component that help you work with multiversioned views. The stored procedure used to set which version the multiversioned view will work with was discussed in the previous section. There are also stored procedures to create a version in which you can do your editing, start and stop an edit session, and delete your edit version. The following set of steps takes you through creating a multiversioned view, creating a version in which to perform edits, setting the version to edit, starting an edit session, performing some edits through the multiversioned view, stopping the edit session, committing your edits to the database, and deleting the version created for the edits. In the examples, the multiversioned view created to perform the edits on the business table is permits_mv; the version created and used for editing is mvedits; and the coordinate system is a geographic coordinate system, datum NAD27, using the Clarke 1866 spheroid and decimal degree units. Remember that the dataset you edit through a multiversioned view must already have been registered as versioned through ArcGIS. For this example, the permits feature class would need to have already been registered as versioned in ArcCatalog to be able to edit it through a multiversioned view. These edits are performed in a dbo-schema geodatabase.sdetable –o create_mv_view –T permits_mv –t permits –i 4400 –D code –u sarja –p not4u
EXEC dbo.create_version
'<parent_version>', '<child_version>', <name_rule>, <access>, '<description>'
EXEC dbo.create_version
'dbo.DEFAULT', 'mvedits', 1, 1, 'multiversioned view edit version'
EXEC dbo.set_current_version '<version_name>'
EXEC dbo.set_current_version 'dbo.mvedits'
EXEC dbo.edit_version '<version_name>', 1
EXEC dbo.edit_version 'dbo.mvedits', 1
UPDATE businesses_mvw
SET owner_name = 'Cpt. Industry'
WHERE business_name = 'Body Electric'
EXEC dbo.edit_version '<version_name>', 2
EXEC dbo.edit_version 'dbo.mvedits', 2
EXEC dbo.delete_version '<version_name>'
EXEC dbo.delete_version 'dbo.mvedits'