Skip to content

Qt_script_getbit

Paweł Salawa edited this page Feb 21, 2024 · 1 revision

Definition

Language: Qt Script
Plugin for language: ScriptingQt
How to use: Create custom SQL function. Suggested name: getBit
Function arguments bitIndex, intValue
Function usage: SELECT getBit(0, some_integer_column)
Description: It extracts bit of given index from a given integer value

Code

return ((1 << arguments[0]) & arguments[1]) >> arguments[0]