vendredi 29 avril 2016

How to prevent calling function twice in a single query with SQLite.swift?

I've created a custom function with SQLite.swift. However after checking, i see it calls this function twice in a single query. Here is mine

SELECT word1,customfunc('daydreamer', kd) as score FROM ngram1 WHERE kd LIKE 'd%r' ORDER BY score ASC,freq DESC LIMIT 0,4

In this query, i call customfunc and name it as score and use it in the sorting.

Normally, i thought SQLite will call to this customfunc only once time to get the score value and use it in the ordering?

Aucun commentaire:

Enregistrer un commentaire