001: /* Copyright (c) 2001-2005, The HSQL Development Group
002: * All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * Redistributions of source code must retain the above copyright notice, this
008: * list of conditions and the following disclaimer.
009: *
010: * Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * Neither the name of the HSQL Development Group nor the names of its
015: * contributors may be used to endorse or promote products derived from this
016: * software without specific prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
022: * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
023: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
024: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
025: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
026: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
027: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
028: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029: */
030:
031: package org.hsqldb;
032:
033: // This can probably just be merged with Result.
034:
035: /**
036: * An enumeration of the request and response mode values used to communicate
037: * between the client and the engine when sending Result objects back
038: * and forth.
039: *
040: * @author boucherb@users
041: * @since 1.7.2
042: * @version 1.7.2
043: */
044: // fredt@users - the constants from the SQL standards are used freely where a
045: // similar function is performed. The Result objects do not necessarily contain
046: // the same information as stated in SQL standard for CLI.
047: public interface ResultConstants {
048:
049: /** The offset at which HSQLDB API Result mode values start. */
050: int HSQL_API_BASE = 0;
051:
052: /**
053: * Indicates that the Result object encapsulates multiple Result objects.
054: */
055: int MULTI = HSQL_API_BASE + 0;
056:
057: /**
058: * Indicates that the Result object encapsulates an update
059: * count response.
060: */
061: int UPDATECOUNT = HSQL_API_BASE + 1;
062:
063: /**
064: * Indicates that the Result object encapsualtes an
065: * error response.
066: */
067: int ERROR = HSQL_API_BASE + 2;
068:
069: /**
070: * Indicates that the Result object encapsulates a result
071: * set response containing data.
072: */
073: int DATA = HSQL_API_BASE + 3;
074:
075: /**
076: * Indicates that the Result object encapsulates a response
077: * that communicates the acknowlegement of newly allocated
078: * CompiledStatement object in the form of its statementID.
079: */
080: int PREPARE_ACK = HSQL_API_BASE + 4;
081:
082: /**
083: * Indicates that the Result object encapsulates a result
084: * set response containing parameter metadata.
085: */
086: int PARAM_META_DATA = HSQL_API_BASE + 5;
087:
088: /**
089: * Indicates that the Result object encapsulates a result
090: * set for setting session attributes.
091: */
092: int SETSESSIONATTR = HSQL_API_BASE + 6;
093:
094: /**
095: * Indicates that the Result object encapsulates a request
096: * to get session attributes.
097: */
098: int GETSESSIONATTR = HSQL_API_BASE + 7;
099:
100: /**
101: * Indicates that the Result object encapsulates a batch of statements
102: */
103: int BATCHEXECDIRECT = HSQL_API_BASE + 8;
104:
105: /**
106: * Indicates that the Result object encapsulates a batch of prepared
107: * statement parameter values
108: */
109: int BATCHEXECUTE = HSQL_API_BASE + 9;
110:
111: /**
112: * Indicates that the Result object encapsulates a request to start a new
113: * internal session for the connection
114: */
115: int HSQLRESETSESSION = HSQL_API_BASE + 10;
116:
117: /**
118: * Indicates that the Result object encapsulates a request to prepare
119: * to commit as the first phase of a two-phase commit
120: */
121: int HSQLPREPARECOMMIT = HSQL_API_BASE + 11;
122:
123: /** The offset at which the standard SQL API Result mode values start. */
124: int SQL_API_BASE = 0x00010000;
125:
126: // /**
127: // * Indicates that Result encapsulates a request to allocate an
128: // * SQL-connection and assign a handle to it.
129: // */
130: // int SQLALLOCCONNECT = SQL_API_BASE + 1;
131: // /**
132: // * Indicates that Result encapsulates a request to allocate an
133: // * SQL-environment and assign a handle to it.
134: // */
135: // int SQLALLOCENV = SQL_API_BASE + 2;
136: //
137: // /**
138: // * Indicates that Result encapsulates a request to allocate a resource
139: // * and assign a handle to it.
140: // */
141: // int SQLALLOCHANDLE = SQL_API_BASE + 1001;
142: //
143: // /**
144: // * Indicates that Result encapsulates a request to allocate an
145: // * SQL-statement and assign a handle to it.
146: // */
147: // int SQLALLOCSTMT = SQL_API_BASE + 3;
148: //
149: // /**
150: // * Indicates that Result encapsulates a request to describe a target
151: // * specification or array of target specifications.
152: // */
153: // int SQLBINDCOL = SQL_API_BASE + 4;
154: //
155: // /**
156: // * Indicates that Result encapsulates a request to describe a
157: // * dynamic parameter specification and its value.
158: // */
159: // int SQLBINDPARAMETER = SQL_API_BASE + 72;
160: //
161: // /**
162: // * Indicates that Result encapsulates a request to cancel execution of
163: // * a CLI routine.
164: // */
165: // int SQLCANCEL = SQL_API_BASE + 5;
166: //
167: // /** Indicates that Result encapsulates a request to close a cursor. */
168: // int SQLCLOSECURSOR = SQL_API_BASE + 1003;
169: //
170: // /**
171: // * Indicates that Result encapsulates a request to get a
172: // * column attribute.
173: // */
174: // int SQLCOLATTRIBUTE = SQL_API_BASE + 6;
175: //
176: // /**
177: // * Indicates that Result encapsulates a request to return a result set that
178: // * contains a list of the privileges held on the columns whose names adhere
179: // * to the requested pattern or patterns within a single specified table
180: // * stored in the Information Schema of the connected data source.
181: // */
182: // int SQLCOLUMNPRIVILEGES = SQL_API_BASE + 56;
183: //
184: // /**
185: // * Indicates that Result encapsulates a request to, based on the specified
186: // * selection criteria, return a result set that contains information about
187: // * columns of tables stored in the information schemas of the connected
188: // * data source.
189: // */
190: // int SQLCOLUMNS = SQL_API_BASE + 40;
191: //
192:
193: /**
194: * Indicates that Result encapsulates a request to establish a connection.
195: */
196: int SQLCONNECT = SQL_API_BASE + 7;
197:
198: // /**
199: // * Indicates that Result encapsulates a request to copy a CLI descriptor.
200: // */
201: // int SQLCOPYDESC = SQL_API_BASE + 1004;
202: //
203: // /**
204: // * Indicates that Result encapsulates a request to get server name(s) that
205: // * the application can connect to, along with description information,
206: // * if available.
207: // */
208: // int SQLDATASOURCES = SQL_API_BASE + 57;
209: //
210: // /**
211: // * Indicates that Result encapsulates a request to get column attributes.
212: // */
213: // int SQLDESCRIBECOL = SQL_API_BASE + 8;
214: //
215:
216: /**
217: * Indicates that Result encapsulates a request to terminate an
218: * established connection.
219: */
220: int SQLDISCONNECT = SQL_API_BASE + 9;
221:
222: /**
223: * Indicates that Result encapsulates a request to terminate an
224: * SQL-transaction.
225: */
226: int SQLENDTRAN = SQL_API_BASE + 1005;
227:
228: // /**
229: // * Indicates that Result encapsulates a request to return diagnostic
230: // * information.
231: // */
232: // int SQLERROR = SQL_API_BASE + 10;
233:
234: /**
235: * Indicates that Result encapsulates a request to execute a statement
236: * directly.
237: */
238: int SQLEXECDIRECT = SQL_API_BASE + 11;
239:
240: /**
241: * Indicates that Result encapsulates a request to execute a prepared
242: * statement.
243: */
244: int SQLEXECUTE = SQL_API_BASE + 12;
245:
246: /**
247: * Indicates that Result encapsulates a request to fetch the next row of
248: * a cursor.
249: */
250:
251: // int SQLFETCH = SQL_API_BASE + 13;
252: /**
253: * Indicates that Result encapsulates a request to position a cursor on
254: * the specified row and retrieve values from that row.
255: */
256: // int SQLFETCHSCROLL = SQL_API_BASE + 1021;
257: // /**
258: // * Indicates that Result encapsulates a request to return a result set
259: // * that contains information about foreign keys either in or referencing
260: // * a single specified table stored in the Information Schema of the
261: // * connected data source.
262: // */
263: // int SQLFOREIGNKEYS = SQL_API_BASE + 60;
264: //
265: // /**
266: // * Indicates that Result encapsulates a request to deallocate an
267: // * SQL-connection.
268: // */
269: // int SQLFREECONNECT = SQL_API_BASE + 14;
270: //
271: // /**
272: // * Indicates that Result encapsulates a request to deallocate an
273: // * SQL-environment.
274: // */
275: // int SQLFREEENV = SQL_API_BASE + 15;
276: //
277: // /**
278: // * Indicates that Result encapsulates a request to free a resource.
279: // */
280: // int SQLFREEHANDLE = SQL_API_BASE + 1006;
281: /**
282: * Indicates that Result encapsulates a request to deallocate an
283: * SQL-statement.
284: */
285: int SQLFREESTMT = SQL_API_BASE + 16;
286:
287: // /**
288: // * Indicates that Result encapsulates a request to get the value of an
289: // * SQL-connection attribute.
290: // */
291: // int SQLGETCONNECTATTR = SQL_API_BASE + 1007;
292: //
293: // /**
294: // * Indicates that Result encapsulates a request to get a cursor name.
295: // */
296: // int SQLGETCURSORNAME = SQL_API_BASE + 17;
297: //
298: // /**
299: // * Indicates that Result encapsulates a request to retrieve a column value.
300: // */
301: // int SQLGETDATA = SQL_API_BASE + 43;
302: //
303: // /**
304: // * Indicates that Result encapsulates a request to get a field from a CLI
305: // * descriptor area.
306: // */
307: // int SQLGETDESCFIELD = SQL_API_BASE + 1008;
308: //
309: // /**
310: // * Indicates that Result encapsulates a request to get commonly-used
311: // * fields from a CLI descriptor area.
312: // */
313: // int SQLGETDESCREC = SQL_API_BASE + 1009;
314: //
315: // /**
316: // * Indicates that Result encapsulates a request to get information from a
317: // * CLI diagnostics area.
318: // */
319: // int SQLGETDIAGFIELD = SQL_API_BASE + 1010;
320: //
321: // /** Indicates that Result encapsulates a request to get commonly-used
322: // * information from a CLI diagnostics area.
323: // */
324: // int SQLGETDIAGREC = SQL_API_BASE + 1011;
325: //
326: // /**
327: // * Indicates that Result encapsulates a request to get the value of an
328: // * SQL-environment attribute.
329: // */
330: // int SQLGETENVATTR = SQL_API_BASE + 1012;
331: //
332: // /**
333: // * Indicates that Result encapsulates a request to get information
334: // * about features supported by the CLI implementation.
335: // */
336: // int SQLGETFEATUREINFO = SQL_API_BASE + 1027;
337: //
338: // /**
339: // * Indicates that Result encapsulates a request to determine whether a CLI
340: // * routine is supported.
341: // */
342: // int SQLGETFUNCTIONS = SQL_API_BASE + 44;
343: //
344: // /**
345: // * Indicates that Result encapsulates a request to get information about
346: // * the implementation.
347: // */
348: // int SQLGETINFO = SQL_API_BASE + 45;
349: //
350: // /**
351: // * Indicates that Result encapsulates a request to retrieve the length of
352: // * the character or octet string value represented by a Large Object
353: // * locator.
354: // */
355: // int SQLGETLENGTH = SQL_API_BASE + 1022;
356: //
357: // /**
358: // * Indicates that Result encapsulates a request to retrieve the value of a
359: // * dynamic output parameter.
360: // */
361: // int SQLGETPARAMDATA = SQL_API_BASE + 1025;
362: //
363: // /**
364: // * Indicates that Result encapsulates a request to retrieve the starting
365: // * position of a string value within another string value, where the second
366: // * string value is represented by a Large Object locator.
367: // */
368: // int SQLGETPOSITION = SQL_API_BASE + 1023;
369: //
370:
371: /**
372: * Indicates that Result encapsulates a request to get information about
373: * general value specifications supported by the implementation.
374: */
375: // int SQLGETSESSIONINFO = SQL_API_BASE + 1028;
376: // /**
377: // * Indicates that Result encapsulates a request to get the value of an
378: // * SQL-statement attribute.
379: // */
380: // int SQLGETSTMTATTR = SQL_API_BASE + 1014;
381: //
382: // /**
383: // * Indicates that Result encapsulates a request to either retrieve a
384: // * portion of a character or octet string value that is represented by
385: // * a Large Object locator or create a Large Object value at the server
386: // * and retrieve a Large Object locator for that value.
387: // */
388: // int SQLGETSUBSTRING = SQL_API_BASE + 1024;
389: //
390: // /**
391: // * Indicates that Result encapsulates a request to get information about
392: // * one or all of the predefined data types supported by the implementation.
393: // */
394: // int SQLGETTYPEINFO = SQL_API_BASE + 47;
395: /**
396: * Indicates that Result encapsulates a request to determine whether there
397: * are more result sets available on a statement handle and, if there are,
398: * initialize processing for those result sets.
399: */
400: // int SQLMORERESULTS = SQL_API_BASE + 61;
401: /**
402: * Indicates that Result encapsulates a request to determine whether there
403: * are more result sets available on a statement handle and, if there are,
404: * initialize processing for the next result set on a separate statement
405: * handle.
406: */
407: // int SQLNEXTRESULT = SQL_API_BASE + 73;
408: // /**
409: // * Indicates that Result encapsulates a request to get the number of
410: // * result columns of a prepared or executed statement.
411: // */
412: // int SQLNUMRESULTCOLS = SQL_API_BASE + 18;
413: // /**
414: // * Indicates that Result encapsulates a request to process a deferred
415: // * parameter value. For example, a streamed or locator identified
416: // * parameter.
417: // */
418: // int SQLPARAMDATA = SQL_API_BASE + 48;
419: /**
420: * Indicates that Result encapsulates a request to prepare a statement.
421: */
422: int SQLPREPARE = SQL_API_BASE + 19;
423:
424: // /**
425: // * Indicates that Result encapsulates a request to return a result set that
426: // * contains a list of the column names that comprise the primary key for a
427: // * single specified table stored in the information schemas of the
428: // * connected data source.
429: // */
430: // int SQLPRIMARYKEYS = SQL_API_BASE + 65;
431: //
432: // /**
433: // * Indicates that Result encapsulates a request to provide a deferred
434: // * parameter value. For example, a streamed or locator-identified
435: // * parameter.
436: // */
437: // int SQLPUTDATA = SQL_API_BASE + 49;
438:
439: /**
440: * Indicates that Result encapsulates a request to get the row count of an
441: * executed statement.
442: */
443: // int SQLROWCOUNT = SQL_API_BASE + 20;
444: /**
445: * Indicates that Result encapsulates a request to set the value of an
446: * SQL-connection attribute.
447: */
448: int SQLSETCONNECTATTR = SQL_API_BASE + 1016;
449:
450: //
451: // /** Indicates that Result encapsulates a request to set a cursor name. */
452: // int SQLSETCURSORNAME = SQL_API_BASE + 21;
453: //
454: // /**
455: // * Indicates that Result encapsulates a request to set a field in a CLI
456: // * descriptor area.
457: // */
458: // int SQLSETDESCFIELD = SQL_API_BASE + 1017;
459: //
460: // /**
461: // * Indicates that Result encapsulates a request to set commonly-used
462: // * fields in a CLI descriptor area.
463: // */
464: // int SQLSETDESCREC = SQL_API_BASE + 1018;
465: //
466:
467: /**
468: * Indicates that Result encapsulates a request to set the value of an
469: * SQL-environment attribute.
470: */
471: // int SQLSETENVATTR = SQL_API_BASE + 1019;
472: // /** Indicates that Result encapsulates a request to set the value of an
473: // * SQL-statement attribute.
474: // */
475: // int SQLSETSTMTATTR = SQL_API_BASE + 1020;
476: //
477: // /**
478: // * Indicates that Result encapsulates a request to return a result set that
479: // * contains a list of columns the combined values of which can uniquely
480: // * identify any row within a single specified table described by the
481: // * Information Schemas of the connected data source.
482: // */
483: // int SQLSPECIALCOLUMNS = SQL_API_BASE + 52;
484: //
485: /**
486: * Indicates that Result encapsulates a request to explicitly start an
487: * SQL-transaction and set its characteristics.
488: */
489: int SQLSTARTTRAN = SQL_API_BASE + 74;
490:
491: // /**
492: // * Indicates that Result encapsulates a request to return a result set that
493: // * contains a list of the privileges held on the tables whose names adhere
494: // * to the requested pattern(s) within tables described by the Information
495: // * Schemas of the connected data source.
496: // */
497: // int SQLTABLES = SQL_API_BASE + 54;
498: //
499: // /**
500: // * Indicates that Result encapsulates a request to, based on the specified
501: // * selection criteria, return a result set that contains information about
502: // * tables described by the Information Schema of the connected data source.
503: // */
504: // int SQLTABLEPRIVILEGES = SQL_API_BASE + 70;
505: /*
506: Codes for transaction termination:
507:
508: COMMIT 0
509: ROLLBACK 1
510: SAVEPOINT NAME ROLLBACK 2
511: SAVEPOINT NAME RELEASE 4
512: COMMIT AND CHAIN 6
513: ROLLBACK AND CHAIN 7
514: Implementation-defined termination type <0
515: */
516: int COMMIT = 0;
517: int ROLLBACK = 1;
518: int SAVEPOINT_NAME_ROLLBACK = 2;
519: int SAVEPOINT_NAME_RELEASE = 4;
520: int COMMIT_AND_CHAIN = 6;
521: int ROLLBACK_AND_CHAIN = 7;
522:
523: /* Environment attributes */
524:
525: //#define SQL_ATTR_OUTPUT_NTS 10001
526: /* Connection attributes */
527:
528: //#define SQL_ATTR_AUTO_IPD 10001
529: //#define SQL_ATTR_SAVEPOINT_NAME 10027
530: int SQL_ATTR_SAVEPOINT_NAME = 10027;
531:
532: // Batched execution constants:
533:
534: /** batch item failed */
535: int EXECUTE_FAILED = -3;
536:
537: /**
538: * Batch item succeeded but does not generate an update count,
539: * for example a call having no return value
540: */
541: int SUCCESS_NO_INFO = -2;
542: }
|