Skip to content

Commit 71cdb05

Browse files
authored
Add snippet for custom class queries (intersystems-community#1111)
1 parent f3c6a00 commit 71cdb05

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

snippets/objectscript-class.json

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
],
115115
"description": "Unique Index"
116116
},
117-
"Query": {
117+
"Basic Class Query": {
118118
"prefix":["Query"],
119119
"body":[
120120
"/// ${1:Description}",
@@ -126,7 +126,32 @@
126126
"\tORDER BY ${7:ordering-items}",
127127
"}"
128128
],
129-
"description": "SQL statement"
129+
"description": "Basic class query (%SQLQuery)"
130+
},
131+
"Custom Class Query": {
132+
"prefix":["Query"],
133+
"body":[
134+
"/// ${1:Description}",
135+
"Query ${2:QueryName}($3) As %Query(ROWSPEC = \"$4\") [ SqlProc ]",
136+
"{",
137+
"}",
138+
"",
139+
"ClassMethod ${2:QueryName}Execute(ByRef qHandle As %Binary${3/(\\s)|(.*)/${2:+, }$2/}) As %Status",
140+
"{",
141+
"\tQuit \\$\\$\\$OK",
142+
"}",
143+
"",
144+
"ClassMethod ${2:QueryName}Close(ByRef qHandle As %Binary) As %Status [ PlaceAfter = ${2:QueryName}Execute ]",
145+
"{",
146+
"\tQuit \\$\\$\\$OK",
147+
"}",
148+
"",
149+
"ClassMethod ${2:QueryName}Fetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = ${2:QueryName}Execute ]",
150+
"{",
151+
"\tQuit \\$\\$\\$OK",
152+
"}"
153+
],
154+
"description": "Custom class query (%Query)"
130155
},
131156
"Trigger": {
132157
"prefix": "Trigger",

0 commit comments

Comments
 (0)