Qt script count

From SQLiteStudio
Jump to: navigation, search

Definition

Language: Qt Script
Plugin for language: ScriptingQt
How to use: Create custom SQL function, set it to "aggregate" type. Suggested name: cnt
Function arguments Keep undefined
Function usage:
SELECT cnt(*) FROM tableName
Description: Works just like classical count(*) from SQL.

Code

Initialization code:

n=0;

Per step code:

n++;

Final step code:

return n;