SclProcess
Overview
This command causes the pending delete, insert, insertupdate, query or update operation to be processed.
Synopsis
$QueryHandle SclProcess
$DeleteHandle SclProcess
$UpdateHandle SclProcess
Description
Execute the specified operation in accordance with any previously defiend constraints.
Arguments
- QueryHandle, DeleteHandle, UpdateHandle
The handle to a valid query, delete or update operation previously obtained using SclQuery, SclDelete or SclUpdate.
Examples
#
# Get the handle to an existing database and query the collar table
# displaying hole ID and max depth for all rows inside a rectangular region
#
if {[sclDatabases SclCountItems] < 1} {
error "No databases are connected"
}
sclDatabases SclGetItem DatabaseHandle 0
#
# create a query to iterate over all holes in the collar table
#
$DatabaseHandle SclQuery QueryHandle "collar"
$QueryHandle SclQueryColumn "hole_id" "max_depth" "y" "x" "z"
$QueryHandle SclConstraint "y > 7400 and y < 7500 and x > 1700 and x < 1800"
$QueryHandle SclProcess
$QueryHandle SclGetIterator QueryIterator
while {[$QueryIterator SclIterateNext RowHandle] == $SCL_TRUE} {
puts "Hole ID=[$RowHandle SclGetValueByName hole_id] max_depth=[$RowHandle\
SclGetValueByName max_depth] Y=[$RowHandle SclGetValueByName y]\
X=[$RowHandle SclGetValueByName x] Z=[$RowHandle SclGetValueByName z]"
}
SclDestroy QueryHandle
|
#
# Get the handle to an existing database and delete all rows
# whose hole_id is >= Z
#
if {[sclDatabases SclCountItems] < 1} {
error "No databases are connected"
}
sclDatabases SclGetItem DatabaseHandle 0
#
# create an insert operation for the collar table
#
$DatabaseHandle SclDelete DeleteHandle "collar"
$DeleteHandle SclConstraint "hole_id >= Z"
$DeleteHandle SclProcess
SclDestroy DeleteHandle
|
#
# Get the handle to an existing database and update all rows
# whose hole_id is >= Z
#
if {[sclDatabases SclCountItems] < 1} {
error "No databases are connected"
}
sclDatabases SclGetItem DatabaseHandle 0
#
# create an insert operation for the collar table
#
$DatabaseHandle SclUpdate UpdateHandle "collar"
$UpdateHandle SclSetValueByName max_depth 234.567
$UpdateHandle SclConstraint "hole_id >= Z"
$UpdateHandle SclProcess
SclDestroy UpdateHandle
# now display the modified row
# now check that the row actually made it into the table
$DatabaseHandle SclQuery QueryHandle "collar"
$QueryHandle SclConstraint "hole_id >= Z"
# get handle to the collar table
$DatabaseHandle SclIterateFirst DatabaseIterator
while {[$DatabaseIterator SclIterateNext TableHandle]} {
if {"[$TableHandle SclGetId]" == "collar"} {
break
}
}
# register all columns in the collar table
$TableHandle SclIterateFirst TableIterator
while {[$TableIterator SclIterateNext ColumnName]} {
$QueryHandle SclQueryColumn $ColumnName
lappend ColumnNames $ColumnName
}
puts "Column names = $ColumnNames"
$QueryHandle SclProcess
$QueryHandle SclGetIterator QueryIterator
while {[$QueryIterator SclIterateNext RowHandle] == $SCL_TRUE} {
# iterate over all values in the row and append them for display purposes
$RowHandle SclIterateFirst RowIterator
while {[$RowIterator SclIterateNext ColumnValue]} {
lappend values $ColumnValue
}
# now display the values for this row
puts "Row values = $values"
unset values
}
SclDestroy QueryHandle
|