ws_sql.ecm 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2014 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. EspInclude(ws_workunits);
  14. EspInclude(ws_topology);
  15. ESPStruct HPCCColumn
  16. {
  17. string Name;
  18. string Type;
  19. };
  20. ESPStruct HPCCTable
  21. {
  22. string Name;
  23. ESParray<ESPstruct HPCCColumn, Column> Columns;
  24. string ECL;
  25. string Format;
  26. string ContentType;
  27. string Description;
  28. boolean IsKeyed;
  29. //string IndexFilePosFieldName;
  30. boolean IsSuper;
  31. string CsvQuote;
  32. string CsvSeparate;
  33. string CsvTerminate;
  34. string Group;
  35. integer MaxRecordSize;
  36. string Modified;
  37. integer NumParts;
  38. string Owner;
  39. };
  40. ESPstruct OutputDataset
  41. {
  42. string name;
  43. ESParray<ESPstruct HPCCColumn, OutParam> OutParams;
  44. };
  45. ESPstruct QuerySignature
  46. {
  47. ESParray<ESPstruct HPCCColumn, InParam> InParams;
  48. ESParray<ESPstruct OutputDataset, ResultSet> ResultSets;
  49. };
  50. ESPstruct PublishedQuery
  51. {
  52. string Name;
  53. string Id;
  54. string Wuid;
  55. boolean Suspended;
  56. ESPstruct QuerySignature Signature;
  57. };
  58. ESPStruct QuerySetAliasMap
  59. {
  60. string Id;
  61. string Name;
  62. };
  63. ESPStruct HPCCQuerySet
  64. {
  65. string Name;
  66. ESParray<ESPstruct PublishedQuery, QuerySetQuery> QuerySetQueries;
  67. ESParray<ESPstruct QuerySetAliasMap, QuerySetAlias> QuerySetAliases;
  68. };
  69. ESPStruct HPCCTargetCluster
  70. {
  71. string Name;
  72. ESParray<ESPstruct PublishedQuery, QuerySetQuery> QuerySetQueries;
  73. ESParray<ESPstruct QuerySetAliasMap, QuerySetAlias> QuerySetAliases;
  74. };
  75. ESPrequest PrepareSQLRequest
  76. {
  77. [rows(28), cols(80)] string SqlText;
  78. string TargetCluster; //where should this be compiled
  79. [min_ver("3.04")] ESParray<string, AlternateCluster> AlternateClusters; //Although this appears to be a runtime option, in ECL this is a compiletime option.
  80. string TargetQuerySet; //pertaining to Stored Proc calls
  81. int Wait(-1);
  82. //not so sure about this setting result limits in the prepare
  83. //int resultLimit(0);
  84. };
  85. ESPresponse [exceptions_inline] PrepareSQLResponse
  86. {
  87. ESPstruct ECLWorkunit Workunit;
  88. string Result;
  89. };
  90. ESPrequest ExecuteSQLRequest
  91. {
  92. [rows(28), cols(80)] string SqlText;
  93. string UserName;
  94. string TargetCluster; //where should this compile and execute
  95. [min_ver("3.04")] ESParray<string, AlternateCluster> AlternateClusters;
  96. string TargetQuerySet; //pertaining to Stored Proc calls
  97. boolean SuppressResults(false);
  98. boolean SuppressXmlSchema(true);
  99. int Wait(-1);
  100. int resultLimit(0);
  101. int ResultWindowStart(0);
  102. int ResultWindowCount(0);
  103. [min_ver(3.05)] boolean IgnoreCache(false);
  104. };
  105. ESPresponse [exceptions_inline] ExecuteSQLResponse
  106. {
  107. string ParentWuId;
  108. string Result;
  109. ESPstruct ECLWorkunit Workunit;
  110. int resultLimit;
  111. unsigned ResultWindowStart;
  112. unsigned ResultWindowCount;
  113. };
  114. ESPrequest ExecutePreparedSQLRequest
  115. {
  116. string WuId;
  117. string UserName;
  118. string TargetCluster; //where should this execute
  119. boolean SuppressResults(false);
  120. boolean SuppressXmlSchema(true);
  121. int Wait(-1);
  122. //int resultLimit(0); underlying WU code doesn't allow setting result limits on cloned wu
  123. int ResultWindowStart(0);
  124. int ResultWindowCount(0);
  125. ESParray<ESPstruct NamedValue> Variables;
  126. };
  127. ESPresponse [exceptions_inline] ExecutePreparedSQLResponse
  128. {
  129. string ParentWuId;
  130. string Result;
  131. //int resultLimit;
  132. unsigned ResultWindowStart;
  133. unsigned ResultWindowCount;
  134. ESPstruct ECLWorkunit Workunit;
  135. };
  136. ESPrequest GetDBSystemInfoRequest
  137. {
  138. boolean IncludeAll(true);
  139. };
  140. ESPresponse [exceptions_inline] GetDBSystemInfoResponse
  141. {
  142. string Name;
  143. string FullVersion;
  144. string Major;
  145. string Minor;
  146. string Point;
  147. string Project;
  148. string Maturity;
  149. [min_ver("3.01")] string WsSQLFullVersion;
  150. [min_ver("3.01")] string WsSQLMajor;
  151. [min_ver("3.01")] string WsSQLMinor;
  152. [min_ver("3.01")] string WsSQLPoint;
  153. [min_ver("3.01")] string WsSQLProject;
  154. [min_ver("3.01")] string WsSQLMaturity;
  155. };
  156. ESPrequest GetDBMetaDataRequest
  157. {
  158. boolean IncludeTables;
  159. string TableFilter;
  160. boolean IncludeStoredProcedures;
  161. string QuerySet;
  162. boolean IncludeTargetClusters;
  163. string ClusterType; //ALLCLUSTERS | ROOT
  164. };
  165. ESPresponse [exceptions_inline] GetDBMetaDataResponse
  166. {
  167. ESParray<ESPstruct HPCCTable, Table> Tables;
  168. integer TableCount;
  169. ESParray<ESPstruct HPCCQuerySet, QuerySet> QuerySets;
  170. ESParray<string, ClusterName> ClusterNames;
  171. };
  172. ESPrequest GetResultsRequest
  173. {
  174. string WuId;
  175. boolean SuppressXmlSchema(true);
  176. int ResultWindowStart(0);
  177. int ResultWindowCount(0);
  178. };
  179. ESPresponse [exceptions_inline] GetResultsResponse
  180. {
  181. string Result;
  182. unsigned ResultWindowStart;
  183. unsigned ResultWindowCount;
  184. ESPstruct ECLWorkunit Workunit;
  185. };
  186. ESPrequest EchoRequest
  187. {
  188. string Request;
  189. };
  190. ESPresponse EchoResponse
  191. {
  192. string Response;
  193. };
  194. ESPStruct RelatedIndexSet
  195. {
  196. String FileName;
  197. ESParray<String, Index> Indexes;
  198. };
  199. ESPrequest GetRelatedIndexesRequest
  200. {
  201. ESParray<String, FileName> FileNames;
  202. };
  203. ESPresponse GetRelatedIndexesResponse
  204. {
  205. ESParray<ESPstruct RelatedIndexSet, RelatedIndexSet> RelatedIndexSets;
  206. };
  207. ESPrequest SetRelatedIndexesRequest
  208. {
  209. ESParray<ESPstruct RelatedIndexSet, RelatedIndexSet> RelatedIndexSets;
  210. };
  211. ESPresponse SetRelatedIndexesResponse
  212. {
  213. ESParray<ESPstruct RelatedIndexSet, RelatedIndexSet> RelatedIndexSets;
  214. };
  215. ESPenum HPCCFieldType : string
  216. {
  217. BOOLEAN("BOOLEAN"),
  218. INTEGER("INTEGER"),
  219. xUNSIGNED("UNSIGNED"),
  220. REAL("REAL"),
  221. DECIMAL("DECIMAL"),
  222. UDECIMAL("UDECIMAL"),
  223. xSTRING("STRING"),
  224. QSTRING("QSTRING"),
  225. UNICODE("UNICODE"),
  226. DATA("DATA"),
  227. VARSTRING("VARSTRING"),
  228. VARUNICODE("VARUNICODE"),
  229. };
  230. ESPStruct EclFieldType
  231. {
  232. ESPenum HPCCFieldType Type;
  233. String Locale;
  234. Integer Length;
  235. Integer Precision;
  236. };
  237. ESPStruct EclFieldDeclaration
  238. {
  239. String FieldName;
  240. ESPStruct EclFieldType EclFieldType;
  241. };
  242. ESPstruct DataTypeParam
  243. {
  244. String Name;
  245. ESParray<String, Value> Values;
  246. };
  247. ESPenum HPCCFileType : string
  248. {
  249. FLAT("FLAT"),
  250. CSV("CSV"),
  251. JSON("JSON"),
  252. XML("XML"),
  253. };
  254. ESPStruct DataType
  255. {
  256. ESPenum HPCCFileType Type;
  257. ESParray<ESPstruct DataTypeParam, Param> Params;
  258. };
  259. ESPStruct DataSourceInfo
  260. {
  261. String SprayedFileName;
  262. String LandingZoneIP;
  263. String LandingZonePath;
  264. String LandingZoneFileName;
  265. };
  266. ESPrequest CreateTableAndLoadRequest
  267. {
  268. String TableName;
  269. String TableDescription;
  270. Boolean Overwrite;
  271. ESParray<ESPstruct EclFieldDeclaration, EclField> EclFields;
  272. String TargetCluster;
  273. String Owner;
  274. ESPStruct DataSourceInfo DataSource;
  275. ESPStruct DataType DataSourceType;
  276. int Wait(-1);
  277. };
  278. ESPresponse CreateTableAndLoadResponse
  279. {
  280. String TableName;
  281. Boolean Success;
  282. String EclRecordDefinition;
  283. ESPstruct ECLWorkunit Workunit;
  284. };
  285. ESPservice [version("3.05"), default_client_version("3.05"), auth_feature("DEFERRED"), exceptions_inline("./smc_xslt/exceptions.xslt")] wssql
  286. {
  287. ESPmethod [min_ver("3.03")] CreateTableAndLoad(CreateTableAndLoadRequest, CreateTableAndLoadResponse);
  288. ESPmethod [min_ver("3.02")] SetRelatedIndexes(SetRelatedIndexesRequest, SetRelatedIndexesResponse);
  289. ESPmethod [min_ver("3.02")] GetRelatedIndexes(GetRelatedIndexesRequest, GetRelatedIndexesResponse);
  290. ESPmethod [] PrepareSQL(PrepareSQLRequest, PrepareSQLResponse);
  291. ESPmethod [] ExecuteSQL(ExecuteSQLRequest, ExecuteSQLResponse);
  292. ESPmethod [] ExecutePreparedSQL(ExecutePreparedSQLRequest, ExecutePreparedSQLResponse);
  293. ESPmethod [] GetResults(GetResultsRequest, GetResultsResponse);
  294. ESPmethod [] GetDBSystemInfo(GetDBSystemInfoRequest, GetDBSystemInfoResponse);
  295. ESPmethod [] GetDBMetaData(GetDBMetaDataRequest, GetDBMetaDataResponse);
  296. ESPmethod Echo(EchoRequest, EchoResponse);
  297. };
  298. SCMexportdef(wssql);
  299. SCMapi(wssql) IClientwssql *createwssqlClient();