aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/sql/SQLOutput.java
blob: c07ca158d3d32dba2e304ebebb440d7ef0657f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/* SQLOutput.java -- Write SQL values to a stream
   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.

This file is part of GNU Classpath.

GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
 
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING.  If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.

Linking this library statically or dynamically with other modules is
making a combined work based on this library.  Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.

As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module.  An independent module is a module which is not derived from
or based on this library.  If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so.  If you do not wish to do so, delete this
exception statement from your version. */


package java.sql;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;

/**
 * This interface provides methods for writing Java types to a SQL stream.
 * It is used for implemented custom type mappings for user defined data
 * types.
 *
 * @author Aaron M. Renn (arenn@urbanophile.com)
 */
public interface SQLOutput 
{
  /**
   * This method writes the specified Java <code>String</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeString(String x) throws SQLException;

  /**
   * This method writes the specified Java <code>boolean</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeBoolean(boolean x) throws SQLException;

  /**
   * This method writes the specified Java <code>byte</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeByte(byte x) throws SQLException;

  /**
   * This method writes the specified Java <code>short</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeShort(short x) throws SQLException;

  /**
   * This method writes the specified Java <code>int</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeInt(int x) throws SQLException;

  /**
   * This method writes the specified Java <code>long</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeLong(long x) throws SQLException;

  /**
   * This method writes the specified Java <code>float</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeFloat(float x) throws SQLException;

  /**
   * This method writes the specified Java <code>double</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeDouble(double x) throws SQLException;

  /**
   * This method writes the specified Java <code>BigDecimal</code>
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeBigDecimal(BigDecimal x) throws SQLException;

  /**
   * This method writes the specified Java <code>byte</code> array
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeBytes(byte[] x) throws SQLException;

  /**
   * This method writes the specified Java <code>java.sql.Date</code> 
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeDate(Date x) throws SQLException;

  /**
   * This method writes the specified Java <code>java.sql.Time</code> 
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeTime(Time x) throws SQLException;

  /**
   * This method writes the specified Java <code>java.sql.Timestamp</code> 
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeTimestamp(Timestamp x) throws SQLException;

  /**
   * This method writes the specified Java character stream
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeCharacterStream(Reader x) throws SQLException;

  /**
   * This method writes the specified ASCII text stream
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeAsciiStream(InputStream x) throws SQLException;

  /**
   * This method writes the specified uninterpreted binary byte stream
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeBinaryStream(InputStream x) throws SQLException;

  /**
   * This method writes the specified Java <code>SQLData</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeObject(SQLData x) throws SQLException;

  /**
   * This method writes the specified Java SQL <code>Ref</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeRef(Ref x) throws SQLException;

  /**
   * This method writes the specified Java SQL <code>Blob</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeBlob(Blob x) throws SQLException;

  /**
   * This method writes the specified Java SQL <code>Clob</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeClob(Clob x) throws SQLException;

  /**
   * This method writes the specified Java SQL <code>Struct</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeStruct(Struct x) throws SQLException;

  /**
   * This method writes the specified Java SQL <code>Array</code> object
   * to the SQL stream.
   *
   * @param value The value to write to the stream.
   * @exception SQLException If an error occurs.
   */
  void writeArray(Array x) throws SQLException;

