std.database.sql Package

Function Description

The database.sql package provides the interface for accessing the database.

This package provides universal SQL/CLI interfaces and works with the database driver to perform operations on the database.

Notes:

Currently, only SQL/CLI interfaces are supported.

The following table lists the mapping between SQL data types and Cangjie data types.

SQLCDBC/CangjieSqlDataTypeDescription
RUNEStringSqlChar-
VARCHARStringSqlVarchar-
CLOBio.InputStreamSqlClob-
BINARYArray<Byte>SqlBinary-
VARBINARYArray<Byte>SqlVarBinary-
BLOBio.InputStreamSqlBlob-
NUMERICDecimalsqlDecimal-
DECIMALDecimalsqlDecimal-
BOOLEANBoolSqlBool-
TINYINTInt8SqlByte-
SMALLINTInt16SqlSmallInt-
INTEGERInt32SqlInteger-
BIGINTInt64SqlBigInt-
REALFloat32SqlReal-
DOUBLEFloat64SqlDouble-
DATEtime.DateTimeSqlDateThe value can be YEAR, MONTH, or DAY.
TIMEtime.DateTimeSqlTimeThe value can be HOUR, MINUTE, or SECOND but cannot be TIME ZONE.
TIMETZtime.DateTimeSqlTimeTzThe value can be HOUR, MINUTE, SECOND, or TIME ZONE.
TIMESTAMPtime.DateTimeSqlTimestampThe value can be YEAR, MONTH, DAY, HOUR, MINUTE, SECOND or TIME ZONE.
INTERVALtime.DurationSqlIntervalInterval in year-month format or day-time format.

API List

Interface

NameDescription
ColumnInfoSpecifies the column information of the result returned by executing the Select/Query statement.
ConnectionSpecifies the database connection interface.
DatasourceSpecifies the data source interface.
DriverSpecifies the database driver interface.
QueryResultSpecifies the interface used to query the result generated by executing the Select statement.
SqlDbTypeSpecifies the parent class of all SQL data types.
SqlNullableDbTypeSpecifies the parent class of the SQL data type that allows null values.
StatementSpecifies the interface of SQL statement pre-execution.
TransactionDefines the core behavior of database transactions.
UpdateResultSpecifies the interface used to update the result generated by executing the Insert, Update, and Delete statements.

Class

NameDescription
DriverManagerObtains the database driver instance according to the driver name during running.
PooledDatasourceSpecifies a database connection pool class, which provides the database connection pool capability.
SqlOptionSpecifies the predefined SQL option name and value.
SqlBigIntSpecifies a large integer corresponding to the Cangjie Int64 type.
SqlBinarySpecifies a fixed-length binary string corresponding to the Cangjie Array<Byte> type.
SqlBlobSpecifies an excessively large variable-length binary string (BINARY LARGE OBJECT) corresponding to the Cangjie InputStream type.
SqlBoolSpecifies the Boolean type corresponding to the Cangjie Bool type.
SqlByteSpecifies a byte corresponding to the Cangjie Int8 type.
SqlCharSpecifies a fixed-length string corresponding to the Cangjie String type.
SqlClobSpecifies an excessively large variable-length string (RUNE LARGE OBJECT) corresponding to the Cangjie InputStream type.
SqlDateSpecifies a date, which must be in the format of dd-mm-yyyy and corresponds to the Cangjie DateTime type.
SqlDecimalSpecifies a high-precision number corresponding to the Cangjie Decimal type.
SqlDoubleSpecifies a double-precision floating-point number corresponding to the Cangjie Float64 type.
SqlIntegerSpecifies a medium integer corresponding to the Cangjie Int32 type.
SqlIntervalSpecifies the time interval corresponding to the Cangjie Duration type.
SqlRealSpecifies a floating-point number corresponding to the Cangjie Float32 type.
SqlSmallIntSpecifies a small integer corresponding to the Cangjie Int16 type.
SqlTimeSpecifies the time, which must be in the format of hhmmss.ms and corresponds to the Cangjie DateTime type.
SqlTimestampSpecifies a timestamp corresponding to the Cangjie DateTime type.
SqlTimeTzSpecifies the time with a time zone, which must be in the format of hhmmss.ms and corresponds to the Cangjie DateTime type.
SqlVarBinarySpecifies a variable-length binary string corresponding to the Cangjie Array<Byte> type.
SqlVarcharSpecifies a variable-length string corresponding to the Cangjie String type.
SqlNullableBigIntSpecifies a large integer corresponding to the Cangjie Int64 type, which can be a Null value in the database.
SqlNullableBinarySpecifies a fixed-length binary string corresponding to the Cangjie Array<Byte> type, which can be a Null value in the database.
SqlNullableBlobSpecifies an excessively large variable-length binary string (BINARY LARGE OBJECT) corresponding to the Cangjie InputStream type, which can be a Null value in the database.
SqlNullableBoolSpecifies the Boolean type corresponding to the Cangjie Bool type, which can be a Null value in the database.
SqlNullableByteSpecifies a byte corresponding to the Cangjie Int8 type, which can be a Null value in the database.
SqlNullableCharSpecifies a fixed-length binary string corresponding to the Cangjie String type, which can be a Null value in the database.
SqlNullableClobSpecifies an excessively large variable-length string (RUNE LARGE OBJECT) corresponding to the Cangjie InputStream type, which can be a Null value in the database.
SqlNullableDateSpecifies a date, which must be in the format of dd-mm-yyyy and corresponds to the Cangjie DateTime type. It can be a Null value in the database.
SqlNullableDecimalSpecifies a high-precision number corresponding to the Cangjie Decimal type, which can be a Null value in the database.
SqlNullableDoubleSpecifies a double-precision float-point number corresponding to the Cangjie Float64 type, which can be a Null value in the database.
SqlNullableIntegerSpecifies a medium integer corresponding to the Cangjie Int32 type, which can be a Null value in the database.
SqlNullableIntervalSpecifies the time interval corresponding to the Cangjie Duration type, which can be a Null value in the database.
SqlNullableRealSpecifies a floating-point number corresponding to the Cangjie Float32 type, which can be a Null value in the database.
SqlNullableSmallIntSpecifies a small integer corresponding to the Cangjie Int16 type, which can be a Null value in the database.
SqlNullableTimeSpecifies the time, which must be in the format of hhmmss.ms and corresponds to the Cangjie DateTime type. It can be a Null value in the database.
SqlNullableTimestampSpecifies a timestamp corresponding to the Cangjie DateTime type, which can be a Null value in the database.
SqlNullableTimeTzSpecifies the time with a time zone, which must be in the format of hhmmss.ms and corresponds to the Cangjie DateTime type. It can be a Null value in the database.
SqlNullableVarBinarySpecifies a variable-length binary string corresponding to the Cangjie Array<Byte> type, which can be a Null value in the database.
SqlNullableVarcharSpecifies a variable-length string corresponding to the Cangjie String type, which can be a Null value in the database.

Enumeration

NameDescription
ConnectionStateDescribes the current status of the connection to the data source.
TransactionAccessModeSpecifies the transaction read/write mode.
TransactionDeferrableModeSpecifies the transaction delay mode.
TransactionIsoLevelDefines when and how the result of an operation in a transaction is visible to other concurrent transaction operations in the database system.

Exception Class

NameDescription
SqlExceptionHandles SQL-related exceptions.