Encode
Definition
The encode
method allows you to add the ENCODE
function to the query. The ENCODE
function encode binary data into a textual representation.
Available methods
encode(KColumn kColumn, KFormat kFormat)
: Receives aKColumn
orKTableColumn
and aKFormat
which will be supplied to theENCODE
function.encode(KValTextField kValTextField, KFormat kFormat)
: Receives aKValTextField
and aKFormat
which will be supplied to theENCODE
function.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example: (KColumn, KFormat)
Java code:
k
.select(
encode(APP_USER.FIRST_NAME.cast(bytea()), escape())
)
.from(APP_USER)
.multiple();
SQL generated:
SELECT
ENCODE(CAST(au.first_name AS BYTEA), 'ESCAPE')
FROM app_user au
Parameters:
- None
Example: (KValTextField, KFormat)
Java code:
k
.select(
encode(val("123\\000456").cast(bytea()), escape())
)
.single();
SQL generated:
SELECT ENCODE(CAST(?1 AS BYTEA), 'ESCAPE')
Parameters:
- ?1: "123\000456"