Class ServerSession
java.lang.Object
com.codename1.db.sql.ServerSession
An open session with a database server: Postgres, MySql, SqlServer or
Oracle.
This is a base class, not a driver interface. Nothing looks an engine up by
name: code that wants one names its class -- Postgres.connect(...), or its
CONNECTOR field -- and an engine nothing names is stripped from the
application.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOpens sessions for one engine. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidbegin()Begins a read-write transaction at the server's default isolation.abstract voidbegin(boolean readOnly, TransactionIsolation isolation) Begins a transaction.abstract voidBegins a read-only transaction at the server's default isolation.abstract voidclose()Closes the session; closing twice does nothing.abstract voidcommit()Commits the transaction.abstract Dialectdialect()The SQL this session's server speaks.abstract intRuns a statement that returns no rows.abstract booleanisClosed()True once the session is closed or its connection was lost.abstract longThe key the last INSERT generated, for an engine that reports one that way; 0 otherwise.abstract booleanTrue when beginning, committing and rolling back are protocol requests or session state of this client's own, rather than statements a caller could equally run.abstract ListRuns a query: a list ofMaprows keyed by column label, in column order.abstract voidrollback()Rolls the transaction back.abstract voidRuns a savepoint statement:verbis the dialect's word for set, roll back to or release, andnamethe savepoint.
-
Constructor Details
-
ServerSession
public ServerSession()
-
-
Method Details
-
dialect
The SQL this session's server speaks. -
execute
Runs a statement that returns no rows.
Returns
the number of rows it changed
- Throws:
IOException
-
query
Runs a query: a list ofMaprows keyed by column label, in column order.- Throws:
IOException
-
ownsTransactionControl
public abstract boolean ownsTransactionControl()True when beginning, committing and rolling back are protocol requests or session state of this client's own, rather than statements a caller could equally run. -
begin
Begins a read-write transaction at the server's default isolation.- Throws:
IOException
-
beginReadOnly
Begins a read-only transaction at the server's default isolation.- Throws:
IOException
-
begin
Begins a transaction.- Throws:
IOException
-
commit
-
rollback
-
savepoint
Runs a savepoint statement:verbis the dialect's word for set, roll back to or release, andnamethe savepoint.- Throws:
IOException
-
lastInsertId
public abstract long lastInsertId()The key the last INSERT generated, for an engine that reports one that way; 0 otherwise. -
close
public abstract void close()Closes the session; closing twice does nothing. -
isClosed
public abstract boolean isClosed()True once the session is closed or its connection was lost.
-