class %CSP.UI.Portal.SQL.Home
extends %CSP.UI.Template.Property, %CSP.UI.Portal.UtilsNav
This class is used internally by InterSystems IRIS. You should not make direct use of it within your applications.
There is no guarantee made about either the behavior or future operation of this class.
Zen page for System Management Portal - Home for SQL
parameter AUTONS = 1;
Switch namespace $NAMESPACE is present
parameter CSPURL = "/csp/sys/exp/%CSP.UI.Portal.SQL.Home.zen";
This parameter is used to make sure that if multiple
CSP applications are mapped to the same namespace that the CSP engine can correctly
identify which class corresponds with which URL. If 'LockCSPName' is true (the default, defined
in the CSP application) then you can only access this page if the url exactly matches
this 'CSPURL'. You can set this parameter to "" if you wish to disable this check for
this class. This check is applied for all CSP urls (cls/csp/zen).
If this page was compiled from a .csp file, then this parameter is automatically set to contain the
url of this file used for compilation.
parameter HELPADDRESS = "Home,SQL";
Each SMP page should set this link which points to the documentation anchor name.
parameter PAGENAME = "SQL Home Page";
Displayed name of this page.
parameter RESOURCE = "%Development";
Security requirement
property BuilderPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/sys/exp/%25CSP.UI.SQL.QueryBuilderWindow.cls",,1) ];
Link pages
property CurrentCatalog
as %Integer;
current user selected catalog type - updated when user clicked on a tree node. -1=Nothing selected; 0=Table; 1=SystemTable; 2=View; 3=Procedure; 4=Cached Query
property CurrentItem
as %String;
current item (value) selected from the tree
property CurrentStatementPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/sys/op/%25CSP.UI.Portal.SQL.CurrentStatements.zen",,1) ];
property DEPRECATEDFLAG
as %Integer [ InitialExpression = "0" ];
Whether to include deprecated items
property Dialect
as %ZEN.Datatype.string [ InitialExpression = "IRIS" ];
SQL dialect used to prepare dynamic SQL statements
property DocBookPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/docbook/DocBook.UI.Page.zen",,1) ];
property DocumaticPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/documatic/%25CSP.Documatic.cls",,1) ];
property FILTERPROC
as %Integer;
Possible values: 1, 2, 3, 4, 5 (Functions & Queries, Functions & Queries & Extent, Functions, Queries, Queries & Extent)
property FILTERSCHEMA
as %Integer;
User selected schema
property FILTERTYPE
as %String;
Possible values: Tables, Views, Procedures, CQs
property Foreground
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
Whether to execute the SQL query in the foreground
property MaxRows
as %ZEN.Datatype.string [ InitialExpression = "1000" ];
Maximum rows to display in result tables
property NAMESPACE
as %String(ZENURL="$NAMESPACE");
Current namespace
property ObjectSelectMode
as %Integer [ InitialExpression = 0 ];
Specify how columns whose type class is a swizzleable class
will be defined in the result set class generated from a SELECT statement.
Currently it is always set to 0.
property OpenRoutinePage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/sys/exp/%25CSP.UI.System.ViewCode.cls",,1) ];
property OpenTablePage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/sys/exp/UtilSqlOpen.csp",,1) ];
property OpenViewPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/sys/exp/UtilSqlOpenView.csp",,1) ];
property PrintDetailsPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%CSP.UI.Portal.SQL.PrintTable.zen",,1) ];
property RuntimeMode
as %ZEN.Datatype.string [ InitialExpression = "2" ];
Default is Display Mode
property SQLFILTER
as %String;
String user entered to filter the tree.
property SQLHomePage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%25CSP.UI.Portal.SQL.Home.zen",,1) ];
property SQLParametersPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%CSP.UI.Portal.Dialog.SQLParametersPrompt.zen",,1) ];
property SQLStatementDetailsPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("_CSP.UI.Portal.Dialog.SQLStatementDetails.zen",,1) ];
property SQLViewPage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%CSP.UI.Portal.Dialog.SQLView.zen",,1) ];
property SYSTEMFLAG
as %Integer [ InitialExpression = "0" ];
Whether to include System items
property ShowRowNum
as %ZEN.Datatype.boolean [ InitialExpression = 0 ];
Whether to show row numbers in result tables
property StatementFilter
as %ZEN.Datatype.string;
Filter used for Statements table
property StatementMaxRows
as %ZEN.Datatype.integer [ InitialExpression = 1000 ];
Maximum rows to display in Statements table
property StatementPageSize
as %ZEN.Datatype.integer [ InitialExpression = 100 ];
PageSize used to display in Statements table
property StatementRadioSelect
as %ZEN.Datatype.string [ InitialExpression = "statementTable0" ];
Holds the selected redio option on the SQL Statements display
property TuneAllTablePage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%CSP.UI.Portal.Dialog.SQLTuneTables.zen",,1) ];
property TuneTablePage
as %ZEN.Datatype.string [ InitialExpression = ..Link("%CSP.UI.Portal.SQL.TuneTable.zen",,1) ];
property enableAutoRefresh
as %ZEN.Datatype.boolean [ InitialExpression = 1 ];
True if pages in the management portal are permitted to use auto-refresh behaviour.
property iconFolder
as %ZEN.Datatype.string [ InitialExpression = ..Link("/csp/broker/deepsee/folder_16.png") ];
icon used for major branch folder at the top level, such as Tables and Views
property msgDeleteCQNamespace
as %ZEN.Datatype.caption [ InitialExpression = $$$TextJS("Are you sure you want to delete ALL cached queries in namespace %1?") ];
property msgDeleteCQTable
as %ZEN.Datatype.caption [ InitialExpression = $$$TextJS("Are you sure you want to delete all cached queries for table %1?") ];
property msgSelectTable
as %ZEN.Datatype.caption [ InitialExpression = $$$TextJS("Please select a Table from the tree and try again.") ];
property processID
as %ZEN.Datatype.string [ InitialExpression = $JOB ];
Current Process ID ($JOB)
method %OnAfterCreatePage()
as %Status
Be sure to do ##super() when overriding.
classmethod %OnFinishBackgroundTask(pTaskID As %String)
as %Status
This server-side callback method is called whenever the client
calls to monitor the current background task and the task is complete.
Typically a subclass uses this to send back JavaScript to update
the page.
method %OnGetPageName()
as %String
Get the (localized) name of the page.
This should be implemented in a subclass.
classmethod %OnMonitorBackgroundTask(pTaskID As %String, pStatus As %String, pPercentComplete As %Float)
This server-side callback method is called whenever the client
calls to monitor the current background task.
Typically a subclass uses this to send back JavaScript to update
a progress bar.
method CancelQuery()
as %Boolean
[ ZenMethod ]
classmethod DeleteHistory(pID)
as %String
[ ZenMethod ]
classmethod DeleteHistoryAll()
[ ZenMethod ]
classmethod DeleteQuery(FILETYPE, selectedRows)
as %String
[ ZenMethod ]
FILETYPE = "PurgeCQNamespace", "PurgeCQTable", or "PurgeCQRoutines"
classmethod DrawCQDetails(pSeed)
as %Status
Draw html for Cached Query details
classmethod DrawGlobalLink(table As %ZEN.Component.tablePane, name As %String, seed As %String)
as %Status
Draw HTML link to View Global Contents page
method DrawHTML(pText As %String(MAXLEN=""))
as %Status
Draw HTML for Execute Query result.
classmethod DrawPerformance(pSeed)
as %Status
classmethod DrawProcedureDetails(pSeed)
as %Status
Draw html for Procedure detiails
classmethod DrawShowPlan(pText As %String(MAXLEN=""))
as %Status
classmethod DrawTableDetails(pSeed)
as %Status
Draw HTML for Table info and build link for Class documatic.
method DrawTableHeader(pSeed As %String)
as %Status
Draw the contents of the Table Header (the region between the diagram and the table).
classmethod DrawToggleIndexStatus(table As %ZEN.Component.tablePane, name As %String, seed As %String)
as %Status
Draw link to toggle map selectability
classmethod DrawViewDetails(pSeed)
as %Status
classmethod Drop(pDropType, pSchema, pTable)
as %String
[ ZenMethod ]
Drop a Table, View, Procedure, or CachedQuery
classmethod GetCQText(pRoutine)
as %String
[ ZenMethod ]
Given cached query routine name, return query text
classmethod GetCQs(pShowSystem, pFilter, pSchema, pTotalNumber, ByRef pTree)
as %Integer
Build array for Cached Queries tree.
If schema is not null then use CachedQueryInfo that takes in the schema name and get routines(classes) that belong to that schema.
If filter is not null then match routine name to that filter.
classmethod GetExpandState(FILETYPE)
as %String
classmethod GetLastTreeLoaded()
as %String
[ ZenMethod ]
classmethod GetProcedures(pShowSystem, pFilter, pFilterOption, pTotalNumber, pDeprecated, ByRef pTree)
as %Integer
Build array for Procedures tree
classmethod GetRecentList(FILTERTYPE)
as %String
[ ZenMethod ]
method GetSQLInfo(ByRef pParms, Output pObject As %RegisteredObject)
as %Status
******** End of Special Code for Expand *************
Return json for info.
classmethod GetStatus(pCurrentQueryID As %Integer = "")
as %ZEN.proxyObject
[ ZenMethod ]
when DrawHTML is finished, Status is "Done" then we update the Performance value.
classmethod GetTableFields(pSchemaNumber, pTableLevel, pTableName, ByRef pTree)
as %Integer
Build field array for a table
classmethod GetTables(pShowSystem, pFilter, pSchemaNumber, pDeprecated, ByRef pTree)
as %Integer
Build array for Tables tree
classmethod GetText(pID)
as %String
[ ZenMethod ]
Given a history ID, return query text
classmethod GetTreeInfo(pRoot As %String, Output pTree, ByRef pParms)
as %Status
Provide contents of the data source tree.
classmethod GetViews(pShowSystem, pFilter, pTotalNumber, pDeprecated, ByRef pTree)
as %Integer
Build array for Views tree
method ListSchemas(pRS As %Library.ResultSet, Output tSC As %Status, pInfo As %ZEN.Auxiliary.QueryInfo)
as %Boolean
Method for executing the query for list schemas.
method OnGetRibbonInfo(Output pDisplay As %Boolean, Output pViewIcons As %List, Output pSortOptions As %List, Output pSearchBox As %Boolean, Output pRibbonTitle As %String, Output pCommands As %List)
as %Status
Curently we do not display the ribbon for this page.
classmethod OpenTableMaxRowsUpdate(pMax)
[ ZenMethod ]
classmethod ParseTextPiece(n, tLine)
Parse $C(10) from each line of query text and put into session array
classmethod PrepareAction(pText)
as %String
[ ZenMethod ]
Save user's latest query text into global for later execution
classmethod PrepareDeletion(FILETYPE, selectedRows)
as %String
[ ZenMethod ]
Save selected cached query routines into %session
FILETYPE = "PurgeCQRoutines"
classmethod PrepareQuery(pText, pRuntimeMode, pDialect, pObjectSelectMode)
as %String
[ ZenMethod ]
Prepare to execute query.
Save user's latest query text into global for later execution
Return number of parameters the query text may have.
classmethod Quoter2(val)
as %String
[ ZenMethod ]
This functions takes a table/view schema.name and quote either piece if needed
classmethod RebuildIndices(pSchema, pTable, pIndex="")
as %String
[ ZenMethod ]
method RefreshTableStatements()
[ Language = javascript ]
show catalog details for a table
classmethod SaveExpandState(FILETYPE, searchExpanded)
[ ZenMethod ]
classmethod SaveFilter(FILETYPE, SQLFILTER, FILTERPROC, SYSTEMFLAG, DEPRECATEDFLAG)
as %Boolean
[ ZenMethod ]
FILTERTYPE is any of the choices from Filter drop-down.
classmethod SaveLastTreeLoaded(pBranch, pTotalNumber)
as %String
classmethod SaveParameters(RuntimeMode, MaxRows, ShowRowNum, Dialect, ObjectSelectMode, Foreground)
[ ZenMethod ]
classmethod SaveQueryHistory(QueryText As %String, Output HistoryId)
as %Status
method StartQuery(foreground As %Boolean = 0)
as %Boolean
[ ZenMethod ]
classmethod StartQueryExecution(pRunInBackground As %Boolean = 1, pQueryID As %Integer, pRuntimeMode As %String, pDialect As %String, pObjectSelectMode As %Integer, pShowRowNum As %Boolean, pMaxRows As %Integer)
as %Status
classmethod StatementIndexClean()
[ ZenMethod ]
Call logic to cleanup stale statement index entries that do not have routines/classes anymore
classmethod TableFields(tableName)
as %String
[ ZenMethod ]
Given schema == table, return a list of fields concatenated by commas excluding hidden fields. Used by drag and drop.
classmethod UpdateTableNavState(pFilter As %String, pPageSize As %Integer, pMaxRows As %Integer, ptableId As %String)
[ ZenMethod ]
Used to Save tableNavBar values, add MapType to the page name to distinguish the type for the page.
method adjustSizes()
[ Language = javascript ]
method deleteSelectedQuery()
[ Language = javascript ]
if there are selected quries, then we are deleting selected queries.
else 1) if there are selected schema.table, then asking if user wants to delete
method doAction(action)
[ Language = javascript ]
This method takes care of actions that do not need schema.table name
method doActionTable(action)
[ Language = javascript ]
This method takes care of actions that need schema.table name
method doAllSchemas(applyFilter)
[ Language = javascript ]
This method is called to show schemas
method doDeleteAll()
[ Language = javascript ]
method doDrill(drillType, schemaname, overrideFilter)
[ Language = javascript ]
drillType indicate the type (1 based. Tables/Views...) if overrideFilter is 0 then do not override Filter unless it is null.
method doExecute()
[ Language = javascript ]
method doFilterType()
[ Language = javascript ]
user changed filter type. Show or hide procedure options.
method doHistory()
[ Language = javascript ]
*** Methods for Exeucte Query ***
method doInprogress()
[ Language = javascript ]
method doOpenDoc(className)
[ Language = javascript ]
This method opens Documatic in a seperate window. Called by table class doc and procedure doc.
method doOpenTableMax(maxRows)
[ Language = javascript ]
method doQueryBuilder()
[ Language = javascript ]
method doRebuildIndex(pIndex)
[ Language = javascript ]
This is the method for rebuilding a particular index
method doReferenceTo(newtable, type)
[ Language = javascript ]
User clicked a ReferenceTo link.
Check the current tree to see if we can find the reference class. If yes then make it selected and we won't need to refresh tree.
Otherwise, refresh tree with the new reference class as filter.
The tree will be collapsed and we will hide groupDetails and show message to remind user to reselect item from tree.
type arguement. 0 = Tables, 1 = View, 2 = Stored procedures
method doReloadNode(listType)
[ Language = javascript ]
This method reload a particular listType.
The expected behavior:
If the current list selected on the tree is equal to the listType and is expanded, then reload the list and expand.
method doSearch()
[ Language = javascript ]
reload tree with new filter. when this happens we want to hide groupDetails and
show the message to remind user to select item from tree.
method doSelectRow(thisTable)
[ Language = javascript ]
method doShowPlan()
[ Language = javascript ]
method doStatementDetailsTo(stmthash, openInTab)
[ Language = javascript ]
User clicked a StatementDetailsTo link.
method doTree(tree)
[ Language = javascript ]
*** Methods for tree item text click ***
method getTable()
[ Language = javascript ]
Return tree's selected index value
method historyFilterChanged(value)
[ Language = javascript ]
User entered something in to the filter. Re-load the table with filter value.
method keyUp(zenEvent, flag)
[ Language = javascript ]
Check if user hit [Enter].
method keyUpQueryText(tControl)
[ Language = javascript ]
method navMaxRowsChanged(value, tableId)
[ Language = javascript ]
Overriden to add tabId and tableId to the page name to distinguish the type for the page.
method navPageSizeChanged(value, tableId)
[ Language = javascript ]
Overriden to add tabId and tableId to the page name to distinguish the type for the page.
method onPopupAction(popupName, action, value)
[ Language = javascript ]
This client event is fired when the a popup page launched from this page fires an action.
method onlayoutHandler(load)
[ Language = javascript ]
This client event, if present, is fired when the page
is first loaded or whenever it is resized.
If this is called at load time, then load will
be true.
method onloadHandler(load)
[ Language = javascript ]
Disable save button for EMS-managed pages.
Be sure to use this.invokeSuper('onloadHandler',arguments); when overriding.
method prepareProp(routine)
[ Language = javascript ]
User clicked the Cached Query link (it used to be a routine and now it's class) after executed a query. Hide components so that we can show CQ details.
Check the current tree to see if we can find the routine. If yes then make it selected and we won't need to refresh tree.
Otherwise, refresh tree with the new routine as filter.
The tree will be collapsed and we will hide groupDetails and show message to remind user to reselect item from tree.
method selectCQ(tRoutine, tAction)
[ Language = javascript ]
User clicked Exeucte or ShowPlan link from the Cached Query details box. Query Routine is passed in.
method selectHistory(tID, tAction)
[ Language = javascript ]
This method processes actions for a query history item.
method selectSchema(schema)
[ Language = javascript ]
method showCQ(routine)
[ Language = javascript ]
method showCQTable(routine)
[ Language = javascript ]
method showCatalog()
[ Language = javascript ]
show catalog details for a table
method showCatalogCQ()
[ Language = javascript ]
show catalog details for a cached query
method showCatalogProc()
[ Language = javascript ]
show catalog details for a stored procedure
method showCatalogView()
[ Language = javascript ]
show catalog details for a view
method showExpand()
[ Language = javascript ]
Note that this arrow is the opposite of search.
method showStatement(statement)
[ Language = javascript ]
method showStatementTable(statement)
[ Language = javascript ]
method showStatements()
[ Language = javascript ]
show statement details for a table
method statementFilterChanged(value)
[ Language = javascript ]
User entered something in to the filter. Re-load the table with filter value.
method statementRefresh()
[ Language = javascript ]
this method maybe called from StatementDetails page to update table
method tabChanged(tab, totalTabs)
[ Language = javascript ]
user clicked a tab. hide/show result tables, and alter tab's background color.
method tableDropHandler(dragData)
[ Language = javascript ]
Drop handler for model table.
method timeout()
[ Language = javascript ]
This is currently used for cached queries. When user clicks the cached query name from the Execute Query tab,
we reload the tree for the cached query and starts the timer. When the timer reaches it's end it calls this method
to have the selected cached query "clicked" so that the CQ info block can be shown.
method toggleClearText(tControl)
[ Language = javascript ]
show or hide the Clear image for Query Text or Filter
classmethod toggleIndexStatus(tableName As %String, indexName As %String, selectability As %Boolean)
as %Status
[ ZenMethod ]
method toggleOptions()
[ Language = javascript ]
method toggleSearch()
[ Language = javascript ]
Toggle display of search pane.
method updateParameters()
[ Language = javascript ]
Update properties for Execute Query and save to server for the future.
method updateStatistics()
[ Language = javascript ]
This method is fired up after onDrawContent is finished. Hide progress message and display error if exists.
method updateTreeItems()
[ Language = javascript ]
Update number of tree items loaded after a tree branch is loaded.
Totals are displayed at the bottom of the the tree pane
method validateText()
[ Language = javascript ]