Convert
Definition
The convert
method allows you to add the CONVERT
function to the query. The CONVERT
function convert a string to the encoding specified.
Available methods
convert(KColumn kColumn, KEncoding srcEncoding, KEncoding destEncoding)
: Receives aKColumn
orKTableColumn
and twoKEncoding
which will be supplied to theCONVERT
function.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example
Java code:
k
.select(
convert(APP_USER.FIRST_NAME.cast(bytea()), utf8(), latin1())
)
.from(APP_USER)
.multiple();
SQL generated:
SELECT
CONVERT(CAST(au.first_name AS BYTEA), 'UTF8', 'LATIN1')
FROM app_user au
Parameters:
- None