getSessionInitSql method
Returns the post-connect SQL statements for the dialect implied by
connectionString, customised by options.
The returned list is empty when the dialect has no specific setup.
Implementation
List<String>? getSessionInitSql({
required String connectionString,
SessionOptions? options,
}) {
if (!supportsApi) return null;
final connPtr = connectionString.toNativeUtf8();
final optsPtr = options == null
? ffi.Pointer<bindings.Utf8>.fromAddress(0)
: jsonEncode(options.toJson()).toNativeUtf8().cast<bindings.Utf8>();
try {
final data = _native.execWithBuffer(
(buf, bufLen, outWritten) =>
_native.rawBindings.odbc_get_session_init_sql(
connPtr.cast<bindings.Utf8>(),
optsPtr,
buf,
bufLen,
outWritten,
),
);
if (data == null) return null;
final dynamic decoded = jsonDecode(utf8.decode(data));
if (decoded is! List) return <String>[];
return decoded.cast<String>();
} finally {
malloc.free(connPtr);
if (options != null) {
malloc.free(optsPtr.cast<Utf8>());
}
}
}