Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

public abstract class SqlPlatform

  1. Object
  2. SqlPlatform

Known subtypesBackendSqlPlatform

What the wire clients need from the target they run on: a socket, random bytes, and the exceptions a caller catches.

The backend and an application each install one before the first connection; the wire clients never name either side’s classes, which is what lets one copy of them serve both.

Constructors

public SqlPlatform()

Methods

public static void install(SqlPlatform platform)Makes platform the one every connection opened from now on uses.
public static SqlPlatform get()The installed platform.
public abstract SqlSocket connect(String host, int port, int timeoutMillis) throws IOExceptionOpens a plain TCP connection.
public abstract byte[] randomBytes(int length) throws IOExceptionlength bytes from a cryptographically secure source.
public IOException concurrencyFailure(String message)The exception for a transaction that can be run again.
public IOException integrityViolation(String message)The exception for a write a constraint refused.
public IOException withMessage(IOException failure, String message)failure again with message, keeping what kind of failure it is.
public byte[] pbkdf2(String digest, byte[] password, byte[] salt, int iterations, int length) throws IOExceptionPBKDF2 over HMAC with digest, Hash.SHA256 or Hash.SHA512.

Inherited methods

Constructor details

SqlPlatform

public SqlPlatform()

Method details

install

public static void install(SqlPlatform platform)
Makes platform the one every connection opened from now on uses.

get

public static SqlPlatform get()
The installed platform.

Throws

IllegalStateException
when none is installed, which is a defect in the target, not something a caller recovers from

connect

public abstract SqlSocket connect(String host, int port, int timeoutMillis) throws IOException
Opens a plain TCP connection.

randomBytes

public abstract byte[] randomBytes(int length) throws IOException
length bytes from a cryptographically secure source.

concurrencyFailure

public IOException concurrencyFailure(String message)
The exception for a transaction that can be run again.

integrityViolation

public IOException integrityViolation(String message)
The exception for a write a constraint refused.

withMessage

public IOException withMessage(IOException failure, String message)
failure again with message, keeping what kind of failure it is.

pbkdf2

public byte[] pbkdf2(String digest, byte[] password, byte[] salt, int iterations, int length) throws IOException
PBKDF2 over HMAC with digest, Hash.SHA256 or Hash.SHA512.