コード例 #1
0
        public ReadOnlySpan <byte> ColumnBlob(int index)
        {
            // https://www.sqlite.org/c3ref/column_blob.html
            // "The safest policy is to invoke these routines in one of the following ways:"
            // "sqlite3_column_blob() followed by sqlite3_column_bytes()"

            var pointer   = _sqlite3.ColumnBlob(_statement, index);
            var byteCount = _sqlite3.ColumnBytes(_statement, index);

            if (byteCount > 0 && pointer.IsValid())
            {
                unsafe
                {
                    return(new ReadOnlySpan <byte>(
                               pointer.ToPointer(),
                               byteCount));
                }
            }

            return(ReadOnlySpan <byte> .Empty);
        }