ADO.NET data provider API reference
This file lists the public API of CoraDB.Data (namespace CoraDB.Data.CoraDBClient). It covers every class, its
methods and properties, their parameters and what they do. Members inherited unchanged from the ADO.NET base classes
(DbConnection, DbCommand, ...) work as documented by .NET and are listed only when CoraDB adds behavior.
Conventions:
- node-coradb:
namemarks the .NET equivalent of a node-coradb API. - LOB and collection positions are 1-based unless a member says otherwise.
- Errors are reported as
CoraDBException(see CoraDBException) unless a member says otherwise.
CoraDBConnection
Section titled “CoraDBConnection”public sealed class CoraDBConnection : DbConnection, ICloneable
A connection to a CoraDB broker. The driver implements the CAS protocol directly; no native client library is used. Each request/response exchange is serialized internally, so concurrent calls on one connection do not corrupt the protocol stream. A connection is still not a unit of concurrency: commands share its session and its transaction (a commit from one thread ends the other thread's work too), and requests run one at a time. Use one connection per thread.
Lost connections. When the socket breaks outside a transaction, the next request re-opens the physical
connection (same session when the server allows it) and re-applies the current isolation level and lock timeout.
The failed request is repeated only when it cannot have changed data (prepare, schema and parameter reads, LOB reads,
...). A request that may already have run on the server (INSERT, UPDATE, COMMIT, ...) is never repeated: it
fails with ER_COMMUNICATION ("... was not repeated because it may already have been executed"), and the
connection stays usable. Inside a transaction, a lost connection sets the state to Broken; Close() and Open()
start over.
Async methods. The *Async methods inherited from ADO.NET run synchronously on the calling thread (the
protocol is implemented with blocking sockets). Use Task.Run to move work off a UI thread.
Constructors
Section titled “Constructors”| Constructor | Description |
|---|---|
CoraDBConnection() |
Creates a closed connection; set ConnectionString before Open(). |
CoraDBConnection(string connString) |
Creates a closed connection with the given connection string. The string is validated here, and an invalid one throws CoraDBException. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
ConnectionString |
string |
Gets or sets the connection string; see CoraDBConnectionStringBuilder. It is validated when set and can't be changed while the connection is open. After Open() the password is removed from the returned value unless persistSecurityInfo=true (the connection keeps it internally to re-open and Clone()). |
ConnectionTimeout |
int |
The connect timeout, in seconds (connectionTimeout / loginTimeout). |
Database |
string |
The database name. |
DataSource |
string |
The broker in use (host:port), or the configured server when the connection is closed. |
State |
ConnectionState |
Closed, Connecting, Open, or Broken (the connection was lost inside a transaction). |
ServerVersion |
string |
The engine version, e.g. 1.0.0.1586 (cached after the first call). |
DbVersion |
string |
Same as ServerVersion. |
ActiveHost |
string |
The broker currently used (host:port). Useful with several hosts / althosts. node-coradb: getActiveHost. |
ProtocolVersion |
int |
The negotiated CAS protocol version. |
CasProcessId |
int |
The process id of the CAS serving the connection. |
SessionId |
int |
The server session id. |
AutoCommit |
bool |
The current auto-commit mode (read-only; use SetAutoCommit). |
IsolationLevel |
CoraDBIsolationLevel |
Gets or sets the session isolation level. |
LockTimeout |
int |
Gets or sets the lock timeout, in ms (-1 = infinite). |
MaxStringLength |
int |
The broker MAX_STRING_LENGTH parameter. |
EnforceOldQueryProtocol |
bool |
When true, parameterless commands use PREPARE + EXECUTE instead of the single PREPARE_AND_EXECUTE request. node-coradb: setEnforceOldQueryProtocol. |
DefaultCommandTimeout |
int |
The default command timeout from queryTimeout, in seconds. |
InTransaction |
bool |
true while a transaction started with BeginTransaction is pending. |
SchemaProvider |
CoraDBSchemaProvider |
The provider behind GetSchema. |
Logger |
ICoraDBLogger |
The logger of this connection (defaults to DefaultLogger, or to a trace logger when logTraceApi / logTraceNetwork is set). |
static DefaultLogger |
ICoraDBLogger |
The logger used by connections that do not set Logger (default: CoraDBNoopLogger). |
Events
Section titled “Events”| Event | Description |
|---|---|
StateChange |
Inherited from DbConnection. Raised for Connecting, Open and Closed. |
Opening and closing
Section titled “Opening and closing”| Method | Parameters | Description |
|---|---|---|
void Open() |
— | Connects to the first reachable host. Hosts are tried in order: server list, then althosts, shuffled when loadbalance=true, for 1 + maxConnectionRetryCount rounds. The method then applies isolationLevel / lockTimeout. It throws CoraDBException (IsCommunicationError = true when no broker answered). |
void Close() |
— | Closes the connection. A pending transaction is rolled back by the server. |
void Dispose() |
— | Same as Close(). |
CoraDBConnection Clone() |
— | Returns a new, closed connection with the same connection string (password included), connection timeout, encoding, lock timeout and logger. |
void SetConnectionTimeout(int value) |
value: seconds |
Sets the timeout used by the next Open(). node-coradb: setConnectionTimeout. |
void ChangeDatabase(string databaseName) |
— | Not supported (throws NotSupportedException); open a new connection instead. |
bool Ping() |
— | Sends CHECK_CAS. Returns false instead of throwing when the CAS does not answer. |
bool IsValid() |
— | Same as Ping(). node-coradb: isValid. |
int GetCasStatus(int timeoutMilliseconds = 5000) |
timeoutMilliseconds: request timeout |
Asks the broker for the status of this connection's CAS: -2 unknown, -1 idle, 0 connecting, 1 busy, 2 done. |
void Cancel() |
— | Cancels the query running on this connection, through an out-of-band request to the broker. |
void EndSession() |
— | Ends the server session; this drops session variables and server-side prepared statements. |
Commands and helpers
Section titled “Commands and helpers”| Method | Parameters | Description |
|---|---|---|
CoraDBCommand CreateCommand() |
— | Creates a command bound to this connection (and to its pending transaction). |
int Execute(string sql, params object[] parameters) |
sql: statement with ? markers; parameters: positional values |
Executes a statement and returns the affected rows. node-coradb: execute. |
int ExecuteWithTypedParams(string sql, object[] parameters, CoraDBDataType[] dataTypes) |
dataTypes: one type per value |
Executes a statement and binds each value with an explicit type. node-coradb: executeWithTypedParams. |
CoraDBDataReader Query(string sql, params object[] parameters) |
As above | Runs a query and returns a reader, which fetches rows page by page. Dispose the reader to close the query. node-coradb: query / fetch / closeQuery. |
List<object[]> QueryAll(string sql, params object[] parameters) |
As above | Returns every row as an array of values. node-coradb: queryAll. |
List<Dictionary<string, object>> QueryAllAsObjects(string sql, params object[] parameters) |
As above | Returns every row as a column-name → value dictionary, with case-insensitive keys. node-coradb: queryAllAsObjects / queryAsObjects. |
DataTable QueryToDataTable(string sql, params object[] parameters) |
As above | Loads the result into a DataTable. |
CoraDBBatchResult BatchExecute(string[] batchSqlStmt) |
batchSqlStmt: statements without parameters |
Executes several statements in one request (CAS EXECUTE_BATCH). Returns the result of each statement; a failing statement does not throw. |
int BatchExecuteNoQuery(string[] sqls) |
sqls: statements |
Like BatchExecute, but throws CoraDBException for the first failed statement. Returns the number of statements. node-coradb: batchExecuteNoQuery. |
string GetQueryPlanOnly(string sql) |
sql: statement |
Returns the query plan without executing the statement. |
object GetLastInsertId() |
— | Returns LAST_INSERT_ID() of the session. |
int GetRowCount() |
— | Returns ROW_COUNT() of the last statement. |
string GetEngineVersion() / string GetDatabaseProductVersion() |
— | Return the engine version. node-coradb: getEngineVersion. |
string CurrentDatabase() |
— | Returns the current database name. |
Transactions and session settings
Section titled “Transactions and session settings”| Method | Parameters | Description |
|---|---|---|
CoraDBTransaction BeginTransaction() |
— | Starts a transaction: auto-commit is off until commit or rollback, then the previous mode is restored. Nested transactions throw InvalidOperationException. node-coradb: beginTransaction. |
CoraDBTransaction BeginTransaction(IsolationLevel level) |
ReadCommitted, RepeatableRead, Serializable or Unspecified |
Starts a transaction with an ADO.NET isolation level. Other levels throw CoraDBException. |
CoraDBTransaction BeginTransaction(CoraDBIsolationLevel level) |
CoraDB level | Starts a transaction with a CoraDB isolation level. |
void Commit() |
— | Commits the current work: the pending transaction or the auto-commit-off session. node-coradb: commit. |
void Rollback() |
— | Rolls back the current work. node-coradb: rollback. |
void EndTransaction(bool commit) |
commit: true = commit |
Commits or rolls back. node-coradb: endTransaction. |
void SetSavepoint(string name) |
name: savepoint name |
Creates a savepoint. |
void RollbackToSavepoint(string name) |
name |
Rolls back to a savepoint; the transaction stays open. |
void SetAutoCommit(bool value) / bool GetAutoCommit() |
value |
Sets or returns the auto-commit mode. Turning auto-commit on commits pending work. node-coradb: setAutoCommitMode. |
void SetIsolationLevel(CoraDBIsolationLevel level) / CoraDBIsolationLevel GetIsolationLevel() |
level |
Sets or reads the session isolation level. |
void SetLockTimeout(int value) / int GetLockTimeout() |
value: ms (-1 infinite) |
Sets or reads the lock timeout. |
int GetMaxStringLength() |
— | Returns the broker MAX_STRING_LENGTH. SetMaxStringLength throws: the value is a broker setting. |
int GetDatabaseParameter(CoraDBDatabaseParameter parameter) |
ISOLATION_LEVEL, LOCK_TIMEOUT, MAX_STRING_LENGTH, AUTO_COMMIT, NO_BACKSLASH_ESCAPES |
Reads a database parameter. node-coradb: getDatabaseParameter. |
void SetDatabaseParameter(CoraDBDatabaseParameter parameter, int value) |
parameter, value |
Sets a database parameter (isolation level, lock timeout or auto-commit). node-coradb: setDatabaseParameter. |
void SetEncoding(string name) / Encoding GetEncoding() |
name: e.g. utf-8 |
Sets the character set (only while the connection is closed) or returns it. |
Metadata
Section titled “Metadata”| Method | Parameters | Description |
|---|---|---|
DataTable GetSchema() |
— | Returns the MetaDataCollections list. |
DataTable GetSchema(string collectionName) |
Collection name | Returns a schema collection; see CoraDBSchemaProvider. |
DataTable GetSchema(string collectionName, string[] filters) |
filters: restrictions (SQL LIKE patterns) |
Returns a filtered collection. An unknown collection throws ArgumentException. |
DataTable GetSchemaInfo(CoraDBSchemaType schemaType, string arg1 = null, string arg2 = null, CoraDBSchemaPatternMatch patternMatch = ClassNamePattern | AttributeNamePattern) |
arg1: class (table) name or pattern; arg2: attribute / column name or pattern |
Returns the raw CAS schema information: classes, views, attributes, constraints, primary / imported / exported keys, privileges, ... The columns keep the server's names. node-coradb: getSchema. |
| Method | Parameters | Description |
|---|---|---|
CoraDBBlob CreateBlob() / CoraDBClob CreateClob() |
— | Create a new, empty LOB on the server. Bind it as a parameter to store it. |
byte[] LOBNew(CoraDBDataType lobType) |
CCI_U_TYPE_BLOB or CCI_U_TYPE_CLOB |
Creates a LOB and returns its packed handle. Other types throw ArgumentException. node-coradb: lobNew. |
long LOBWrite(object lob, ulong offset, byte[] buf, int start, int len) |
lob: CoraDBBlob/CoraDBClob; offset: 1-based byte position; buf/start/len: source |
Writes bytes and returns how many were written. node-coradb: lobWrite. |
int LOBRead(object lob, long offset, byte[] buf, int start, int len) |
offset: 1-based byte position; buf/start/len: destination |
Reads bytes and returns how many were read. node-coradb: lobRead. |
OID and collection functions
Section titled “OID and collection functions”These functions need OIDs, and OIDs are only available for tables created with DONT_REUSE_OID. CoraDB tables are
REUSE_OID by default.
| Method | Parameters | Description |
|---|---|---|
string GetTableNameFromOID(CoraDBOid oid) / (string oidStr) |
OID or @page|slot|volume |
Returns the table of the object. |
bool IsInstance(CoraDBOid oid) |
oid |
true when the object exists. |
void DropByOid(CoraDBOid oid) |
oid |
Deletes the object. |
void LockByOid(CoraDBOid oid, bool write) |
write: false = read lock |
Locks the object. |
void AddElementToSet(CoraDBOid oid, string attributeName, object value) |
Attribute, Element | Adds an element to a SET / MULTISET attribute. |
void DropElementInSet(CoraDBOid oid, string attributeName, object value) |
Attribute, Element | Removes an element from a SET / MULTISET attribute. |
void InsertElementInSequence(CoraDBOid oid, string attributeName, int index, object value) |
index: 1-based |
Inserts an element before index in a LIST / SEQUENCE. |
void UpdateElementInSequence(CoraDBOid oid, string attributeName, int index, object value) |
index: 1-based |
Replaces the element at index. |
void DropElementInSequence(CoraDBOid oid, string attributeName, int index) |
index: 1-based |
Removes the element at index. |
int GetCollectionSize(CoraDBOid oid, string attributeName) |
Attribute | Returns the number of elements of a collection attribute. |
CoraDBConnectionStringBuilder
Section titled “CoraDBConnectionStringBuilder”public sealed class CoraDBConnectionStringBuilder : DbConnectionStringBuilder
Parses, validates and builds connection strings. It accepts key=value; pairs, or the URL form
cci:coradb:host:port:db:user:password:?key=value&key=value (cci:cubrid: is accepted too). Keywords are
case-insensitive. Synonyms are mapped to the canonical keyword, and unknown keywords throw ArgumentException.
| Member | Description |
|---|---|
CoraDBConnectionStringBuilder() |
Creates an empty builder. |
CoraDBConnectionStringBuilder(string connString) |
Parses a connection string (key/value or URL form). |
CoraDBConnectionStringBuilder(string server, int port, string database, string user, string password, string encoding, bool autoCommit) |
Builds a connection string from its main parts. |
CoraDBConnectionStringBuilder(string server, string port, string database, string user, string password, string charset, bool autoCommit) |
Same, with the port as a string. |
CoraDBConnectionStringBuilder(string server, string database, string user, string password, string encoding, bool autoCommit) |
Same, with the default port (33000). |
const int DefaultPort = 33000 |
The default broker port. |
static IReadOnlyCollection<string> Keywords |
The canonical keywords. |
string ConnectionString |
Gets or sets the whole string. The URL form is converted to key/value pairs. |
object this[string keyword] |
Gets or sets a value by keyword or synonym. null removes the key. |
string Server, Port, Database, User, Password, Encoding, AutoCommit, AltHosts |
Typed access to the main keywords. |
int ConnectionTimeout, MaxConnectionRetryCount, QueryTimeout |
Typed integer keywords (seconds, count, seconds). |
string GetConnectionString() |
Same as ConnectionString. |
bool ContainsKey(string keyword), bool Remove(string keyword), bool TryGetValue(string keyword, out object value) |
Accept synonyms too. |
The keywords are listed in README.md › connection string.
CoraDBCommand
Section titled “CoraDBCommand”public sealed class CoraDBCommand : DbCommand, ICloneable
A SQL statement, stored procedure call or table read.
Constructors
Section titled “Constructors”| Constructor | Description |
|---|---|
CoraDBCommand() |
Creates an empty command. |
CoraDBCommand(string sql) |
Creates a command with a text. |
CoraDBCommand(string sql, CoraDBConnection conn) |
Creates a command with a text and a connection. |
CoraDBCommand(string sql, CoraDBConnection conn, CoraDBTransaction transaction) |
Creates a command with a text, a connection and a transaction. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
CommandText |
string |
The SQL text, procedure name or table name. Changing it drops the prepared statement. |
CommandType |
CommandType |
Text (default). StoredProcedure builds [? =] CALL name(?, ...) from the parameters; the name must be a (dotted, optionally quoted) identifier, otherwise ArgumentException. TableDirect runs SELECT * FROM the table, with the name quoted in back quotes (an already quoted name must be a complete identifier). |
CommandTimeout |
int |
Query timeout in seconds, enforced by the server (0 = none). The default comes from queryTimeout, or is 30. Negative values throw ArgumentOutOfRangeException. node-coradb: setQueryTimeout. |
Connection |
CoraDBConnection |
The connection. |
Transaction |
CoraDBTransaction |
The transaction. A transaction that is no longer open is replaced by the connection's current one. |
Parameters |
CoraDBParameterCollection |
The parameters. |
FetchSize |
int |
Rows per FETCH round trip (default 100). |
MaxRows |
int |
Maximum rows returned by a query (0 = all). |
RetrieveGeneratedKeys |
bool |
When true, the keys generated by an INSERT are read right after it executes (and, in auto-commit mode, the INSERT is then committed); GetGeneratedKeys() returns them. |
IsGeneratedKeys |
bool |
Same as RetrieveGeneratedKeys (read-only; kept for CUBRID compatibility). |
IncludeOid |
bool |
When true, query rows carry their OID (CoraDBDataReader.GetOid()). This needs a DONT_REUSE_OID table. |
IsPrepared |
bool |
true after Prepare(), until the text changes. |
StatementType |
CoraDBStatementType |
The statement type of the last execution. |
ColumnInfos |
ColumnMetaData[] |
Column metadata of the last executed statement. |
UpdatedRowSource, DesignTimeVisible |
Standard ADO.NET properties. | |
const int DefaultCommandTimeoutSeconds = 30 |
The default timeout. |
Methods
Section titled “Methods”| Method | Parameters | Description |
|---|---|---|
void Prepare() |
— | Prepares the statement on the server. The following executions reuse it, re-preparing automatically when the server dropped it. The parameters are bound again at every execution, so they may be added, removed or reordered after Prepare(). |
int ExecuteNonQuery() |
— | Executes the command and returns the affected rows (-1 for queries). Output parameters of CALL statements are filled in. |
object ExecuteScalar() |
— | Returns the first column of the first row: null when there is no row, DBNull.Value for SQL NULL. |
CoraDBDataReader ExecuteReader() |
— | Executes the command and returns a reader. A previous open reader of this command is closed first. |
CoraDBDataReader ExecuteReader(CommandBehavior behavior) |
behavior: SingleRow, SingleResult, SchemaOnly, CloseConnection, ... |
Same, with a behavior. SchemaOnly only prepares the statement (it is not executed): the reader has the column metadata and no rows. SingleResult ignores the results after the first. |
Task<...> ExecuteNonQueryAsync / ExecuteScalarAsync / ExecuteReaderAsync |
CancellationToken |
Inherited ADO.NET async wrappers: they run synchronously and return a completed task. |
CoraDBBatchResult ExecuteArray(IEnumerable<object[]> rows) |
rows: one value array per execution, bound positionally |
Executes the statement once per row, all in one request (CAS EXECUTE_ARRAY). The type of value i comes from the explicitly typed parameter of marker i (its named parameter, or Parameters[i] for a bare ?). A row with the wrong number of values throws ER_NOT_BIND. |
DbDataReader GetGeneratedKeys() |
— | Returns the keys generated by the last INSERT run with RetrieveGeneratedKeys = true (from the copy read after the INSERT; it can be called several times). Throws InvalidOperationException when there is none. |
string GetQueryPlan() |
— | Returns the plan of the command text without executing it. |
void Cancel() |
— | Cancels the running query (out-of-band request). Does nothing when the connection is not open. node-coradb: cancel. |
CoraDBParameter CreateParameter() |
— | Creates a parameter. |
CoraDBCommand Clone() |
— | Copies the command with cloned parameters. |
void Close() |
— | Frees the server statement (kept for compatibility; Dispose() does the same). |
Parameter markers. Use ? (positional) or ?name / @name (named). A name can be used several times. Markers
inside string literals, quoted identifiers, [brackets] and comments (--, //, /* */) are not parameters. Bare ?
markers take the positional parameters (those added with AddPositional or named ?), in order.
LOB parameters. If a parameter's type is BLOB / CLOB and its value is a byte[], string or Stream, the
driver creates the LOB on the server and uploads the content before executing.
CoraDBParameter
Section titled “CoraDBParameter”public sealed class CoraDBParameter : DbParameter, ICloneable
Constructors
Section titled “Constructors”| Constructor | Description |
|---|---|
CoraDBParameter() |
Creates an empty parameter (type inferred from the value). |
CoraDBParameter(object value) |
Creates a positional parameter with a value. |
CoraDBParameter(CoraDBDataType coradbDataType) |
Creates a parameter with an explicit CoraDB type. |
CoraDBParameter(string parameterName, object value) |
Creates a named parameter (?name, @name or ?). |
CoraDBParameter(string parameterName, DbType dbType) |
Creates a named parameter with an ADO.NET type. |
CoraDBParameter(string parameterName, CoraDBDataType coradbDataType) |
Creates a named parameter with a CoraDB type. |
CoraDBParameter(string parameterName, CoraDBDataType coradbDataType, int size) |
Same, plus a size. |
CoraDBParameter(string parameterName, CoraDBDataType coradbDataType, int size, string sourceColumn) |
Same, plus the source column (for data adapters). |
CoraDBParameter(string parameterName, DbType type, ParameterDirection dir, string col, DataRowVersion ver, object val) |
Fully specified (ADO.NET type). |
CoraDBParameter(string parameterName, CoraDBDataType coradbDataType, ParameterDirection dir, string col, DataRowVersion ver, object val) |
Fully specified (CoraDB type). |
CoraDBParameter(string parameterName, CoraDBDataType coradbDataType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) |
Fully specified. |
Properties and methods
Section titled “Properties and methods”| Member | Description |
|---|---|
string ParameterName |
?name, @name, or ? for a positional parameter. |
object Value |
The value. null and DBNull.Value send NULL. |
CoraDBDataType CoraDBDataType |
The CoraDB type used on the wire. Until it is set, the type is inferred from the value. |
CoraDBDataType InnerCoraDBDataType |
The element type of a SET / MULTISET / SEQUENCE value (otherwise inferred from the elements). |
DbType DbType |
The ADO.NET type, mapped to a CoraDB type (see Type mapping). DbType.Object means "infer". |
ParameterDirection Direction |
Input, Output, InputOutput or ReturnValue (for CALL statements). |
bool IsTypeInferred |
true while the type is inferred from the value. |
int Size, byte Precision, byte Scale, bool IsNullable, string SourceColumn, bool SourceColumnNullMapping, DataRowVersion SourceVersion |
Standard ADO.NET properties. |
int Pos |
The position of the parameter in the command text (-1 when unknown). |
void ResetDbType() |
Goes back to inferring the type from the value. |
CoraDBParameter Clone() |
Copies the parameter. |
static CoraDBDataType FromDbType(DbType type) |
Maps an ADO.NET type to a CoraDB type. |
static DbType ToDbType(CoraDBDataType type) |
Maps a CoraDB type to an ADO.NET type. |
GetParameterEncoding() / SetParameterEncoding(Encoding) |
Kept for compatibility. Strings always use the connection character set. |
CoraDBParameterCollection
Section titled “CoraDBParameterCollection”public sealed class CoraDBParameterCollection : DbParameterCollection, IList<CoraDBParameter>
Names are identifiers, optionally prefixed with ? or @ (bare names such as Dapper's are accepted); a name of
exactly ? makes the parameter positional. Two parameters can't have the same name. Lookups by name ignore the
prefix, so "id" finds "?id", with one exception: an @name token can be a session variable, so it only matches an
@name or bare name parameter, never ?name.
| Member | Description |
|---|---|
CoraDBParameter AddWithValue(string parameterName, object value) |
Adds a named parameter; the type is inferred from the value. |
CoraDBParameter AddPositional(object value) |
Adds a positional parameter, bound to the next bare ?. A CoraDBParameter value is added as is. |
CoraDBParameter Add(CoraDBParameter parameter) |
Adds a parameter. A duplicate name throws ArgumentException. |
int Add(object value) |
Adds a CoraDBParameter and returns its index. |
CoraDBParameter Add(string parameterName, CoraDBDataType dataType) / Add(string parameterName, CoraDBDataType dataType, int size) |
Add a typed parameter. |
void Add() |
Adds an empty positional parameter. |
this[int index], this[string name] |
Get or set by index or by name. |
int IndexOf(string parameterName) / bool Contains(string parameterName) |
Search by name (the prefix is optional). |
Insert, Remove, RemoveAt, Clear, AddRange, CopyTo, Count, GetEnumerator |
Standard collection members. |
string sql |
The command text the parameters belong to (kept for compatibility). |
CoraDBDataReader
Section titled “CoraDBDataReader”public sealed class CoraDBDataReader : DbDataReader
Reads query results forward-only. Rows come from the server in pages of CoraDBCommand.FetchSize rows. Dispose the
reader to free the server cursor; this is node-coradb closeQuery.
Properties
Section titled “Properties”| Property | Description |
|---|---|
FieldCount, VisibleFieldCount |
Number of columns. |
HasRows |
true when the current result has rows. |
RowCount |
Total rows of the current result, as reported by the server (limited by MaxRows). |
RecordsAffected |
Rows affected by the non-query statements of the command (-1 when there were none). |
IsClosed, Depth |
Standard. |
this[int ordinal], this[string name] |
Same as GetValue; names are case-insensitive. |
ColumnInfos |
ColumnMetaData[] of the current result. node-coradb: getMetaData. |
StatementType |
The statement type of the current result. |
commandBehavior |
The CommandBehavior the reader was opened with. |
Navigation
Section titled “Navigation”| Method | Description |
|---|---|
bool Read() |
Moves to the next row, fetching the next page when needed. node-coradb: fetch. |
bool NextResult() |
Moves to the next result of a multi-statement command and skips non-query results. Returns false when there are no more results. |
void Close() / Dispose() |
Frees the server statement. With CommandBehavior.CloseConnection, the connection is closed too. |
IEnumerator GetEnumerator() |
Enumerates the rows as IDataRecord. |
Column information
Section titled “Column information”| Method | Description |
|---|---|
string GetName(int ordinal) / GetColumnName(int index) |
The column label. |
int GetOrdinal(string name) |
The column index (case-insensitive). An unknown name throws IndexOutOfRangeException. |
string GetDataTypeName(int ordinal) / GetColumnTypeName(int index) |
The CoraDB type name, e.g. VARCHAR. |
CoraDBDataType GetColumnDataType(int index) |
The CoraDB type code. |
Type GetFieldType(int ordinal) / GetColumnType(int index) |
The .NET type of the values (see Type mapping). |
int GetColumnCount() |
Same as FieldCount. |
DataTable GetSchemaTable() |
The standard schema table: ColumnName, ColumnOrdinal (0-based), ColumnSize, NumericPrecision, NumericScale, IsUnique, IsKey, BaseTableName, BaseColumnName, DataType, ProviderType (CoraDB type code), AllowDBNull, IsAutoIncrement, IsLong, IsReadOnly, ... Returns null when the result has no columns. |
Values
Section titled “Values”Unless noted otherwise, getters throw InvalidCastException for NULL values; check IsDBNull first.
| Method | Description |
|---|---|
object GetValue(int ordinal) / GetObject(int) / GetObject(string) |
The value as its natural .NET type (DBNull.Value for NULL). |
int GetValues(object[] values) |
Copies the row values into values and returns how many were copied. |
bool IsDBNull(int ordinal) |
true for NULL. |
bool GetBoolean(int) |
Numbers (non-zero = true), "1"/"0", "true"/"false", "y"/"n", "yes"/"no", or BIT values. |
byte GetByte(int), short GetInt16(int) / GetShort(int), int GetInt32(int) / GetInt(int), long GetInt64(int) |
Integer values. Numeric strings are converted. |
float GetFloat(int), double GetDouble(int), decimal GetDecimal(int) |
Floating-point and NUMERIC values. |
string GetString(int) / GetString(string name) |
Text. Other types are formatted: dates as ISO strings, BIT as hex, collections as {a, b}. A CLOB is read completely. |
char GetChar(int) |
The first character of a string. |
DateTime GetDateTime(int) |
DATE / DATETIME / TIMESTAMP, and the wall-clock time of TZ types. |
TimeSpan GetTimeSpan(int) |
TIME, or the time of day of a date/time. |
CoraDBDateTimeTz GetDateTimeTz(int) / DateTimeOffset GetDateTimeOffset(int) |
Time-zone-aware values. |
Guid GetGuid(int) |
From a 36-character string or 16 bytes. |
T GetFieldValue<T>(int) |
Typed access, including DateOnly, TimeOnly, DateTimeOffset, Guid, bool, enums and byte[] (from a BLOB). For SQL NULL: DBNull.Value when T is object, null for reference and Nullable<> types, InvalidCastException for value types. |
long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length) |
Reads BIT / VARBIT / BLOB / string bytes in chunks. With buffer == null it returns the total length. |
long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length) |
Reads characters in chunks (CLOBs too: the CLOB is read from the server once per row). With buffer == null it returns the total length. |
Stream GetStream(int) / TextReader GetTextReader(int) |
Stream over binary / LOB data, or a reader over text. |
string GetDate(int[, string format]), GetTime(int[, string format]), GetTimestamp(int[, string format]) |
Formatted date / time strings (yyyy-MM-dd, HH:mm:ss, yyyy-MM-dd HH:mm:ss.fff by default). |
CoraDBBlob GetBlob(int) / CoraDBClob GetClob(int) |
LOB values (null for NULL). |
object[] GetArray(int) |
SET / MULTISET / SEQUENCE values (null for NULL). |
CoraDBOid GetOid() |
The OID of the current row. Needs IncludeOid = true; null when the server sent none. |
CoraDBOid GetOid(int ordinal) |
The value of an OBJECT column. |
Dictionary<string, object> GetRowAsObject() |
The current row as a column-name → value dictionary. node-coradb: queryAsObjects. |
DbDataReader GetDataReader(int) |
Not supported. |
CoraDBTransaction
Section titled “CoraDBTransaction”public sealed class CoraDBTransaction : DbTransaction
Created by CoraDBConnection.BeginTransaction. While it is pending the connection works with auto-commit off; commit
or rollback restores the previous mode. Disposing an open transaction rolls it back.
| Member | Description |
|---|---|
void Commit() |
Commits the transaction. |
void Rollback() |
Rolls back the transaction. |
void Save(string savepointName) |
Creates a savepoint. |
void Rollback(string savepointName) |
Rolls back to a savepoint; the transaction stays open. |
CoraDBConnection Connection |
The connection (null after commit or rollback). |
bool IsOpen |
true while the transaction is pending. |
IsolationLevel IsolationLevel / CoraDBIsolationLevel CoraDBIsolationLevel |
The isolation level. |
bool SupportsSavepoints |
Always true. |
static IsolationLevel ToSystemIsolationLevel(CoraDBIsolationLevel level) |
Maps a CoraDB isolation level to the ADO.NET enum. |
CoraDBDataAdapter
Section titled “CoraDBDataAdapter”public sealed class CoraDBDataAdapter : DbDataAdapter
| Member | Description |
|---|---|
CoraDBDataAdapter() |
Creates an adapter. |
CoraDBDataAdapter(CoraDBCommand selectCommand) |
Creates an adapter with a select command. |
CoraDBDataAdapter(string selectCommandText, CoraDBConnection connection) |
Creates an adapter with a SELECT text and a connection. |
CoraDBDataAdapter(string selectCommandText, string selectConnString) |
Creates an adapter with a SELECT text and a new connection. |
SelectCommand, InsertCommand, UpdateCommand, DeleteCommand |
Typed as CoraDBCommand. |
int UpdateBatchSize |
Always 1: rows are updated one at a time. |
event CoraDBRowUpdatingEventHandler RowUpdating |
Raised before each row is sent. |
event CoraDBRowUpdatedEventHandler RowUpdated |
Raised after each row is sent. |
Fill(...), FillSchema(...), Update(...) |
Standard ADO.NET. FillSchema sets primary keys, AllowDBNull, AutoIncrement, ... |
CoraDBRowUpdatingEventArgs / CoraDBRowUpdatedEventArgs hold the row, the CoraDBCommand Command, the
statement type and the table mapping.
CoraDBCommandBuilder
Section titled “CoraDBCommandBuilder”public sealed class CoraDBCommandBuilder : DbCommandBuilder
Generates INSERT / UPDATE / DELETE commands for a CoraDBDataAdapter. The SELECT must return a primary key or a
unique column. Identifiers are quoted with back quotes. Optimistic concurrency checks every column, and NULL
originals are handled. A row changed by someone else raises DBConcurrencyException.
| Member | Description |
|---|---|
CoraDBCommandBuilder() / CoraDBCommandBuilder(CoraDBDataAdapter dataAdapter) |
Creates a builder, optionally attached to an adapter. |
CoraDBDataAdapter DataAdapter |
The adapter. |
CoraDBCommand GetInsertCommand([bool useColumnsForParameterNames]) |
The generated INSERT. Parameters are named ?p1, ?p2, ..., or after the columns when useColumnsForParameterNames is true. |
CoraDBCommand GetUpdateCommand([bool useColumnsForParameterNames]) |
The generated UPDATE. |
CoraDBCommand GetDeleteCommand([bool useColumnsForParameterNames]) |
The generated DELETE. |
string QuoteIdentifier(string unquotedIdentifier) |
a`b → `ab` ``. |
string UnquoteIdentifier(string quotedIdentifier) |
The reverse of QuoteIdentifier. |
SetAllValues, ConflictOption, RefreshSchema() |
Standard ADO.NET. |
CoraDBClientFactory
Section titled “CoraDBClientFactory”public sealed class CoraDBClientFactory : DbProviderFactory
| Member | Description |
|---|---|
static readonly CoraDBClientFactory Instance |
The singleton. |
const string InvariantName = "CoraDB.Data.CoraDBClient" |
The provider invariant name. Use DbProviderFactories.RegisterFactory(InvariantName, Instance). |
CreateConnection(), CreateCommand(), CreateParameter(), CreateDataAdapter(), CreateCommandBuilder(), CreateConnectionStringBuilder() |
Create the CoraDB implementations. |
CanCreateDataAdapter, CanCreateCommandBuilder |
true. |
CanCreateDataSourceEnumerator |
false. |
CoraDBBlob / CoraDBClob / CoraDBLob
Section titled “CoraDBBlob / CoraDBClob / CoraDBLob”public abstract class CoraDBLob — base of CoraDBBlob and CoraDBClob.
A LOB is created on the server (new CoraDBBlob(conn), conn.CreateBlob()) or read from a result. Content is
transferred in chunks of 128 KB. To store a LOB, bind it as a parameter of an INSERT / UPDATE.
| Member | Description |
|---|---|
CoraDBConnection Connection |
The owning connection. |
CoraDBLobHandle LobHandle |
The server handle. |
long Length |
The length in bytes. |
int Read(long offset, byte[] buffer, int start, int count) |
Reads up to count bytes at the 0-based offset. |
long Write(long offset, byte[] buffer, int start, int count) |
Writes bytes at the 0-based offset; returns the bytes written. |
byte[] ReadAll() |
Reads the whole content. |
void CopyTo(Stream destination) |
Copies the content into a stream. |
long WriteFrom(Stream source) |
Appends a stream's content. |
byte[] GetPackedLobHandle() |
The packed handle (what is sent when the LOB is bound). |
CoraDBBlob
| Member | Description |
|---|---|
CoraDBBlob(CoraDBConnection conn) |
Creates an empty BLOB on the server. |
long BlobLength |
The length in bytes. |
byte[] GetBytes(long pos, int length) |
Reads length bytes starting at the 1-based pos. |
long SetBytes(ulong pos, byte[] bytes) |
Writes bytes at the 1-based pos; returns the bytes written. |
CoraDBClob — positions and lengths are in bytes; text uses the connection character set.
| Member | Description |
|---|---|
CoraDBClob(CoraDBConnection conn) |
Creates an empty CLOB on the server. |
long ClobLength |
The length in bytes. |
string GetString() |
The whole text. |
string GetString(long pos, int length) |
Decodes length bytes starting at the 1-based pos. |
long SetString(ulong pos, string str) |
Writes the encoded str at the 1-based byte pos. |
CoraDBLobHandle
Section titled “CoraDBLobHandle”public sealed class CoraDBLobHandle : IEquatable<CoraDBLobHandle> — the packed handle
[int type][long size][int locator size][locator\0].
| Member | Description |
|---|---|
CoraDBLobHandle(CoraDBDataType lobType, byte[] packedLobHandle) |
Parses a packed handle. |
CoraDBDataType LobType |
CCI_U_TYPE_BLOB or CCI_U_TYPE_CLOB. |
long LobSize |
The size known to the handle. |
string Locator |
The server-side locator (file path). |
byte[] GetPackedLobHandle() |
A copy of the packed bytes. |
void SetLobSize(long size) |
Updates the size stored in the handle. |
CoraDBOid
Section titled “CoraDBOid”public sealed class CoraDBOid : IEquatable<CoraDBOid> — an object identifier (page, slot, volume).
| Member | Description |
|---|---|
CoraDBOid(byte[] oid) |
From the 8-byte wire form. |
CoraDBOid(string oidStr) |
From @page|slot|volume. |
CoraDBOid(int page, short slot, short volume) |
From the parts. |
byte[] Oid |
The 8-byte big-endian form. |
int Page(), int Slot(), int Volume() |
The parts. |
string GetOidString() |
@page|slot|volume; the OID functions accept this form. |
string Get_OidStr() |
Obsolete alias of GetOidString(). |
const int OID_BYTE_SIZE = 8 |
The wire size. |
Equals, GetHashCode, ToString() |
Value equality; ToString() returns OID:@page|slot|volume. |
CoraDBDateTimeTz
Section titled “CoraDBDateTimeTz”public readonly struct CoraDBDateTimeTz : IEquatable<CoraDBDateTimeTz> — a TIMESTAMPTZ, TIMESTAMPLTZ,
DATETIMETZ or DATETIMELTZ value. It holds the wall-clock date/time and the server's time zone string (a region
such as Europe/Bucharest EEST, or an offset such as +03:00).
| Member | Description |
|---|---|
CoraDBDateTimeTz(DateTime dateTime, string timeZone) |
From a wall-clock time and a zone. |
CoraDBDateTimeTz(DateTimeOffset value) |
From a DateTimeOffset; the zone becomes the offset. |
DateTime DateTime |
The wall-clock date and time. |
string TimeZone |
The zone as sent by the server. |
string TimeZoneId |
The region / offset part, without the abbreviation. |
DateTimeOffset ToDateTimeOffset() |
Converts the value. Offsets always work; region names are resolved with TimeZoneInfo.FindSystemTimeZoneById. |
static bool TryParseOffset(string value, out TimeSpan offset) |
Parses +hh:mm, +h:mm, -hhmm, +hh, Z, UTC and GMT. |
ToString() |
yyyy-MM-dd HH:mm:ss.fff zone. |
DATETIMETZ / TIMESTAMPTZ parameters accept DateTimeOffset, CoraDBDateTimeTz, DateTime and strings.
CoraDBBatchResult
Section titled “CoraDBBatchResult”public sealed class CoraDBBatchResult — the result of BatchExecute / ExecuteArray, one entry per statement or
row.
| Member | Description |
|---|---|
CoraDBBatchResult(int count) |
Creates an empty result. |
int Length / int Count() |
Number of statements. |
int[] Results |
Affected rows per statement (ExecuteFailed = -3 when it failed). |
int[] ErrorCodes |
Error code per statement (0 = success). |
string[] ErrorMessages |
Error message per statement (null = success). |
int[] StatementTypes |
The CoraDBStatementType of each statement, as an int. |
CoraDBOid[] Oids |
OID of the inserted object, when available. |
bool HasErrors |
true when at least one statement failed. |
int TotalAffectedRows |
Sum of the affected rows of the successful statements. |
getResults(), getErrorCodes(), getErrorMessages(), getStatementTypes(), getErrorFlag() |
Aliases kept for CUBRID compatibility. |
ColumnMetaData
Section titled “ColumnMetaData”public sealed class ColumnMetaData — the server's description of a result column (CoraDBDataReader.ColumnInfos).
| Property | Description |
|---|---|
string Name |
The column label. |
string RealName |
The column (attribute) name in the table. |
string Table |
The table name. |
CoraDBDataType Type |
The type; collections are SET / MULTISET / SEQUENCE. |
CoraDBDataType ElementType |
The element type of a collection column. |
int Precision |
The precision (maximum length for strings). |
short Scale |
The scale. |
int CharsetId / Encoding Charset |
The column character set. |
bool IsNullable, IsAutoIncrement, IsPrimaryKey, IsUniqueKey, IsForeignKey, IsReverseIndex, IsReverseUnique, IsShared |
Column flags. |
string DefaultValue |
The default value expression. |
CoraDBSchemaProvider
Section titled “CoraDBSchemaProvider”public class CoraDBSchemaProvider — implements CoraDBConnection.GetSchema. Restrictions are SQL LIKE patterns
(% when omitted) and are sent as bind parameters.
| Collection | Restrictions | Columns |
|---|---|---|
MetaDataCollections |
— | CollectionName, NumberOfRestrictions |
DataSourceInformation |
— | Product name / version, parameter marker format and pattern, identifier patterns, ... |
DataTypes |
— | TypeName, ProviderDataType, DataType, Size, IsLong, IsFixedLength, IsFixedPrecisionScale, IsNullable, IsAutoIncrementable, ... |
ReservedWords |
— | ReservedWord |
Users |
User name | USERNAME |
Databases |
Database name | CATALOG_NAME, SCHEMA_NAME |
Procedures |
Name | PROCEDURE_NAME, PACKAGE_NAME, PROCEDURE_TYPE, RETURN_TYPE, ARGUMENTS_COUNT, LANGUAGE, AUTHID, TARGET, OWNER, IS_DETERMINISTIC |
Tables |
Table name | TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME |
Views |
View name | VIEW_CATALOG, VIEW_SCHEMA, VIEW_NAME |
Columns |
Table name, Column name | TABLE_*, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, NUMERIC_PRECISION, NUMERIC_SCALE, CHARACTER_SET |
Indexes |
Table name, Column name, Index name | INDEX_*, TABLE_NAME, UNIQUE, REVERSE, PRIMARY, FOREIGN_KEY, DIRECTION |
IndexColumns (INDEX_COLUMNS) |
Table name, Index name | INDEX_*, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, DIRECTION |
ForeignKeys (FOREIGN_KEYS) |
Table name (all tables when omitted), key name | PKTABLE_NAME, PKCOLUMN_NAME, FKTABLE_NAME, FKCOLUMN_NAME, KEY_SEQ, UPDATE_ACTION, DELETE_ACTION, FK_NAME, PK_NAME |
| Method | Description |
|---|---|
CoraDBSchemaProvider(CoraDBConnection connection) |
Creates a provider. |
DataTable GetSchema(string collection, string[] filters) |
Dispatches by collection name (case-insensitive). |
GetTables, GetViews, GetColumns, GetIndexes, GetIndexColumns, GetForeignKeys, GetUsers, GetDatabases, GetProcedures (string[] filters) |
One method per collection. |
DataTable GetDataSourceInformation() |
The DataSourceInformation collection. |
static DataTable GetDataTypes(), static DataTable GetReservedWords() |
Static collections. |
DataTable GetSchemaInfoTable(CoraDBSchemaType schemaType, string arg1, string arg2, CoraDBSchemaPatternMatch patternMatch) |
The raw CAS schema information (GetSchemaInfo). |
static string[] GetNumericFunctions(), static string[] GetStringFunctions() |
Lists of SQL function names. |
CoraDBMetaData
Section titled “CoraDBMetaData”public class CoraDBMetaData — static helpers over CoraDB type names.
| Method | Description |
|---|---|
static CoraDBDataType NameToType(string typeName) |
"VARCHAR" → CCI_U_TYPE_STRING, ... |
static bool IsNumericType(string), IsTextType(string), IsDateTimeType(string), IsBitType(string), IsLOBType(string), IsCollectionType(string) |
Classify a type name. |
static bool SupportsScale(string typeName) |
true for types with a scale. |
CoraDBException
Section titled “CoraDBException”public sealed class CoraDBException : DbException
| Member | Description |
|---|---|
int ErrorCode |
One of: a driver code (ER_*, -21001…), a CAS code (CAS_ER_*, -10000…), or the server error number (e.g. -493 syntax error, -670 unique violation, -4 interrupted). |
string Message |
The message; server messages are passed through. |
int Indicator |
-1 for CAS errors, -2 for DBMS errors, 0 for driver errors. |
bool IsServerError |
true when the database server reported the error. |
bool IsCommunicationError |
true when the broker could not be reached or the connection was lost. |
const int GenericErrorCode = -1 |
Code of driver argument / state errors. |
static string MessageFor(int errorCode) |
The standard message of a driver / CAS code (null when unknown). |
| Constructors | (string message), (CoraDBErrorCode code), (CoraDBErrorCode code, Exception inner), (int code), (int code, string message), (int code, string message, Exception inner) |
CoraDBErrorCode
Section titled “CoraDBErrorCode”The driver codes: ER_NO_ERROR (0), ER_NOT_OBJECT (-21001), ER_DBMS, ER_COMMUNICATION, ER_NO_MORE_DATA,
ER_TYPE_CONVERSION, ER_BIND_INDEX, ER_NOT_BIND (-21007), ER_WAS_NULL, ER_COLUMN_INDEX, ER_TRUNCATE,
ER_SCHEMA_TYPE, ER_FILE, ER_CONNECTION (-21013), ER_ISO_TYPE, ER_ILLEGAL_REQUEST, ER_INVALID_ARGUMENT,
ER_IS_CLOSED, ER_ILLEGAL_FLAG, ER_ILLEGAL_DATA_SIZE, ER_NO_MORE_RESULT, ER_OID_IS_NOT_INCLUDED,
ER_CMD_IS_NOT_INSERT, ER_UNKNOWN, ER_TIMEOUT (-21024), ER_ILLEGAL_TIMESTAMP (-21027), ER_SSL_HANDSHAKE, ER_NOT_SUPPORTED_PROTOCOL (-21029).
The CAS codes: CAS_ER_DBMS (-10000), CAS_ER_INTERNAL, CAS_ER_NO_MORE_MEMORY, CAS_ER_COMMUNICATION,
CAS_ER_ARGS, CAS_ER_TRAN_TYPE, CAS_ER_SRV_HANDLE (-10006), CAS_ER_NUM_BIND, CAS_ER_UNKNOWN_U_TYPE,
CAS_ER_DB_VALUE, CAS_ER_TYPE_CONVERSION, CAS_ER_PARAM_NAME, CAS_ER_NO_MORE_DATA (-10012), CAS_ER_OBJECT,
CAS_ER_OPEN_FILE, CAS_ER_SCHEMA_TYPE, CAS_ER_VERSION, CAS_ER_FREE_SERVER, CAS_ER_NOT_AUTHORIZED_CLIENT,
CAS_ER_QUERY_CANCEL, CAS_ER_NOT_COLLECTION, CAS_ER_COLLECTION_DOMAIN, CAS_ER_NO_MORE_RESULT_SET,
CAS_ER_INVALID_CALL_STMT, CAS_ER_STMT_POOLING (-10024), CAS_ER_DBSERVER_DISCONNECTED,
CAS_ER_MAX_PREPARED_STMT_COUNT_EXCEEDED, CAS_ER_HOLDABLE_NOT_ALLOWED, CAS_ER_HOLDABLE_NOT_ALLOWED_KEEP_CON_OFF,
CAS_ER_NOT_IMPLEMENTED (-10100), CAS_ER_MAX_CLIENT_EXCEEDED, CAS_ER_INVALID_CURSOR_POS,
CAS_ER_SSL_TYPE_NOT_ALLOWED (-10103), CAS_ER_IS (-10200).
Loggers
Section titled “Loggers”| Type | Description |
|---|---|
interface ICoraDBLogger |
bool IsEnabled(CoraDBLogLevel level); void Log(CoraDBLogLevel level, string message). Assign one to CoraDBConnection.Logger or CoraDBConnection.DefaultLogger. |
CoraDBNoopLogger |
Discards everything (the default). static Instance. |
CoraDBConsoleLogger([CoraDBLogLevel minimumLevel]) |
Writes to the console; Warn and Error go to stderr. MinimumLevel is settable. |
CoraDBTraceLogger(CoraDBLogLevel minimumLevel, string file) |
Writes to System.Diagnostics.Trace and, optionally, appends to file. Used by logTraceApi / logTraceNetwork. |
enum CoraDBLogLevel |
Debug (protocol details), Info, Warn, Error, None. |
The driver logs connects and disconnects (Info), reconnects / retries and slow queries (Warn), and every request
and response with logTraceNetwork (Debug).
Enumerations
Section titled “Enumerations”| Enum | Values |
|---|---|
CoraDBDataType |
The CCI U_TYPE codes: CCI_U_TYPE_NULL/UNKNOWN (0), CHAR (1), STRING (2), NCHAR (3), VARNCHAR (4), BIT (5), VARBIT (6), NUMERIC (7), INT (8), SHORT (9), MONETARY (10), FLOAT (11), DOUBLE (12), DATE (13), TIME (14), TIMESTAMP (15), SET (16), MULTISET (17), SEQUENCE (18), OBJECT (19), RESULTSET (20), BIGINT (21), DATETIME (22), BLOB (23), CLOB (24), ENUM (25), USHORT (26), UINT (27), UBIGINT (28), TIMESTAMPTZ (29), TIMESTAMPLTZ (30), DATETIMETZ (31), DATETIMELTZ (32), TIMETZ (33, reserved), JSON (34), GRAPH_OBJECT (35, CoraDB graph results) |
CoraDBStatementType |
CORADB_STMT_ALTER_CLASS (0) … CORADB_STMT_INSERT (20), SELECT (21), UPDATE (22), DELETE (23), CALL (24), …, CORADB_STMT_CALL_SP (126), CORADB_STMT_UNKNOWN (127) |
CoraDBIsolationLevel |
TRAN_UNKNOWN_ISOLATION (0), TRAN_READ_COMMITTED (4), TRAN_REPEATABLE_READ (5), TRAN_SERIALIZABLE (6), plus the CUBRID aliases (TRAN_REP_READ, TRAN_CURSOR_STABILITY, TRAN_DEFAULT_ISOLATION, ...) |
CoraDBDatabaseParameter |
CCI_PARAM_ISOLATION_LEVEL (1), CCI_PARAM_LOCK_TIMEOUT (2), CCI_PARAM_MAX_STRING_LENGTH (3), CCI_PARAM_AUTO_COMMIT (4), CCI_PARAM_NO_BACKSLASH_ESCAPES (5) |
CoraDBSchemaType |
CCI_SCH_CLASS (1), VCLASS, QUERY_SPEC, ATTRIBUTE (4), CLASS_ATTRIBUTE, METHOD, CLASS_METHOD, METHOD_FILE, SUPERCLASS, SUBCLASS, CONSTRAINT (11), TRIGGER, CLASS_PRIVILEGE, ATTR_PRIVILEGE, DIRECT_SUPER_CLASS, PRIMARY_KEY (16), IMPORTED_KEYS, EXPORTED_KEYS, CROSS_REFERENCE, ATTR_WITH_SYNONYM (20) |
CoraDBSchemaPatternMatch (flags) |
None, ClassNamePattern, AttributeNamePattern |
ZeroDateTimeBehavior |
ConvertToNull (default), Round (to 0001-01-01), Exception |
CoraDBLogLevel |
Debug, Info, Warn, Error, None |
Type mapping
Section titled “Type mapping”Reading (server type → .NET value from GetValue)
Section titled “Reading (server type → .NET value from GetValue)”| CoraDB type | .NET type |
|---|---|
| SHORT / SMALLINT | short |
| INT | int |
| BIGINT | long |
| FLOAT / REAL | float |
| DOUBLE, MONETARY | double |
| NUMERIC / DECIMAL | decimal. Columns with a precision above 28 are returned as exact string values (for every row, so the column type is stable); other values that don't fit a decimal exactly are returned as string too. GetDecimal / GetDouble convert them. |
| CHAR, VARCHAR / STRING, ENUM, JSON | string |
| BIT, BIT VARYING | byte[] |
| DATE, DATETIME, TIMESTAMP | DateTime |
| TIME | TimeSpan |
| TIMESTAMPTZ / LTZ, DATETIMETZ / LTZ | CoraDBDateTimeTz |
| SET, MULTISET, LIST / SEQUENCE | object[] |
| BLOB / CLOB | CoraDBBlob / CoraDBClob |
| OBJECT | CoraDBOid |
| NULL | DBNull.Value |
Writing (parameter value → CoraDB type, when the type is inferred)
Section titled “Writing (parameter value → CoraDB type, when the type is inferred)”| .NET value | CoraDB type |
|---|---|
string, char, Guid |
STRING |
bool |
SHORT (1 / 0) |
byte, sbyte, short |
SHORT |
ushort, int |
INT |
uint, long |
BIGINT |
ulong, BigInteger |
NUMERIC |
float |
FLOAT |
double |
DOUBLE |
decimal |
NUMERIC |
DateTime |
DATETIME |
DateOnly |
DATE |
TimeSpan, TimeOnly |
TIME |
DateTimeOffset, CoraDBDateTimeTz |
DATETIMETZ |
byte[] |
VARBIT |
Arrays / IEnumerable (except string and byte[]) |
SEQUENCE (set CoraDBDataType = SET for sets) |
| Enums | The type of the underlying integer |
CoraDBBlob / CoraDBClob |
BLOB / CLOB |
CoraDBOid |
OBJECT |
null / DBNull |
NULL |
| Anything else | STRING (the value's invariant ToString()) |
DbType ↔ CoraDB type
Section titled “DbType ↔ CoraDB type”| DbType | CoraDB type |
|---|---|
String, StringFixedLength, AnsiString, AnsiStringFixedLength, Guid, Xml |
STRING (CHAR for the fixed-length types) |
Boolean, Byte, SByte, Int16 |
SHORT |
UInt16, Int32 |
INT |
UInt32, Int64 |
BIGINT |
UInt64 |
NUMERIC (CoraDB has no unsigned types: unsigned values are widened so they never wrap) |
Single |
FLOAT |
Double |
DOUBLE |
Decimal, VarNumeric |
NUMERIC |
Currency |
MONETARY |
Date |
DATE |
Time |
TIME |
DateTime, DateTime2 |
DATETIME |
DateTimeOffset |
DATETIMETZ |
Binary |
VARBIT |
Object |
Inferred from the value |
Server notes
Section titled “Server notes”- OIDs (
IncludeOid,GetOid(), the OID and collection functions) work only with tables created withDONT_REUSE_OID. CoraDB tables areREUSE_OIDby default. - MULTISET values can't be bound as parameters: the CAS builds a SET from them. Use a literal (
{'a','b'}) or a SET / SEQUENCE parameter. SLEEP()can't be interrupted, so it ignores query timeouts andCancel().