Skip to content

Commit

Permalink
Document RDB$GET_TRANSACTION_CN
Browse files Browse the repository at this point in the history
  • Loading branch information
mrotteveel committed May 22, 2021
1 parent a749605 commit f6988c9
Showing 1 changed file with 58 additions and 0 deletions.
Expand Up @@ -3691,3 +3691,61 @@ A plain `AVG(Weight)` would include the -1 weights, thus skewing the result.

.See also
<<fblangref40-scalarfuncs-coalesce>>, <<fblangref40-scalarfuncs-decode>>, <<fblangref40-scalarfuncs-iif>>, <<fblangref40-commons-conditional-case,`CASE`>>

[[fblangref40-scalarfuncs-other]]
== Other Functions

Functions that don't really fit in any other category.

[[fblangref40-scalarfuncs-gettransactioncn]]
=== `RDB$GET_TRANSACTION_CN`

.Available in
DSQL, PSQL

.Result type
`BIGINT`

.Syntax
[listing,subs=+quotes]
----
RDB$GET_TRANSACTION_CN(_transaction_id_)
----

[[fblangref40-funcs-tbl-gettransactioncn]]
.`RDB$GET_TRANSACTION_CN` Function Parameters
[cols="<1,<3", options="header",stripes="none"]
|===
^| Parameter
^| Description

|transaction_id
|Transaction id
|===

`RDB$GET_TRANSACTION_CN` returns the commit number ("`CN`") of the supplied transaction.

If the return value is greater than 1, it is the actual _CN_ of the transaction if it was committed after the database was started.

The function can also return one of the following results, indicating the commit status of the transaction:

[horizontal]
`-2`:: Transaction is dead (rolled back)
`-1`:: Transaction is in limbo
`{nbsp}0`:: Transaction is still active
`{nbsp}1`:: Transaction committed before the database started or less than the Oldest Interesting Transaction for the database
`NULL`:: Transaction number supplied is NULL or greater than Next Transaction for the database

[NOTE]
====
For more information about _CN_, consult the _Firebird 4.0 Release Notes_.
====

[[fblangref40-scalarfuncs-gettransactioncn-exmpl]]
==== `RDB$GET_TRANSACTION_CN` Examples

[source]
----
select rdb$get_transaction_cn(current_transaction) from rdb$database;
select rdb$get_transaction_cn(123) from rdb$database;
----

0 comments on commit f6988c9

Please sign in to comment.