Getting the size of an sqlite database

Sometimes you need a way (probably a multi-platform way) to get the size of an sqlite database and inside the cubesql server we really need to know that information a lot of times.
In C we use a function like:

Obviously the values returned by PRAGMA page_count; and PRAGMA page_size; can be used inside every application that have access to an sqlite3 database and multiplying these values represents a very easy way to get the database file without the needs to use the underline OS system calls.