|
Perl-Msql API
|
|
PERL PROGRAMS
(see $CGI/pllib)
- MsqlPrintTable $tableName
- prints the whole table to standrad output
- EX: MsqlPrintTable InputTapeTable
- MsqlSelectRows $tableName @whichFields @whereFields
- selects from $tableName the rows matching the conditions in @whereFields,
and prints to STDOUT the fields specified in @whichFields
- @whichFields = list of desired table fields separeted by blank spaces:
$fieldOneName $fieldTwoName
- @whereFields = list of constraints of the form:
- where:$fieldName=$fieldValue for int fields
- where:$fieldName=\'$fieldValue\' for char fields
- EX: MsqlSelectRows InputTapeTable runNumber events
where:status=\'analized\' where:runNumber=8450
- MsqlDeleteRows $tableName @whereFields
- deletes from $tableName the rows matching the conditions in @whereFields
- @whereFields = list of constraints of the form:
- where:$fieldName=$fieldValue for int fields
- where:$fieldName=\'$fieldValue\' for char fields
- EX: MsqlDeleteRows InputTapeTable where:runNumber=8450 where:project=\'test\'
- MsqlUpdateRows $tableName @whereFields @setFields
- updates all rows in $tableName matching the conditions in @whereFields,
according to the instructions specified in @setFields
- @whereFields = list of constraints of the form:
- where:$fieldName=$fieldValue for int fields
- where:$fieldName=\'$fieldValue\' for char fields
- @setFields = list of constraints of the form:
- set:$fieldName=$fieldValue for int fields
- set:$fieldName=\'$fieldValue\' for char fields
- EX: MsqlUpdateRows InputTapeTable where:project=\'cascade\' set:project=\'kinks\'
- MsqlCreate_$tableName
- creates the specified table with the correct fields
- $tableName = InputTapeTable, InputFileTable, OutputFileTable, OutputTapeTable,
SkmTapeTable
- MsqlDropTable $tableName
- deletes the corresponding table and all the data within!
PERL SUBROUTINES
(see $CGI/pllib/MsqlDatabase.pl)
- (void) sub MsqlCreateTable($tableName,@fieldList)
- @fieldList = list of ($fieldName,$fieldValue) pairs
- (@fields) sub MsqlListFields($tableName)
- (STDOUT) sub MsqlPrintTable($tableName)
- STDOUT: one line per row in the form:
$fieldOneName=$fieldOneValue $fieldTwoName=$fieldTwoValue....
- (void) sub MsqlInsertRow($tableName,@fieldList)
- @fieldList = array of elements:
- ($fieldName=$fieldValue) for int fields
- ($fieldName='$fieldValue') for char fields
- (@rows) sub MsqlSelectRows($tableName,@whichFields,@whereFields)
- @whichFields = list of desired table fields: ($fieldOneName,$fieldTwoName,...)
- @whereFields = list of constraints of the form:
- "where:$fieldName=$fieldValue" for int fields
- "where:$fieldName='$fieldValue'" for char fields
- @rows = array containing one element per row in the form:
@row[$i] = "$fieldOneValue&$fieldTwoValue&$fieldThreeValue..."
- (%rows) sub MsqlSelectRowsHash
($tableName,@whichFields,@whereFields)
- --> sub MsqlSelectRows($tableName,@whichFields,@whereFields)
- %rows = hash table containing one element per row in the form:
$rows{$fieldOneValue} = "$fieldTwoValue&$fieldThreeValue..."
- (void) sub MsqlDeleteRows($tableName,@whereFields)
- @whereFields = list of constraints of the form:
- "where:$fieldName=$fieldValue" for int fields
- "where:$fieldName='$fieldValue'" for char fields
- (void) sub MsqlUpdateRows($tableName,@setFields,@whereFields)
- @setFields = list of fields to be updated of the form:
- "set:$fieldName=$fieldValue" for int fields
- "set:$fieldName='$fieldValue'" for char fields
- @whereFields = list of constraints of the form:
- "where:$fieldName=$fieldValue" for int fields
- "where:$fieldName='$fieldValue'" for char fields
- (@rows) sub MsqlSelectRowsFromManyTables (@whichTables,@whichFields,@whereFields)
- @whichTables = list of database tables ($tableOneName,$tableTwoName...)
- @whichFields = list of desired fields in the form:
($tableOneName.$firstField, $tableOneName.$secondField,
$tableTwoName.$fourthField...)
- @whereFields = list of constraints of the form:
- "where:$tableOneName.$firstField=where:$tableTwoName.$secondField"
- "where:$tableOneName.$firstField=$firstFieldValue" for int fields
- "where:$tableOneName.$firstField='$firstFieldValue'" for char fields
- @rows = array containing one element per joined row in the form:
@row[$i] = ($tableOneName.$firstField=$firstFieldValue&
$tableOneName.$secondField=$secondFieldValue&
$tableTwoName.$fourthField=$fourthFieldValue...)
- (void) sub MsqlDropTable($tableName)