Skip to content

Commit

Permalink
Merge pull request #27 from isc-egabhart/main
Browse files Browse the repository at this point in the history
Add Version checking for $system.SQL.Explain
  • Loading branch information
isc-tleavitt authored Dec 6, 2022
2 parents 1f03613 + e403723 commit 74a68cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
16 changes: 3 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased - 1.1.x]
## [1.1.0] - 2022-12-06

### Added
- Automatic tweaks have been reintroduced (after being removed due to breaking issues)
- Pulled in a variety of minor changes from internal development

### Changed
-

### Fixed
- Bracket matching for automatic tweaks now works
- Configuration method doesn't prompt for an indentation string if automatic indentation is disabled
- Unit tests described in module.xml
- Added unit tests!
- module.xml works with latest package manager version(s) and git-source-control - for some reason, Directory is needed. (This smells like a package manager bug, but the change is backward-compatible.)

### Security
-

### Removed
-

### Deprecated
-
- Fixed `<UNDEFINED>` error parsing triggers
- Fixed SQL plan options for earlier IRIS version without $System.SQL.Explain (#25)

## [1.0.3] - 2022-07-19
### Fixed
Expand Down
11 changes: 9 additions & 2 deletions cls/pkg/isc/codetidy/CodeTidy.cls
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ClassMethod Class(pClassName As %String, pSaveChanges = 0) As %Status
do triggerStream.WriteLine($piece(triggerDefinition.Code, $char(13, 10) , lineNumber) )
}
// Process the stream
do ..ProcessStream(triggerStream, triggerDefinition.Language, sqlSchemaName, "Trigger:" _ ClassName _ ":" _ triggerDefinition.Name)
do ..ProcessStream(triggerStream, triggerDefinition.Language, sqlSchemaName, "Trigger:" _ pClassName _ ":" _ triggerDefinition.Name)
// and copy from stream back to string
do triggerStream.Rewind()
set triggerString = ""
Expand Down Expand Up @@ -920,7 +920,14 @@ ClassMethod GetSQLPlan(ByRef SQL As %String, Schema As %String, Output Plan As %
set packages = ""
if Schema '= "" set packages = packages _ $listbuild(Schema)
if Schema '= "SQLUser" set packages = packages _ $listbuild("SQLUser")
do $system.SQL.Explain(.sql, {"quiet":1, "preparse":1, "selectmode":1}, , .%plan)

// Version detection as $system.SQL.ShowPlan is now deprecated
if $$$comMemberDefined("%System.SQL", $$$cCLASSmethod, "Explain") {
do $system.SQL.Explain(.sql, {"quiet":1, "preparse":1, "selectmode":1}, , .%plan)
}
else {
do $system.SQL.ShowPlan(.sql, 1, 0, packages, , , , , 1)
}

// Check for plan
if $data(%plan(1)) {
Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Export generator="IRIS" version="26">
<Document name="isc.codetidy.ZPM"><Module>
<Name>isc.codetidy</Name>
<Version>1.1.0+snapshot</Version>
<Version>1.1.0</Version>
<Packaging>module</Packaging>
<Resource Name="pkg.isc.codetidy.PKG" Directory="cls" />
<Resource Name="pkg.isc.codetidy.CodeTidy.INC" Directory="inc" />
Expand Down

0 comments on commit 74a68cd

Please sign in to comment.