Given the ubiquitous use of UTF-8, which cleverly avoids encodings having bytes equal to zero, relying on the NUL terminator would be simpler. As the docs say, <u>[If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() is negative, then the length of the string is the number of bytes up to the first zero terminator.](https://sqlite.org/c3ref/bind_blob.html)</u>. So, just write:<code> return sqlite3_bind_text( statement, 1, buffer.baseAddress, Int32(-1), unsafeBitCast(-1, to: sqlite3_destructor_type.self) ) </code>, and be done with it.