📄 dbquery.tcl
字号:
## lmLicHostIndexGet - gets index to lmHostRecs for hostName## This procedure gets the index in lmHostRecs list for the hostName parameter## SYNOPSIS# .tS# lmLicHostInfoGet <attribute> index# # .tE## PARAMETERS: hostName## RETURNS: index## ERRORS: N/A#proc lmLicHostIndexGet {hostName} { global lmVals for {set ix 0} {$ix < [llength $lmVals(lmHosts)]} {incr ix} { if {$hostName == [lindex $lmVals(lmHosts) $ix]} { break } } return $ix}############################################################################### lmLicHostInfoGet - gets attributes from lmHostRecs for host related items## This procedure gets attributes from lmHostRecs list for licensed host items# based on the index value parameter## SYNOPSIS# .tS# lmLicHostInfoGet <attribute> index# # .tE## PARAMETERS: attribute index# where attribute can be one of:# hostName returns the host name corresponding to index# hostId returns the host Id corresponding to index# hostPort returns the host port corresponding to index# and index is the index into the list## RETURNS: see above## ERRORS: N/A#proc lmLicHostInfoGet {attrib index} { global lmVals lmHostRecs lmHostRecsLen switch -exact $attrib { hostName { set rec [lindex $lmHostRecs $index] return [parseBarIndex $rec 0] } hostId { set rec [lindex $lmHostRecs $index] return [parseBarIndex $rec 1] } hostPort { set rec [lindex $lmHostRecs $index] return [parseBarIndex $rec 2] } default { puts "Error: no such attribute $attrib in lmHostRecs" return "" } }}############################################################################### lmLicProdInfoGet## This procedure returns licensed product info corresponding to the host# and the index into the list of licensed products for that host.## SYNOPSIS# .tS# lmLicProdInfoGet <attribute> hostName index# .tE## PARAMETERS: attribute hostName index# where attribute can be one of:# prodName returns the product name or feature name# featureId returns the featureId for the product# licAllocated returns the number of license already allocated# for this product## RETURNS: see above## ERRORS: N/A#proc lmLicProdInfoGet {attrib hostName index} { global lmVals lmHostRecs lmHostRecsLen lmHostFeaturesNum # get the record for the correct host set recIndex [lsearch -exact $lmVals(lmHosts) $hostName] set rec [lindex $lmHostRecs $recIndex] set rec [split $rec |] set featureRecs [lrange $rec 3 [expr 3 + [lindex $lmHostFeaturesNum $recIndex]]] switch -exact $attrib { prodName { set featureRec [lindex $featureRecs $index] return [parseColonIndex $featureRec 0] } featureId { set featureRec [lindex $featureRecs $index] return [parseColonIndex $featureRec 1] } licAllocated { set featureRec [lindex $featureRecs $index] return [parseColonIndex $featureRec 2] } default { puts "Error: no such attribute $attrib in lmHostRecs" return "" } }}############################################################################### lmTotalInfoGet## This procedure returns licensed product info (based on a given index),# corresponding to the totals that are returned by the database## SYNOPSIS# .tS# lmTotalInfoGet <attribute> index# .tE## PARAMETERS: attribute hostName index# where attribute can be one of:# prodName returns the product name or feature name# featureId returns the featureId for the product# totAllocated returns the number of licenses allocated# for this product## RETURNS: see above## ERRORS: N/A#proc lmTotalInfoGet {attrib index} { global lmVals lmTotalRecs switch -exact $attrib { prodName { set totalRec [lindex $lmTotalRecs $index] return [parseColonIndex $totalRec 0] } featureId { set totalRec [lindex $lmTotalRecs $index] return [parseColonIndex $totalRec 1] } totAllocated { set totalRec [lindex $lmTotalRecs $index] set allocated [parseColonIndex $totalRec 2] if { $allocated == "" } { return 0 } } default { puts "Error: no such attribute $attrib in lmHostRecs" return "" } }}############################################################################### lmFeaturesValueGet### Given feature's name, this procedure retrieves its corresponding value # from one of the specified lmVals: # lmFeaturesTotal# lmFeaturesAllocated# lmFeaturesAvailable## SYNOPSIS# .tS# lmFeaturesValueGet <attribute> prodName# .tE## PARAMETERS: attribute prodName# where attribute can be one of:# lmFeaturesTotal returns the total number of licenses for that # product for all hosts# lmFeaturesAllocated returns the total number of licenses allocated # for that product for all hosts# lmFeaturesAvailable returns the total number of licenses available# for that product for all hosts## RETURNS: see above## ERRORS: N/A#proc lmFeaturesValueGet {attrib prodName} { global lmVals set lmList [list lmFeaturesTotal lmFeaturesAllocated \ lmFeaturesAvailable] if { [lsearch -exact $lmList $attrib] == -1 } { puts "Error: no such attribute $attrib in lmVals!" return "" } foreach lm $lmVals($attrib) { if { [string match $prodName [lindex $lm 0]] } { return [lindex $lm 1] } }}####################################################################### parseColonIndex - routine which returns the value in colon# separated string.## SYNOPSIS# parseColonIndex string index## PARAMETERS:# string - string with colon separated values# index - index to use to fetch value, starting with 0## RETURNS: the value at index, or NULL string## ERRORS: N/A#proc parseColonIndex {string index} { set retVal "" set buf [split $string :] set retVal [lindex $buf $index] return $retVal}####################################################################### parseBarIndex - routine which returns the value in vertical bar# separated string.## SYNOPSIS# parseBarIndex string index## PARAMETERS:# string - string with bar separated values# index - index to use to fetch value, starting with 0## RETURNS: the value at index, or NULL string## ERRORS: N/A#proc parseBarIndex {string index} { set retVal "" set buf [split $string |] set retVal [lindex $buf $index] return $retVal}####################################################################### Dialog Text Messages######################################################################global setupValsset strTable(DBQUERY_TITLE) "Database Query Permission"set strTable(DBQUERY_MSG_1) \ "In order to automate this installation, SETUP will now query\ the Wind River web site with the following information:"set strTable(DBQUERY_MSG_2) \ "Access to the World Wide Web is required to access the Wind\ River license database. If you have a restrictive firewall or a\ proxy server, Automated License Installation is not possible.\ Please select \"No\" below."set strTable(DBQUERY_GRANT) \ "Yes, contact the Wind River web site."set strTable(DBQUERY_DENIED) \ "No, do not contact the Wind River web site."set strTable(DBQUERY_LICINFO_BANNER) \ "Retrieving license information, please wait..."set strTable(DBQUERY_ERROR) \ "License management configuration as an end-user is not complete!\ \n\nDue to network connection problems or errors received from the\ license database at Wind River you have chosen to discontinue license\ management setup.\n\nIf you desire to configure license management\ manually, an environment variable LM_LICENSE_FILE needs to be set to the\ name of the license server host. Please ask your system administrator\ for the server name and set the environment variable to it. The\ format of LM_LICENSE_FILE value is:\n\nport@server\n\nwhere:\n\"port\"\ is the port which is set by your system administrator. Port number\ can be left blank if using the default port (which is 27000).\ \n\"server\" is the name of the license server host.\n\nIf you do not\ configure license management manually, then upon invocation of any\ licensed application, you will be presented with end-user license\ management screens again."set strTable(DBQUERY_STATEMENT) \ "Note: This program will not upload any unauthorized information from\ your machine." set strTable(DBQUERY_VSN_DETAILS) \ "This option uses your disk serial number as your host\ ID instead of your MAC address.\n\nIf you have a laptop\ with a docking station, and you switch between\ them, this option is recommended.\n\nFor more information, please\ see our web site at\ http://www.windriver.com/corporate/support/license.html"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -