On Wed, 03 Nov 2010 18:24:57 -0400, Scott A Mintz <sami...@ra.rockwell.com> wrote:
> Is it possible to construct a query that will tell me the total size in > bytes of the result set? Specifically, in a messaging protocol that > returns data we need to fragment the reply and it would be nice to know > how much data or how many packets will be required to send the response. Per my other post, for TEXT values, you can CAST to BLOB and then use length(). Assuming the C API, I am guessing that it’s much more efficient play with sqlite3_column_bytes(), sqlite3_column_bytes16(), sqlite3_value_bytes(), and/or sqlite3_value_bytes16(). These will return byte-counts (with no zero terminator) for both TEXT and BLOB values. As far as I can tell, you will need to count the bytes in numeric values yourself. (I’ve looked into this before, and just glanced into it again.) SQLite uses its own variable-length integer representation internally, occupying between 1 and 64 bits per value; if this is for a network protocol, you probably want to count the bytes in protocol representation rather than SQLite’s representation. Counting the bytes (or lack thereof) in NULL values should probably also be done in your protocol’s representation. Samuel Adam <a...@certifound.com> 763 Montgomery Road Hillsborough, NJ 08844-1304 United States http://certifound.com/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users