  /**
   * @since 1.4
   */
  void writeURL(URL x) throws SQLException;
}
span> atoll (nptr: ADDRESS) : LONGINT ; (* double strtod(const char *restrict nptr, char **_Nullable restrict endptr) *) PROCEDURE strtod (nptr, endptr: ADDRESS) : REAL ; (* float strtof(const char *restrict nptr, char **_Nullable restrict endptr) *) PROCEDURE strtof (nptr, endptr: ADDRESS) : SHORTREAL ; (* long double strtold(const char *restrict nptr, char **_Nullable restrict endptr) *) PROCEDURE strtold (nptr, endptr: ADDRESS) : LONGREAL ; (* long strtol(const char *restrict nptr, char **_Nullable restrict endptr, int base) *) PROCEDURE strtol (nptr, endptr: ADDRESS; base: INTEGER) : CSSIZE_T ; (* long long strtoll(const char *restrict nptr, char **_Nullable restrict endptr, int base) *) PROCEDURE strtoll (nptr, endptr: ADDRESS; base: INTEGER) : LONGINT ; (* unsigned long strtoul(const char *restrict nptr, char **_Nullable restrict endptr, int base) *) PROCEDURE strtoul (nptr, endptr: ADDRESS; base: INTEGER) : CSIZE_T ; (* unsigned long long strtoull(const char *restrict nptr, char **_Nullable restrict endptr, int base) *) PROCEDURE strtoull (nptr, endptr: ADDRESS; base: INTEGER) : LONGCARD ; (* ssize_t write (int d, void *buf, size_t nbytes) *) PROCEDURE write (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ; (* ssize_t read (int d, void *buf, size_t nbytes) *) PROCEDURE read (d: INTEGER; buf: ADDRESS; nbytes: CSIZE_T) : [ CSSIZE_T ] ; (* int system(string) char *string; *) PROCEDURE system (a: ADDRESS) : [ INTEGER ] ; (* abort - generate a fault abort() first closes all open files if possible, then sends an IOT signal to the process. This signal usually results in termination with a core dump, which may be used for debugging. It is possible for abort() to return control if is caught or ignored, in which case the value returned is that of the kill(2V) system call. *) PROCEDURE abort <* noreturn *> ; (* malloc - memory allocator. void *malloc(size_t size); malloc() returns a pointer to a block of at least size bytes, which is appropriately aligned. If size is zero, malloc() returns a non-NULL pointer, but this pointer should not be dereferenced. *) PROCEDURE malloc (size: CSIZE_T) : ADDRESS ; (* free - memory deallocator. free (void *ptr); free() releases a previously allocated block. Its argument is a pointer to a block previously allocated by malloc, calloc, realloc, malloc, or memalign. *) PROCEDURE free (ptr: ADDRESS) ; (* void *realloc (void *ptr, size_t size); realloc changes the size of the memory block pointed to by ptr to size bytes. The contents will be unchanged to the minimum of the old and new sizes; newly allocated memory will be uninitialized. If ptr is NIL, the call is equivalent to malloc(size); if size is equal to zero, the call is equivalent to free(ptr). Unless ptr is NIL, it must have been returned by an earlier call to malloc(), realloc. *) PROCEDURE realloc (ptr: ADDRESS; size: CSIZE_T) : ADDRESS ; (* isatty - does this descriptor refer to a terminal. *) PROCEDURE isatty (fd: INTEGER) : INTEGER ; (* exit - returns control to the invoking process. Result, r, is returned. *) PROCEDURE exit (r: INTEGER) <* noreturn *> ; (* getenv - returns the C string for the equivalent C environment variable. *) PROCEDURE getenv (s: ADDRESS) : ADDRESS ; (* putenv - change or add an environment variable. *) PROCEDURE putenv (s: ADDRESS) : INTEGER ; (* getpid - returns the UNIX process identification number. *) PROCEDURE getpid () : INTEGER ; (* dup - duplicates the file descriptor, d. *) PROCEDURE dup (d: INTEGER) : INTEGER ; (* close - closes the file descriptor, d. *) PROCEDURE close (d: INTEGER) : [ INTEGER ] ; (* open - open the file, filename with flag and mode. *) PROCEDURE open (filename: ADDRESS; oflag: INTEGER; mode: INTEGER) : INTEGER ; (* creat - creates a new file *) PROCEDURE creat (filename: ADDRESS; mode: CARDINAL) : INTEGER; (* lseek - calls unix lseek: off_t lseek(int fildes, off_t offset, int whence); *) PROCEDURE lseek (fd: INTEGER; offset: COFF_T; whence: INTEGER) : [ COFF_T ] ; (* perror - writes errno and string. (ARRAY OF CHAR is translated onto ADDRESS). *) PROCEDURE perror (string: ARRAY OF CHAR); (* readv - reads an io vector of bytes. *) PROCEDURE readv (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ; (* writev - writes an io vector of bytes. *) PROCEDURE writev (fd: INTEGER; v: ADDRESS; n: INTEGER) : [ INTEGER ] ; (* getcwd - copies the absolute pathname of the current working directory to the array pointed to by buf, which is of length size. If the current absolute path name would require a buffer longer than size elements, NULL is returned, and errno is set to ERANGE; an application should check for this error, and allocate a larger buffer if necessary. *) PROCEDURE getcwd (buf: ADDRESS; size: CSIZE_T) : ADDRESS ; (* chown - The owner of the file specified by path or by fd is changed. Only the super-user may change the owner of a file. The owner of a file may change the group of the file to any group of which that owner is a member. The super-user may change the group arbitrarily. If the owner or group is specified as -1, then that ID is not changed. On success, zero is returned. On error, -1 is returned, and errno is set appropriately. *) PROCEDURE chown (filename: ADDRESS; uid, gid: INTEGER) : [ INTEGER ] ; (* strlen - returns the length of string, a. *) PROCEDURE strlen (a: ADDRESS) : CSIZE_T ; (* strcpy - copies string, src, into, dest. It returns dest. *) PROCEDURE strcpy (dest, src: ADDRESS) : [ ADDRESS ] ; (* strncpy - copies string, src, into, dest, copying at most, n, bytes. It returns dest. *) PROCEDURE strncpy (dest, src: ADDRESS; n: CARDINAL) : [ ADDRESS ] ; (* unlink - removes file and returns 0 if successful. *) PROCEDURE unlink (file: ADDRESS) : [ INTEGER ] ; (* memcpy - copy memory area SYNOPSIS #include <string.h> void *memcpy(void *dest, const void *src, size_t n); It returns dest. *) PROCEDURE memcpy (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ; (* memset - fill memory with a constant byte SYNOPSIS #include <string.h> void *memset(void *s, int c, size_t n); It returns s. *) PROCEDURE memset (s: ADDRESS; c: INTEGER; size: CSIZE_T) : [ ADDRESS ] ; (* memmove - copy memory areas which may overlap SYNOPSIS #include <string.h> void *memmove(void *dest, const void *src, size_t n); It returns dest. *) PROCEDURE memmove (dest, src: ADDRESS; size: CSIZE_T) : [ ADDRESS ] ; (* int printf(const char *format, ...); *) PROCEDURE printf (format: ARRAY OF CHAR; ...) : [ INTEGER ] ; (* int snprintf(char *str, size_t size, const char *format, ...); *) PROCEDURE snprintf (dest: ADDRESS; size: CSIZE_T; format: ARRAY OF CHAR; ...) : [ INTEGER ] ; (* setenv - sets environment variable, name, to value. It will overwrite an existing value if, overwrite, is true. It returns 0 on success and -1 for an error. *) PROCEDURE setenv (name: ADDRESS; value: ADDRESS; overwrite: INTEGER) : [ INTEGER ] ; (* srand - initialize the random number seed. *) PROCEDURE srand (seed: INTEGER) ; (* rand - return a random integer. *) PROCEDURE rand () : INTEGER ; (* time - returns a pointer to the time_t value. If, a, is not NIL then the libc value is copied into memory at address, a. *) PROCEDURE time (a: ADDRESS) : time_t ; (* localtime - returns a pointer to the libc copy of the tm structure. *) PROCEDURE localtime (VAR t: time_t) : ADDRESS ; (* ftime - return date and time. *) PROCEDURE ftime (VAR t: timeb) : [ INTEGER ] ; (* shutdown - shutdown a socket, s. if how = 0, then no more reads are allowed. if how = 1, then no more writes are allowed. if how = 2, then mo more reads or writes are allowed. *) PROCEDURE shutdown (s: INTEGER; how: INTEGER) : [ INTEGER ] ; (* rename - change the name or location of a file *) PROCEDURE rename (oldpath, newpath: ADDRESS) : [ INTEGER ] ; (* setjmp - returns 0 if returning directly, and non-zero when returning from longjmp using the saved context. *) PROCEDURE setjmp (env: ADDRESS) : INTEGER ; (* longjmp - restores the environment saved by the last call of setjmp with the corresponding env argument. After longjmp is completed, program execution continues as if the corresponding call of setjmp had just returned the value val. The value of val must not be zero. *) PROCEDURE longjmp (env: ADDRESS; val: INTEGER) ; (* atexit - execute, proc, when the function exit is called. *) PROCEDURE atexit (proc: exitP) : [ INTEGER ] ; (* ttyname - returns a pointer to a string determining the ttyname. *) PROCEDURE ttyname (filedes: INTEGER) : ADDRESS ; (* sleep - calling thread sleeps for seconds. *) PROCEDURE sleep (seconds: CARDINAL) : [ CARDINAL ] ; (* execv - execute a file. *) PROCEDURE execv (pathname: ADDRESS; argv: ADDRESS) : [ INTEGER ] ; END libc.