1 /* Copyright (c) 2001-2016, The HSQL Development Group 2 * All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the HSQL Development Group nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 32 package org.hsqldb; 33 34 import java.io.InputStream; 35 import java.text.SimpleDateFormat; 36 import java.util.Calendar; 37 38 import org.hsqldb.jdbc.JDBCConnection; 39 import org.hsqldb.navigator.RowSetNavigatorClient; 40 import org.hsqldb.persist.HsqlProperties; 41 import org.hsqldb.result.Result; 42 import org.hsqldb.result.ResultLob; 43 import org.hsqldb.types.BlobDataID; 44 import org.hsqldb.types.ClobDataID; 45 import org.hsqldb.types.TimestampData; 46 47 /** 48 * Interface to Session and its remote proxy objects. Used by the 49 * implementations of JDBC interfaces to communicate with the database at 50 * the session level. 51 * 52 * @author Fred Toussi (fredt@users dot sourceforge.net) 53 * @version 2.2.9 54 * @since 1.7.2 55 */ 56 public interface SessionInterface { 57 58 int INFO_ID = 0; // used 59 int INFO_INTEGER = 1; // used 60 int INFO_BOOLEAN = 2; // used 61 int INFO_VARCHAR = 3; // used 62 int INFO_LIMIT = 4; 63 64 // 65 int INFO_ISOLATION = 0; // used 66 int INFO_AUTOCOMMIT = 1; // used 67 int INFO_CONNECTION_READONLY = 2; // used 68 int INFO_CATALOG = 3; // used 69 70 // 71 int TX_READ_UNCOMMITTED = 1; 72 int TX_READ_COMMITTED = 2; 73 int TX_REPEATABLE_READ = 4; 74 int TX_SERIALIZABLE = 8; 75 76 // 77 int lobStreamBlockSize = 512 * 1024; 78 execute(Result r)79 Result execute(Result r); 80 getRows(long navigatorId, int offset, int size)81 RowSetNavigatorClient getRows(long navigatorId, int offset, int size); 82 closeNavigator(long id)83 void closeNavigator(long id); 84 close()85 void close(); 86 isClosed()87 boolean isClosed(); 88 isReadOnlyDefault()89 boolean isReadOnlyDefault(); 90 setReadOnlyDefault(boolean readonly)91 void setReadOnlyDefault(boolean readonly); 92 isAutoCommit()93 boolean isAutoCommit(); 94 setAutoCommit(boolean autoCommit)95 void setAutoCommit(boolean autoCommit); 96 getIsolation()97 int getIsolation(); 98 setIsolationDefault(int level)99 void setIsolationDefault(int level); 100 startPhasedTransaction()101 void startPhasedTransaction(); 102 prepareCommit()103 void prepareCommit(); 104 commit(boolean chain)105 void commit(boolean chain); 106 rollback(boolean chain)107 void rollback(boolean chain); 108 rollbackToSavepoint(String name)109 void rollbackToSavepoint(String name); 110 savepoint(String name)111 void savepoint(String name); 112 releaseSavepoint(String name)113 void releaseSavepoint(String name); 114 addWarning(HsqlException warning)115 void addWarning(HsqlException warning); 116 cancel(Result r)117 Result cancel(Result r); 118 getAttribute(int id)119 Object getAttribute(int id); 120 setAttribute(int id, Object value)121 void setAttribute(int id, Object value); 122 getId()123 long getId(); 124 resetSession()125 void resetSession(); 126 getInternalConnectionURL()127 String getInternalConnectionURL(); 128 createBlob(long length)129 BlobDataID createBlob(long length); 130 createClob(long length)131 ClobDataID createClob(long length); 132 allocateResultLob(ResultLob result, InputStream dataInput)133 void allocateResultLob(ResultLob result, InputStream dataInput); 134 getScanner()135 Scanner getScanner(); 136 getCalendar()137 Calendar getCalendar(); 138 getCalendarGMT()139 Calendar getCalendarGMT(); 140 getSimpleDateFormatGMT()141 SimpleDateFormat getSimpleDateFormatGMT(); 142 getCurrentDate()143 TimestampData getCurrentDate(); 144 getZoneSeconds()145 int getZoneSeconds(); 146 getStreamBlockSize()147 int getStreamBlockSize(); 148 getClientProperties()149 HsqlProperties getClientProperties(); 150 getJDBCConnection()151 JDBCConnection getJDBCConnection(); 152 setJDBCConnection(JDBCConnection connection)153 void setJDBCConnection(JDBCConnection connection); 154 getDatabaseUniqueName()155 String getDatabaseUniqueName(); 156 } 157