Convert To
Definition
The convertTo method allows you to add the CONVERT_TO function to the query. The CONVERT_TO function convert a string to the encoding specified.
Available methods
convertTo(KColumn kColumn, KEncoding destEncoding): Receives aKColumnorKTableColumnand aKEncodingwhich will be supplied to theCONVERT_TOfunction.
To use this way, you need to import the static functions as follows:
import static com.myzlab.k.KFunction.*;
Example
Java code:
k
.select(
convertTo(APP_USER.FIRST_NAME, utf8())
)
.from(APP_USER)
.multiple();
SQL generated:
SELECT
CONVERT_TO(au.first_name, 'UTF8')
FROM app_user au
Parameters:
- None