I. layer lock
· Layer lock types and functions
Two locks are defined in the ArcSDE layer: se_read_lock and se_write_lock. The scope of lock impact can be the entire layer or a certain range in the layer.
When the data is locked in the form of se_read_lock, the data is protected to prevent updates. Other users can also create the se_read_lock lock on the same data, but they cannot add the se_write_lock or update the data.
When the data is locked in the form of se_write_lock, this part of data cannot be updated by other users, and other users cannot add any lock to the same data.
It can also be introduced that data locked in the se_read_lock mode on the layer can overlap with each other, while data locked in the se_write_lock mode cannot overlap with each other.
· Use locks
The following code shows how to add and release locks on layers:
Seconnection conn = getconn ();
If (Conn! = NULL ){
Try {
Selayer layer = new selayer (Conn, "sde_cities", "shape ");
Layer. Lock (selayer. se_read_lock); // lock the entire layer in se_read_lock mode.
Layer. freelock ();
Layer. Lock (selayer. se_write_lock); // lock the entire layer in se_write_lock mode.
Layer. freelock ();
Layer. lockarea (selayer. se_read_lock, new seextent (-116, 39,
117, 40); // lock part of data in the se_read_lock Mode
Layer. freelock ();
} Catch (seexception e ){
E. printstacktrace ();
} Finally {
Try {
Conn. Close ();
} Catch (seexception e ){
E. printstacktrace ();
}
}
}