Decompiled source of UKSQLite v1.0.0

plugins/UKSQLite/Microsoft.Data.Sqlite.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.Data.Sqlite.Properties;
using Microsoft.Data.Sqlite.Utilities;
using SQLitePCL;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("Microsoft.Data.Sqlite.e_sqlcipher.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Data.Sqlite.e_sqlite3mc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Data.Sqlite.sqlite3.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Data.Sqlite.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.Data.Sqlite.winsqlite3.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyMetadata("CommitHash", "a612c2a1056fe3265387ae3ff7c94eba1505caf9")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyDescription("Microsoft.Data.Sqlite is a lightweight ADO.NET provider for SQLite. This package does not include a copy of the native SQLite library.\r\n\r\nCommonly Used Types:\r\nMicrosoft.Data.Sqlite.SqliteCommand\r\nMicrosoft.Data.Sqlite.SqliteConnection\r\nMicrosoft.Data.Sqlite.SqliteConnectionStringBuilder\r\nMicrosoft.Data.Sqlite.SqliteDataReader\r\nMicrosoft.Data.Sqlite.SqliteException\r\nMicrosoft.Data.Sqlite.SqliteFactory\r\nMicrosoft.Data.Sqlite.SqliteParameter\r\nMicrosoft.Data.Sqlite.SqliteTransaction")]
[assembly: AssemblyFileVersion("10.0.526.15411")]
[assembly: AssemblyInformationalVersion("10.0.5")]
[assembly: AssemblyProduct("Microsoft Entity Framework Core")]
[assembly: AssemblyTitle("Microsoft.Data.Sqlite")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dotnet/dotnet")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyVersion("10.0.5.0")]
[module: RefSafetyRules(11)]
[module: System.Runtime.CompilerServices.NullablePublicOnly(true)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class NullablePublicOnlyAttribute : Attribute
	{
		public readonly bool IncludesInternals;

		public NullablePublicOnlyAttribute(bool P_0)
		{
			IncludesInternals = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace System
{
	internal static class TypeExtensions
	{
		public static Type UnwrapEnumType(this Type type)
		{
			if (!type.IsEnum)
			{
				return type;
			}
			return Enum.GetUnderlyingType(type);
		}

		public static Type UnwrapNullableType(this Type type)
		{
			return Nullable.GetUnderlyingType(type) ?? type;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
	internal sealed class AllowNullAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
}
namespace SQLitePCL
{
	internal static class SQLitePCLExtensions
	{
		private static readonly Dictionary<string, bool> _knownLibraries = new Dictionary<string, bool>
		{
			{ "e_sqlcipher", true },
			{ "e_sqlite3", false },
			{ "e_sqlite3mc", true },
			{ "sqlcipher", true },
			{ "sqlite3mc", true },
			{ "winsqlite3", false }
		};

		public static bool? EncryptionSupported()
		{
			string libraryName;
			return EncryptionSupported(out libraryName);
		}

		public static bool? EncryptionSupported(out string libraryName)
		{
			libraryName = raw.GetNativeLibraryName();
			if (!_knownLibraries.TryGetValue(libraryName, out var value))
			{
				return null;
			}
			return value;
		}
	}
}
namespace Microsoft.Data.Sqlite
{
	internal static class SqliteConnectionExtensions
	{
		public static int ExecuteNonQuery(this SqliteConnection connection, string commandText, params SqliteParameter[] parameters)
		{
			using SqliteCommand sqliteCommand = connection.CreateCommand();
			sqliteCommand.CommandText = commandText;
			sqliteCommand.Parameters.AddRange(parameters);
			return sqliteCommand.ExecuteNonQuery();
		}

		public static T ExecuteScalar<T>(this SqliteConnection connection, string commandText, params SqliteParameter[] parameters)
		{
			return (T)connection.ExecuteScalar(commandText, parameters);
		}

		private static object ExecuteScalar(this SqliteConnection connection, string commandText, params SqliteParameter[] parameters)
		{
			using SqliteCommand sqliteCommand = connection.CreateCommand();
			sqliteCommand.CommandText = commandText;
			sqliteCommand.Parameters.AddRange(parameters);
			return sqliteCommand.ExecuteScalar();
		}
	}
	public class SqliteBlob : Stream
	{
		private sqlite3_blob _blob;

		private readonly SqliteConnection _connection;

		private long _position;

		public override bool CanRead => true;

		public override bool CanWrite { get; }

		public override bool CanSeek => true;

		public override long Length { get; }

		public override long Position
		{
			get
			{
				return _position;
			}
			set
			{
				if (value < 0)
				{
					throw new ArgumentOutOfRangeException("value", value, null);
				}
				_position = value;
			}
		}

		public SqliteBlob(SqliteConnection connection, string tableName, string columnName, long rowid, bool readOnly = false)
			: this(connection, "main", tableName, columnName, rowid, readOnly)
		{
		}

		public SqliteBlob(SqliteConnection connection, string databaseName, string tableName, string columnName, long rowid, bool readOnly = false)
		{
			if (connection == null || connection.State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.SqlBlobRequiresOpenConnection);
			}
			if (tableName == null)
			{
				throw new ArgumentNullException("tableName");
			}
			if (columnName == null)
			{
				throw new ArgumentNullException("columnName");
			}
			_connection = connection;
			CanWrite = !readOnly;
			SqliteException.ThrowExceptionForRC(raw.sqlite3_blob_open(_connection.Handle, databaseName, tableName, columnName, rowid, (!readOnly) ? 1 : 0, ref _blob), _connection.Handle);
			Length = raw.sqlite3_blob_bytes(_blob);
		}

		public override int Read(byte[] buffer, int offset, int count)
		{
			if (buffer == null)
			{
				throw new ArgumentNullException("buffer");
			}
			if (offset < 0)
			{
				throw new ArgumentOutOfRangeException("offset", offset, null);
			}
			if (count < 0)
			{
				throw new ArgumentOutOfRangeException("count", count, null);
			}
			if (offset + count > buffer.Length)
			{
				throw new ArgumentException(Resources.InvalidOffsetAndCount);
			}
			return Read(buffer.AsSpan(offset, count));
		}

		public new virtual int Read(Span<byte> buffer)
		{
			if (_blob == null)
			{
				throw new ObjectDisposedException(null);
			}
			long num = _position;
			if (num > Length)
			{
				num = Length;
			}
			int num2 = buffer.Length;
			if (num + num2 > Length)
			{
				num2 = (int)(Length - num);
			}
			if (num2 > 0)
			{
				SqliteException.ThrowExceptionForRC(raw.sqlite3_blob_read(_blob, buffer.Slice(0, num2), (int)num), _connection.Handle);
			}
			_position += num2;
			return num2;
		}

		public override void Write(byte[] buffer, int offset, int count)
		{
			if (buffer == null)
			{
				throw new ArgumentNullException("buffer");
			}
			if (offset < 0)
			{
				throw new ArgumentOutOfRangeException("offset", offset, null);
			}
			if (count < 0)
			{
				throw new ArgumentOutOfRangeException("count", count, null);
			}
			if (offset + count > buffer.Length)
			{
				throw new ArgumentException(Resources.InvalidOffsetAndCount);
			}
			if (_blob == null)
			{
				throw new ObjectDisposedException(null);
			}
			Write(buffer.AsSpan(offset, count));
		}

		public new virtual void Write(ReadOnlySpan<byte> buffer)
		{
			if (!CanWrite)
			{
				throw new NotSupportedException(Resources.WriteNotSupported);
			}
			long num = _position;
			if (num > Length)
			{
				num = Length;
			}
			int length = buffer.Length;
			if (num + length > Length)
			{
				throw new NotSupportedException(Resources.ResizeNotSupported);
			}
			if (length > 0)
			{
				SqliteException.ThrowExceptionForRC(raw.sqlite3_blob_write(_blob, buffer.Slice(0, length), (int)num), _connection.Handle);
			}
			_position += length;
		}

		public override long Seek(long offset, SeekOrigin origin)
		{
			long num = origin switch
			{
				SeekOrigin.Begin => offset, 
				SeekOrigin.Current => _position + offset, 
				SeekOrigin.End => Length + offset, 
				_ => throw new ArgumentException(Resources.InvalidEnumValue(typeof(SeekOrigin), origin), "origin"), 
			};
			if (num < 0)
			{
				throw new IOException(Resources.SeekBeforeBegin);
			}
			return _position = num;
		}

		protected override void Dispose(bool disposing)
		{
			if (_blob != null)
			{
				((SafeHandle)(object)_blob).Dispose();
				_blob = null;
			}
		}

		public override void Flush()
		{
		}

		public override void SetLength(long value)
		{
			throw new NotSupportedException(Resources.ResizeNotSupported);
		}
	}
	public enum SqliteCacheMode
	{
		Default,
		Private,
		Shared
	}
	public class SqliteCommand : DbCommand
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass54_0
		{
			public string name;

			internal bool <GetStatements>b__0(SqliteParameter p)
			{
				return p.ParameterName == name;
			}
		}

		[CompilerGenerated]
		private sealed class <GetStatements>d__54 : IEnumerable<sqlite3_stmt>, IEnumerable, IEnumerator<sqlite3_stmt>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private sqlite3_stmt <>2__current;

			private int <>l__initialThreadId;

			public SqliteCommand <>4__this;

			private IEnumerator<(sqlite3_stmt Statement, int ParamCount)> <>7__wrap1;

			sqlite3_stmt IEnumerator<sqlite3_stmt>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetStatements>d__54(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					int num = <>1__state;
					SqliteCommand sqliteCommand = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
					{
						<>1__state = -1;
						IEnumerable<(sqlite3_stmt Statement, int ParamCount)> enumerable;
						if (sqliteCommand._prepared)
						{
							IEnumerable<(sqlite3_stmt, int)> preparedStatements = sqliteCommand._preparedStatements;
							enumerable = preparedStatements;
						}
						else
						{
							enumerable = sqliteCommand.PrepareAndEnumerateStatements();
						}
						<>7__wrap1 = enumerable.GetEnumerator();
						<>1__state = -3;
						break;
					}
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						(sqlite3_stmt Statement, int ParamCount) current = <>7__wrap1.Current;
						sqlite3_stmt item = current.Statement;
						int item2 = current.ParamCount;
						int num2 = sqliteCommand._parameters?.Bind(item, sqliteCommand.Connection.Handle) ?? 0;
						if (item2 != num2)
						{
							List<string> list = new List<string>();
							for (int i = 1; i <= item2; i++)
							{
								<>c__DisplayClass54_0 CS$<>8__locals0 = new <>c__DisplayClass54_0();
								utf8z val = raw.sqlite3_bind_parameter_name(item, i);
								CS$<>8__locals0.name = ((utf8z)(ref val)).utf8_to_string();
								if (sqliteCommand._parameters != null && !sqliteCommand._parameters.Cast<SqliteParameter>().Any((SqliteParameter p) => p.ParameterName == CS$<>8__locals0.name))
								{
									list.Add(CS$<>8__locals0.name);
								}
							}
							if (raw.sqlite3_libversion_number() < 3028000 || raw.sqlite3_stmt_isexplain(item) == 0)
							{
								throw new InvalidOperationException(Resources.MissingParameters(string.Join(", ", list)));
							}
						}
						<>2__current = item;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<sqlite3_stmt> IEnumerable<sqlite3_stmt>.GetEnumerator()
			{
				<GetStatements>d__54 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <GetStatements>d__54(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<sqlite3_stmt>)this).GetEnumerator();
			}
		}

		[CompilerGenerated]
		private sealed class <PrepareAndEnumerateStatements>d__64 : IEnumerable<(sqlite3_stmt Statement, int ParamCount)>, IEnumerable, IEnumerator<(sqlite3_stmt Statement, int ParamCount)>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private (sqlite3_stmt Statement, int ParamCount) <>2__current;

			private int <>l__initialThreadId;

			public SqliteCommand <>4__this;

			private int <byteCount>5__2;

			private byte[] <sql>5__3;

			private TimeSpan <totalElapsedTime>5__4;

			private int <start>5__5;

			(sqlite3_stmt, int) IEnumerator<(sqlite3_stmt, int)>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <PrepareAndEnumerateStatements>d__64(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<sql>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				SqliteCommand sqliteCommand = <>4__this;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					goto IL_018f;
				}
				<>1__state = -1;
				sqliteCommand.DisposePreparedStatements(disposing: false);
				<byteCount>5__2 = Encoding.UTF8.GetByteCount(sqliteCommand._commandText);
				<sql>5__3 = new byte[<byteCount>5__2 + 1];
				Encoding.UTF8.GetBytes(sqliteCommand._commandText, 0, sqliteCommand._commandText.Length, <sql>5__3, 0);
				<totalElapsedTime>5__4 = TimeSpan.Zero;
				<start>5__5 = 0;
				goto IL_0087;
				IL_0087:
				SharedStopwatch sharedStopwatch = SharedStopwatch.StartNew();
				int rc;
				sqlite3_stmt val = default(sqlite3_stmt);
				ReadOnlySpan<byte> readOnlySpan = default(ReadOnlySpan<byte>);
				while (IsBusy(rc = raw.sqlite3_prepare_v2(sqliteCommand._connection.Handle, (ReadOnlySpan<byte>)<sql>5__3.AsSpan(<start>5__5), ref val, ref readOnlySpan)) && (sqliteCommand.CommandTimeout == 0 || !((<totalElapsedTime>5__4 + sharedStopwatch.Elapsed).TotalMilliseconds >= (double)((long)sqliteCommand.CommandTimeout * 1000L))))
				{
					Thread.Sleep(150);
				}
				<totalElapsedTime>5__4 += sharedStopwatch.Elapsed;
				<start>5__5 = <sql>5__3.Length - readOnlySpan.Length;
				SqliteException.ThrowExceptionForRC(rc, sqliteCommand._connection.Handle);
				if (((SafeHandle)(object)val).IsInvalid)
				{
					if (<start>5__5 < <byteCount>5__2)
					{
						goto IL_018f;
					}
					goto IL_01a0;
				}
				int item = raw.sqlite3_bind_parameter_count(val);
				(sqlite3_stmt, int) item2 = (val, item);
				sqliteCommand._preparedStatements.Add(item2);
				<>2__current = item2;
				<>1__state = 1;
				return true;
				IL_018f:
				if (<start>5__5 < <byteCount>5__2)
				{
					goto IL_0087;
				}
				goto IL_01a0;
				IL_01a0:
				sqliteCommand._prepared = true;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<(sqlite3_stmt Statement, int ParamCount)> IEnumerable<(sqlite3_stmt, int)>.GetEnumerator()
			{
				<PrepareAndEnumerateStatements>d__64 result;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					result = this;
				}
				else
				{
					result = new <PrepareAndEnumerateStatements>d__64(0)
					{
						<>4__this = <>4__this
					};
				}
				return result;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<(sqlite3_stmt, int)>)this).GetEnumerator();
			}
		}

		private SqliteParameterCollection _parameters;

		private readonly List<(sqlite3_stmt Statement, int ParamCount)> _preparedStatements = new List<(sqlite3_stmt, int)>(1);

		private SqliteConnection _connection;

		private string _commandText = string.Empty;

		private bool _prepared;

		private int? _commandTimeout;

		public override CommandType CommandType
		{
			get
			{
				return CommandType.Text;
			}
			set
			{
				if (value != CommandType.Text)
				{
					throw new ArgumentException(Resources.InvalidCommandType(value));
				}
			}
		}

		public override string CommandText
		{
			get
			{
				return _commandText;
			}
			[param: AllowNull]
			set
			{
				if (DataReader != null)
				{
					throw new InvalidOperationException(Resources.SetRequiresNoOpenReader("CommandText"));
				}
				if (value != _commandText)
				{
					DisposePreparedStatements();
					_commandText = value ?? string.Empty;
				}
			}
		}

		public new virtual SqliteConnection? Connection
		{
			get
			{
				return _connection;
			}
			set
			{
				if (DataReader != null)
				{
					throw new InvalidOperationException(Resources.SetRequiresNoOpenReader("Connection"));
				}
				if (value != _connection)
				{
					DisposePreparedStatements();
					_connection?.RemoveCommand(this);
					_connection = value;
					value?.AddCommand(this);
				}
			}
		}

		protected override DbConnection? DbConnection
		{
			get
			{
				return Connection;
			}
			set
			{
				Connection = (SqliteConnection)value;
			}
		}

		public new virtual SqliteTransaction? Transaction { get; set; }

		protected override DbTransaction? DbTransaction
		{
			get
			{
				return Transaction;
			}
			set
			{
				Transaction = (SqliteTransaction)value;
			}
		}

		public new virtual SqliteParameterCollection Parameters => _parameters ?? (_parameters = new SqliteParameterCollection());

		protected override DbParameterCollection DbParameterCollection => Parameters;

		public override int CommandTimeout
		{
			get
			{
				return _commandTimeout ?? _connection?.DefaultTimeout ?? 30;
			}
			set
			{
				_commandTimeout = value;
			}
		}

		public override bool DesignTimeVisible { get; set; }

		public override UpdateRowSource UpdatedRowSource { get; set; }

		protected internal virtual SqliteDataReader? DataReader { get; set; }

		public SqliteCommand()
		{
		}

		public SqliteCommand(string? commandText)
		{
			CommandText = commandText;
		}

		public SqliteCommand(string? commandText, SqliteConnection? connection)
			: this(commandText)
		{
			Connection = connection;
		}

		public SqliteCommand(string? commandText, SqliteConnection? connection, SqliteTransaction? transaction)
			: this(commandText, connection)
		{
			Transaction = transaction;
		}

		protected override void Dispose(bool disposing)
		{
			DisposePreparedStatements(disposing);
			if (disposing)
			{
				_connection?.RemoveCommand(this);
			}
			base.Dispose(disposing);
		}

		public new virtual SqliteParameter CreateParameter()
		{
			return new SqliteParameter();
		}

		protected override DbParameter CreateDbParameter()
		{
			return CreateParameter();
		}

		public override void Prepare()
		{
			SqliteConnection connection = _connection;
			if (connection == null || connection.State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.CallRequiresOpenConnection("Prepare"));
			}
			if (_prepared)
			{
				return;
			}
			using IEnumerator<(sqlite3_stmt, int)> enumerator = PrepareAndEnumerateStatements().GetEnumerator();
			while (enumerator.MoveNext())
			{
			}
		}

		public new virtual SqliteDataReader ExecuteReader()
		{
			return ExecuteReader(CommandBehavior.Default);
		}

		public new virtual SqliteDataReader ExecuteReader(CommandBehavior behavior)
		{
			if (DataReader != null)
			{
				throw new InvalidOperationException(Resources.DataReaderOpen);
			}
			SqliteConnection connection = _connection;
			if (connection == null || connection.State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.CallRequiresOpenConnection("ExecuteReader"));
			}
			if (Transaction != _connection.Transaction)
			{
				throw new InvalidOperationException((Transaction == null) ? Resources.TransactionRequired : Resources.TransactionConnectionMismatch);
			}
			SqliteTransaction? transaction = _connection.Transaction;
			if (transaction != null && transaction.ExternalRollback)
			{
				throw new InvalidOperationException(Resources.TransactionCompleted);
			}
			bool closeConnection = behavior.HasFlag(CommandBehavior.CloseConnection);
			SqliteDataReader sqliteDataReader = new SqliteDataReader(this, GetStatements(), closeConnection);
			sqliteDataReader.NextResult();
			return DataReader = sqliteDataReader;
		}

		[IteratorStateMachine(typeof(<GetStatements>d__54))]
		private IEnumerable<sqlite3_stmt> GetStatements()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetStatements>d__54(-2)
			{
				<>4__this = this
			};
		}

		protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
		{
			return ExecuteReader(behavior);
		}

		public new virtual Task<SqliteDataReader> ExecuteReaderAsync()
		{
			return ExecuteReaderAsync(CommandBehavior.Default, CancellationToken.None);
		}

		public new virtual Task<SqliteDataReader> ExecuteReaderAsync(CancellationToken cancellationToken)
		{
			return ExecuteReaderAsync(CommandBehavior.Default, cancellationToken);
		}

		public new virtual Task<SqliteDataReader> ExecuteReaderAsync(CommandBehavior behavior)
		{
			return ExecuteReaderAsync(behavior, CancellationToken.None);
		}

		public new virtual Task<SqliteDataReader> ExecuteReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
		{
			cancellationToken.ThrowIfCancellationRequested();
			return Task.FromResult(ExecuteReader(behavior));
		}

		protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
		{
			return await ExecuteReaderAsync(behavior, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
		}

		public override int ExecuteNonQuery()
		{
			SqliteConnection connection = _connection;
			if (connection == null || connection.State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.CallRequiresOpenConnection("ExecuteNonQuery"));
			}
			SqliteDataReader sqliteDataReader = ExecuteReader();
			sqliteDataReader.Dispose();
			return sqliteDataReader.RecordsAffected;
		}

		public override object? ExecuteScalar()
		{
			SqliteConnection connection = _connection;
			if (connection == null || connection.State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.CallRequiresOpenConnection("ExecuteScalar"));
			}
			using SqliteDataReader sqliteDataReader = ExecuteReader();
			return sqliteDataReader.Read() ? sqliteDataReader.GetValue(0) : null;
		}

		public override void Cancel()
		{
		}

		[IteratorStateMachine(typeof(<PrepareAndEnumerateStatements>d__64))]
		private IEnumerable<(sqlite3_stmt Statement, int ParamCount)> PrepareAndEnumerateStatements()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <PrepareAndEnumerateStatements>d__64(-2)
			{
				<>4__this = this
			};
		}

		private void DisposePreparedStatements(bool disposing = true)
		{
			if (disposing && DataReader != null)
			{
				DataReader.Dispose();
				DataReader = null;
			}
			if (_preparedStatements != null)
			{
				foreach (var preparedStatement in _preparedStatements)
				{
					((SafeHandle)(object)preparedStatement.Statement).Dispose();
				}
				_preparedStatements.Clear();
			}
			_prepared = false;
		}

		private static bool IsBusy(int rc)
		{
			if ((uint)(rc - 5) <= 1u || rc == 262)
			{
				return true;
			}
			return false;
		}
	}
	public class SqliteConnection : DbConnection
	{
		private sealed class AggregateDefinition<TAccumulate, TResult>
		{
			public string Name { get; }

			public TAccumulate Seed { get; }

			public Func<TAccumulate, SqliteValueReader, TAccumulate> Func { get; }

			public Func<TAccumulate, TResult> ResultSelector { get; }

			public AggregateDefinition(string name, TAccumulate seed, Func<TAccumulate, SqliteValueReader, TAccumulate> func, Func<TAccumulate, TResult> resultSelector)
			{
				Name = name;
				Seed = seed;
				Func = func;
				ResultSelector = resultSelector;
				base..ctor();
			}
		}

		private sealed class AggregateContext<T>
		{
			public T Accumulate { get; set; }

			public Exception Exception { get; set; }

			public AggregateContext(T seed)
			{
				Accumulate = seed;
				base..ctor();
			}
		}

		private sealed class FunctionsKeyComparer : IEqualityComparer<(string name, int arity)>
		{
			public static readonly FunctionsKeyComparer Instance = new FunctionsKeyComparer();

			public bool Equals((string name, int arity) x, (string name, int arity) y)
			{
				if (StringComparer.OrdinalIgnoreCase.Equals(x.name, y.name))
				{
					return x.arity == y.arity;
				}
				return false;
			}

			public int GetHashCode((string name, int arity) obj)
			{
				int hashCode = StringComparer.OrdinalIgnoreCase.GetHashCode(obj.name);
				int hashCode2 = obj.arity.GetHashCode();
				return (((hashCode << 5) | (hashCode >>> 27)) + hashCode) ^ hashCode2;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c__162<TAccumulate, TResult>
		{
			public static readonly <>c__162<TAccumulate, TResult> <>9 = new <>c__162<TAccumulate, TResult>();

			public static delegate_function_aggregate_step <>9__162_0;

			public static delegate_function_aggregate_final <>9__162_1;

			internal void <CreateAggregateCore>b__162_0(sqlite3_context ctx, object user_data, sqlite3_value[] args)
			{
				AggregateDefinition<TAccumulate, TResult> aggregateDefinition = (AggregateDefinition<TAccumulate, TResult>)user_data;
				if (ctx.state == null)
				{
					ctx.state = new AggregateContext<TAccumulate>(aggregateDefinition.Seed);
				}
				AggregateContext<TAccumulate> aggregateContext = (AggregateContext<TAccumulate>)ctx.state;
				if (aggregateContext.Exception != null)
				{
					return;
				}
				SqliteParameterReader arg = new SqliteParameterReader(aggregateDefinition.Name, args);
				try
				{
					aggregateContext.Accumulate = aggregateDefinition.Func(aggregateContext.Accumulate, arg);
				}
				catch (Exception exception)
				{
					aggregateContext.Exception = exception;
				}
			}

			internal void <CreateAggregateCore>b__162_1(sqlite3_context ctx, object user_data)
			{
				AggregateDefinition<TAccumulate, TResult> aggregateDefinition = (AggregateDefinition<TAccumulate, TResult>)user_data;
				if (ctx.state == null)
				{
					ctx.state = new AggregateContext<TAccumulate>(aggregateDefinition.Seed);
				}
				AggregateContext<TAccumulate> aggregateContext = (AggregateContext<TAccumulate>)ctx.state;
				if (aggregateContext.Exception == null)
				{
					try
					{
						TResult val = aggregateDefinition.ResultSelector(aggregateContext.Accumulate);
						new SqliteResultBinder(ctx, val).Bind();
					}
					catch (Exception exception)
					{
						aggregateContext.Exception = exception;
					}
				}
				if (aggregateContext.Exception != null)
				{
					raw.sqlite3_result_error(ctx, aggregateContext.Exception.Message);
					if (aggregateContext.Exception is SqliteException ex)
					{
						raw.sqlite3_result_error_code(ctx, ex.SqliteErrorCode);
					}
				}
			}
		}

		[CompilerGenerated]
		private sealed class <GetLoadExtensionPaths>d__154 : IEnumerable<string>, IEnumerable, IEnumerator<string>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private string <>2__current;

			private int <>l__initialThreadId;

			private string file;

			public string <>3__file;

			private bool <shouldTryAddingLibPrefix>5__2;

			private string[] <>7__wrap2;

			private int <>7__wrap3;

			private string <dir>5__5;

			string IEnumerator<string>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetLoadExtensionPaths>d__154(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap2 = null;
				<dir>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = file;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!string.IsNullOrEmpty(Path.GetDirectoryName(file)))
					{
						return false;
					}
					<shouldTryAddingLibPrefix>5__2 = !file.StartsWith("lib", StringComparison.Ordinal) && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
					if (<shouldTryAddingLibPrefix>5__2)
					{
						<>2__current = "lib" + file;
						<>1__state = 2;
						return true;
					}
					goto IL_00b1;
				case 2:
					<>1__state = -1;
					goto IL_00b1;
				case 3:
					<>1__state = -1;
					if (<shouldTryAddingLibPrefix>5__2)
					{
						<>2__current = Path.Combine(<dir>5__5, "lib" + file);
						<>1__state = 4;
						return true;
					}
					goto IL_014c;
				case 4:
					{
						<>1__state = -1;
						goto IL_014c;
					}
					IL_00b1:
					if (NativeDllSearchDirectories == null)
					{
						NativeDllSearchDirectories = GetNativeDllSearchDirectories();
					}
					<>7__wrap2 = NativeDllSearchDirectories;
					<>7__wrap3 = 0;
					break;
					IL_014c:
					<dir>5__5 = null;
					<>7__wrap3++;
					break;
				}
				if (<>7__wrap3 < <>7__wrap2.Length)
				{
					<dir>5__5 = <>7__wrap2[<>7__wrap3];
					<>2__current = Path.Combine(<dir>5__5, file);
					<>1__state = 3;
					return true;
				}
				<>7__wrap2 = null;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<string> IEnumerable<string>.GetEnumerator()
			{
				<GetLoadExtensionPaths>d__154 <GetLoadExtensionPaths>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<GetLoadExtensionPaths>d__ = this;
				}
				else
				{
					<GetLoadExtensionPaths>d__ = new <GetLoadExtensionPaths>d__154(0);
				}
				<GetLoadExtensionPaths>d__.file = <>3__file;
				return <GetLoadExtensionPaths>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<string>)this).GetEnumerator();
			}
		}

		internal const string MainDatabaseName = "main";

		private const int SQLITE_WIN32_DATA_DIRECTORY_TYPE = 1;

		private const int SQLITE_WIN32_TEMP_DIRECTORY_TYPE = 2;

		private readonly List<WeakReference<SqliteCommand>> _commands = new List<WeakReference<SqliteCommand>>();

		private Dictionary<string, (object state, strdelegate_collation collation)> _collations;

		private Dictionary<(string name, int arity), (int flags, object state, delegate_function_scalar func)> _functions;

		private Dictionary<(string name, int arity), (int flags, object state, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)> _aggregates;

		private HashSet<(string file, string proc)> _extensions;

		private string _connectionString;

		private ConnectionState _state;

		private SqliteConnectionInternal _innerConnection;

		private bool _extensionsEnabled;

		private int? _defaultTimeout;

		private static readonly StateChangeEventArgs _fromClosedToOpenEventArgs;

		private static readonly StateChangeEventArgs _fromOpenToClosedEventArgs;

		private static string[] NativeDllSearchDirectories;

		public virtual sqlite3? Handle => _innerConnection?.Handle;

		public override string ConnectionString
		{
			get
			{
				return _connectionString;
			}
			[MemberNotNull(new string[] { "_connectionString", "PoolGroup" })]
			[param: AllowNull]
			set
			{
				if (State != 0)
				{
					throw new InvalidOperationException(Resources.ConnectionStringRequiresClosedConnection);
				}
				_connectionString = value ?? string.Empty;
				PoolGroup = SqliteConnectionFactory.Instance.GetPoolGroup(_connectionString);
			}
		}

		internal SqliteConnectionPoolGroup PoolGroup { get; set; }

		internal SqliteConnectionStringBuilder ConnectionOptions => PoolGroup.ConnectionOptions;

		public override string Database => "main";

		public override string DataSource
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				string text = null;
				if (State == ConnectionState.Open)
				{
					utf8z val = raw.sqlite3_db_filename(Handle, "main");
					text = ((utf8z)(ref val)).utf8_to_string();
				}
				return text ?? ConnectionOptions.DataSource;
			}
		}

		public virtual int DefaultTimeout
		{
			get
			{
				return _defaultTimeout ?? ConnectionOptions.DefaultTimeout;
			}
			set
			{
				_defaultTimeout = value;
			}
		}

		public override string ServerVersion
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				utf8z val = raw.sqlite3_libversion();
				return ((utf8z)(ref val)).utf8_to_string();
			}
		}

		public override ConnectionState State => _state;

		protected override DbProviderFactory DbProviderFactory => SqliteFactory.Instance;

		protected internal virtual SqliteTransaction? Transaction { get; set; }

		public virtual void CreateAggregate<TAccumulate>(string name, Func<TAccumulate?, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, TAccumulate> func2 = func;
			CreateAggregateCore(name, 0, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a)), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, TAccumulate>(string name, Func<TAccumulate?, T1, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, TAccumulate> func2 = func;
			CreateAggregateCore(name, 1, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, TAccumulate>(string name, Func<TAccumulate?, T1, T2, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, TAccumulate> func2 = func;
			CreateAggregateCore(name, 2, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, TAccumulate> func2 = func;
			CreateAggregateCore(name, 3, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, TAccumulate> func2 = func;
			CreateAggregateCore(name, 4, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, TAccumulate> func2 = func;
			CreateAggregateCore(name, 5, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, TAccumulate> func2 = func;
			CreateAggregateCore(name, 6, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, TAccumulate> func2 = func;
			CreateAggregateCore(name, 7, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate> func2 = func;
			CreateAggregateCore(name, 8, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate> func2 = func;
			CreateAggregateCore(name, 9, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate> func2 = func;
			CreateAggregateCore(name, 10, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate> func2 = func;
			CreateAggregateCore(name, 11, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate> func2 = func;
			CreateAggregateCore(name, 12, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate> func2 = func;
			CreateAggregateCore(name, 13, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate> func2 = func;
			CreateAggregateCore(name, 14, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate>(string name, Func<TAccumulate?, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate> func2 = func;
			CreateAggregateCore(name, 15, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<TAccumulate>(string name, Func<TAccumulate?, object?[], TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, object[], TAccumulate> func2 = func;
			CreateAggregateCore(name, -1, default(TAccumulate), IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, GetValues(r))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, TAccumulate> func2 = func;
			CreateAggregateCore(name, 0, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a)), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, TAccumulate> func2 = func;
			CreateAggregateCore(name, 1, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, TAccumulate> func2 = func;
			CreateAggregateCore(name, 2, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, TAccumulate> func2 = func;
			CreateAggregateCore(name, 3, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, TAccumulate> func2 = func;
			CreateAggregateCore(name, 4, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, TAccumulate> func2 = func;
			CreateAggregateCore(name, 5, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, TAccumulate> func2 = func;
			CreateAggregateCore(name, 6, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, TAccumulate> func2 = func;
			CreateAggregateCore(name, 7, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate> func2 = func;
			CreateAggregateCore(name, 8, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate> func2 = func;
			CreateAggregateCore(name, 9, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate> func2 = func;
			CreateAggregateCore(name, 10, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate> func2 = func;
			CreateAggregateCore(name, 11, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate> func2 = func;
			CreateAggregateCore(name, 12, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate> func2 = func;
			CreateAggregateCore(name, 13, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate> func2 = func;
			CreateAggregateCore(name, 14, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate> func2 = func;
			CreateAggregateCore(name, 15, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<TAccumulate>(string name, TAccumulate seed, Func<TAccumulate, object?[], TAccumulate>? func, bool isDeterministic = false)
		{
			Func<TAccumulate, object[], TAccumulate> func2 = func;
			CreateAggregateCore(name, -1, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, GetValues(r))), (TAccumulate a) => a, isDeterministic);
		}

		public virtual void CreateAggregate<TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 0, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a)), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 1, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 2, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 3, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 4, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 5, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 6, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 7, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 8, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 9, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 10, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 11, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 12, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 13, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 14, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, 15, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14))), resultSelector, isDeterministic);
		}

		public virtual void CreateAggregate<TAccumulate, TResult>(string name, TAccumulate seed, Func<TAccumulate, object?[], TAccumulate>? func, Func<TAccumulate, TResult>? resultSelector, bool isDeterministic = false)
		{
			Func<TAccumulate, object[], TAccumulate> func2 = func;
			CreateAggregateCore<TAccumulate, TResult>(name, -1, seed, IfNotNull(func2, (TAccumulate a, SqliteValueReader r) => func2(a, GetValues(r))), resultSelector, isDeterministic);
		}

		public virtual void CreateFunction<TResult>(string name, Func<TResult>? function, bool isDeterministic = false)
		{
			Func<TResult> function2 = function;
			CreateFunctionCore(name, 0, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2()), isDeterministic);
		}

		public virtual void CreateFunction<T1, TResult>(string name, Func<T1, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, TResult> function2 = function;
			CreateFunctionCore(name, 1, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, TResult>(string name, Func<T1, T2, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, TResult> function2 = function;
			CreateFunctionCore(name, 2, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, TResult>(string name, Func<T1, T2, T3, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, TResult> function2 = function;
			CreateFunctionCore(name, 3, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, TResult>(string name, Func<T1, T2, T3, T4, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, TResult> function2 = function;
			CreateFunctionCore(name, 4, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, TResult>(string name, Func<T1, T2, T3, T4, T5, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, TResult> function2 = function;
			CreateFunctionCore(name, 5, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, TResult> function2 = function;
			CreateFunctionCore(name, 6, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, TResult> function2 = function;
			CreateFunctionCore(name, 7, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> function2 = function;
			CreateFunctionCore(name, 8, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function2 = function;
			CreateFunctionCore(name, 9, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function2 = function;
			CreateFunctionCore(name, 10, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function2 = function;
			CreateFunctionCore(name, 11, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function2 = function;
			CreateFunctionCore(name, 12, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function2 = function;
			CreateFunctionCore(name, 13, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function2 = function;
			CreateFunctionCore(name, 14, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function2 = function;
			CreateFunctionCore(name, 15, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14))), isDeterministic);
		}

		public virtual void CreateFunction<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult>? function, bool isDeterministic = false)
		{
			Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, TResult> function2 = function;
			CreateFunctionCore(name, 16, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14), r.GetFieldValue<T16>(15))), isDeterministic);
		}

		public virtual void CreateFunction<TResult>(string name, Func<object?[], TResult>? function, bool isDeterministic = false)
		{
			Func<object[], TResult> function2 = function;
			CreateFunctionCore(name, -1, null, IfNotNull(function2, (object s, SqliteValueReader r) => function2(GetValues(r))), isDeterministic);
		}

		public virtual void CreateFunction<TState, TResult>(string name, TState state, Func<TState, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, TResult> function2 = function;
			CreateFunctionCore(name, 0, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s)), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, TResult>(string name, TState state, Func<TState, T1, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, TResult> function2 = function;
			CreateFunctionCore(name, 1, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, TResult>(string name, TState state, Func<TState, T1, T2, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, TResult> function2 = function;
			CreateFunctionCore(name, 2, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, TResult>(string name, TState state, Func<TState, T1, T2, T3, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, TResult> function2 = function;
			CreateFunctionCore(name, 3, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, TResult> function2 = function;
			CreateFunctionCore(name, 4, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, TResult> function2 = function;
			CreateFunctionCore(name, 5, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, TResult> function2 = function;
			CreateFunctionCore(name, 6, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, TResult> function2 = function;
			CreateFunctionCore(name, 7, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, TResult> function2 = function;
			CreateFunctionCore(name, 8, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, TResult> function2 = function;
			CreateFunctionCore(name, 9, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, TResult> function2 = function;
			CreateFunctionCore(name, 10, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, TResult> function2 = function;
			CreateFunctionCore(name, 11, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, TResult> function2 = function;
			CreateFunctionCore(name, 12, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, TResult> function2 = function;
			CreateFunctionCore(name, 13, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, TResult> function2 = function;
			CreateFunctionCore(name, 14, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13))), isDeterministic);
		}

		public virtual void CreateFunction<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>(string name, TState state, Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult>? function, bool isDeterministic = false)
		{
			Func<TState, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, TResult> function2 = function;
			CreateFunctionCore(name, 15, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, r.GetFieldValue<T1>(0), r.GetFieldValue<T2>(1), r.GetFieldValue<T3>(2), r.GetFieldValue<T4>(3), r.GetFieldValue<T5>(4), r.GetFieldValue<T6>(5), r.GetFieldValue<T7>(6), r.GetFieldValue<T8>(7), r.GetFieldValue<T9>(8), r.GetFieldValue<T10>(9), r.GetFieldValue<T11>(10), r.GetFieldValue<T12>(11), r.GetFieldValue<T13>(12), r.GetFieldValue<T14>(13), r.GetFieldValue<T15>(14))), isDeterministic);
		}

		public virtual void CreateFunction<TState, TResult>(string name, TState state, Func<TState, object?[], TResult>? function, bool isDeterministic = false)
		{
			Func<TState, object[], TResult> function2 = function;
			CreateFunctionCore(name, -1, state, IfNotNull(function2, (TState s, SqliteValueReader r) => function2(s, GetValues(r))), isDeterministic);
		}

		static SqliteConnection()
		{
			_fromClosedToOpenEventArgs = new StateChangeEventArgs(ConnectionState.Closed, ConnectionState.Open);
			_fromOpenToClosedEventArgs = new StateChangeEventArgs(ConnectionState.Open, ConnectionState.Closed);
			Type.GetType("SQLitePCL.Batteries_V2, SQLitePCLRaw.batteries_v2")?.GetRuntimeMethod("Init", Type.EmptyTypes)?.Invoke(null, null);
			if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
			{
				return;
			}
			Type type = null;
			Type type2 = null;
			try
			{
				type = Type.GetType("Windows.Storage.ApplicationData, Windows, ContentType=WindowsRuntime") ?? Type.GetType("Windows.Storage.ApplicationData, Microsoft.Windows.SDK.NET");
				type2 = Type.GetType("Windows.Storage.StorageFolder, Windows, ContentType=WindowsRuntime") ?? Type.GetType("Windows.Storage.StorageFolder, Microsoft.Windows.SDK.NET");
			}
			catch
			{
			}
			object obj2 = null;
			try
			{
				obj2 = type?.GetRuntimeProperty("Current")?.GetValue(null);
			}
			catch (TargetInvocationException)
			{
			}
			if (obj2 != null)
			{
				object obj3 = type?.GetRuntimeProperty("LocalFolder")?.GetValue(obj2);
				string text = (string)type2?.GetRuntimeProperty("Path")?.GetValue(obj3);
				if (text != null)
				{
					raw.sqlite3_win32_set_directory(1, text);
				}
				object obj4 = type?.GetRuntimeProperty("TemporaryFolder")?.GetValue(obj2);
				string text2 = (string)type2?.GetRuntimeProperty("Path")?.GetValue(obj4);
				if (text2 != null)
				{
					raw.sqlite3_win32_set_directory(2, text2);
				}
			}
		}

		public SqliteConnection()
			: this(null)
		{
		}

		public SqliteConnection(string? connectionString)
		{
			ConnectionString = connectionString;
		}

		public static void ClearAllPools()
		{
			SqliteConnectionFactory.Instance.ClearPools();
		}

		public static void ClearPool(SqliteConnection connection)
		{
			connection.PoolGroup.Clear();
		}

		public override void Open()
		{
			if (State == ConnectionState.Open)
			{
				return;
			}
			_innerConnection = SqliteConnectionFactory.Instance.GetConnection(this);
			_state = ConnectionState.Open;
			try
			{
				if (ConnectionOptions.ForeignKeys.HasValue)
				{
					this.ExecuteNonQuery("PRAGMA foreign_keys = " + (ConnectionOptions.ForeignKeys.Value ? "1" : "0") + ";");
				}
				if (ConnectionOptions.RecursiveTriggers)
				{
					this.ExecuteNonQuery("PRAGMA recursive_triggers = 1;");
				}
				if (_collations != null)
				{
					foreach (KeyValuePair<string, (object, strdelegate_collation)> collation in _collations)
					{
						SqliteException.ThrowExceptionForRC(raw.sqlite3_create_collation(Handle, collation.Key, collation.Value.Item1, collation.Value.Item2), Handle);
					}
				}
				if (_functions != null)
				{
					foreach (KeyValuePair<(string, int), (int, object, delegate_function_scalar)> function in _functions)
					{
						SqliteException.ThrowExceptionForRC(raw.sqlite3_create_function(Handle, function.Key.Item1, function.Key.Item2, function.Value.Item2, function.Value.Item3), Handle);
					}
				}
				if (_aggregates != null)
				{
					foreach (KeyValuePair<(string, int), (int, object, delegate_function_aggregate_step, delegate_function_aggregate_final)> aggregate in _aggregates)
					{
						SqliteException.ThrowExceptionForRC(raw.sqlite3_create_function(Handle, aggregate.Key.Item1, aggregate.Key.Item2, aggregate.Value.Item2, aggregate.Value.Item3, aggregate.Value.Item4), Handle);
					}
				}
				if (_extensions != null && _extensions.Count != 0)
				{
					int num = default(int);
					SqliteException.ThrowExceptionForRC(raw.sqlite3_db_config(Handle, 1005, 1, ref num), Handle);
					foreach (var extension in _extensions)
					{
						LoadExtensionCore(extension.file, extension.proc);
					}
				}
				if (_extensionsEnabled)
				{
					SqliteException.ThrowExceptionForRC(raw.sqlite3_enable_load_extension(Handle, _extensionsEnabled ? 1 : 0), Handle);
				}
			}
			catch
			{
				_innerConnection.Close();
				_innerConnection = null;
				_state = ConnectionState.Closed;
				throw;
			}
			OnStateChange(_fromClosedToOpenEventArgs);
		}

		public override void Close()
		{
			if (State != ConnectionState.Open)
			{
				return;
			}
			Transaction?.Dispose();
			List<WeakReference<SqliteCommand>> commands = _commands;
			for (int num = commands.Count - 1; num >= 0; num--)
			{
				if (commands[num].TryGetTarget(out var target))
				{
					target.Dispose();
				}
			}
			_commands.Clear();
			_innerConnection.Close();
			_innerConnection = null;
			_state = ConnectionState.Closed;
			OnStateChange(_fromOpenToClosedEventArgs);
		}

		internal void Deactivate()
		{
			if (_collations != null)
			{
				foreach (string key in _collations.Keys)
				{
					SqliteException.ThrowExceptionForRC(raw.sqlite3_create_collation(Handle, key, (object)null, (strdelegate_collation)null), Handle);
				}
			}
			if (_functions != null)
			{
				foreach (var (text, num) in _functions.Keys)
				{
					SqliteException.ThrowExceptionForRC(raw.sqlite3_create_function(Handle, text, num, (object)null, (delegate_function_scalar)null), Handle);
				}
			}
			if (_aggregates != null)
			{
				foreach (var (text2, num2) in _aggregates.Keys)
				{
					SqliteException.ThrowExceptionForRC(raw.sqlite3_create_function(Handle, text2, num2, (object)null, (delegate_function_aggregate_step)null, (delegate_function_aggregate_final)null), Handle);
				}
			}
			if (_extensionsEnabled)
			{
				SqliteException.ThrowExceptionForRC(raw.sqlite3_enable_load_extension(Handle, 0), Handle);
			}
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				Close();
			}
			base.Dispose(disposing);
		}

		public new virtual SqliteCommand CreateCommand()
		{
			return new SqliteCommand
			{
				Connection = this,
				CommandTimeout = DefaultTimeout,
				Transaction = Transaction
			};
		}

		protected override DbCommand CreateDbCommand()
		{
			return CreateCommand();
		}

		internal void AddCommand(SqliteCommand command)
		{
			_commands.Add(new WeakReference<SqliteCommand>(command));
		}

		internal void RemoveCommand(SqliteCommand command)
		{
			for (int num = _commands.Count - 1; num >= 0; num--)
			{
				WeakReference<SqliteCommand> weakReference = _commands[num];
				if (weakReference != null && weakReference.TryGetTarget(out var target) && target == command)
				{
					_commands.RemoveAt(num);
				}
			}
		}

		public virtual void CreateCollation(string name, Comparison<string>? comparison)
		{
			Comparison<string> comparison2 = comparison;
			CreateCollation(name, null, (comparison2 != null) ? ((Func<object, string, string, int>)((object _, string s1, string s2) => comparison2(s1, s2))) : null);
		}

		public virtual void CreateCollation<T>(string name, T state, Func<T, string, string, int>? comparison)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Func<T, string, string, int> comparison2 = comparison;
			if (string.IsNullOrEmpty(name))
			{
				throw new ArgumentNullException("name");
			}
			strdelegate_collation val = ((comparison2 == null) ? ((strdelegate_collation)null) : ((strdelegate_collation)((object v, string s1, string s2) => comparison2((T)v, s1, s2))));
			if (State == ConnectionState.Open)
			{
				SqliteException.ThrowExceptionForRC(raw.sqlite3_create_collation(Handle, name, (object)state, val), Handle);
			}
			if (_collations == null)
			{
				_collations = new Dictionary<string, (object, strdelegate_collation)>(StringComparer.OrdinalIgnoreCase);
			}
			_collations[name] = (state, val);
		}

		public new virtual SqliteTransaction BeginTransaction()
		{
			return BeginTransaction(IsolationLevel.Unspecified);
		}

		public virtual SqliteTransaction BeginTransaction(bool deferred)
		{
			return BeginTransaction(IsolationLevel.Unspecified, deferred);
		}

		protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
		{
			return BeginTransaction(isolationLevel);
		}

		public new virtual SqliteTransaction BeginTransaction(IsolationLevel isolationLevel)
		{
			return BeginTransaction(isolationLevel, isolationLevel == IsolationLevel.ReadUncommitted);
		}

		public virtual SqliteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferred)
		{
			if (State != ConnectionState.Open)
			{
				throw new InvalidOperationException(Resources.CallRequiresOpenConnection("BeginTransaction"));
			}
			if (Transaction != null)
			{
				throw new InvalidOperationException(Resources.ParallelTransactionsNotSupported);
			}
			return Transaction = new SqliteTransaction(this, isolationLevel, deferred);
		}

		public override void ChangeDatabase(string databaseName)
		{
			throw new NotSupportedException();
		}

		public virtual void EnableExtensions(bool enable = true)
		{
			if (State == ConnectionState.Open)
			{
				SqliteException.ThrowExceptionForRC(raw.sqlite3_enable_load_extension(Handle, enable ? 1 : 0), Handle);
			}
			_extensionsEnabled = enable;
		}

		public virtual void LoadExtension(string file, string? proc = null)
		{
			if (State == ConnectionState.Open)
			{
				if (!_extensionsEnabled)
				{
					int num = default(int);
					SqliteException.ThrowExceptionForRC(raw.sqlite3_db_config(Handle, 1005, 1, ref num), Handle);
				}
				LoadExtensionCore(file, proc);
			}
			if (_extensions == null)
			{
				_extensions = new HashSet<(string, string)>();
			}
			_extensions.Add((file, proc));
		}

		private void LoadExtensionCore(string file, string proc)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			SqliteException ex = null;
			utf8z val = default(utf8z);
			foreach (string loadExtensionPath in GetLoadExtensionPaths(file))
			{
				int num = raw.sqlite3_load_extension(Handle, utf8z.FromString(loadExtensionPath), utf8z.FromString(proc), ref val);
				if (num == 0)
				{
					return;
				}
				if (ex == null)
				{
					ex = new SqliteException(Resources.SqliteNativeError(num, ((utf8z)(ref val)).utf8_to_string()), num, num);
				}
			}
			if (ex != null

plugins/UKSQLite/SQLitePCLRaw.batteries_v2.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SourceGear")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2014-2025 SourceGear, LLC")]
[assembly: AssemblyDescription("SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite")]
[assembly: AssemblyFileVersion("3.0.2.2801")]
[assembly: AssemblyInformationalVersion("3.0.2+ca83fcd795385c6ac99b0f9680d000f27f35c1b4")]
[assembly: AssemblyTitle("SQLitePCLRaw.batteries_v2")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ericsink/SQLitePCL.raw")]
[assembly: AssemblyVersion("3.0.2.2801")]
namespace SQLitePCL;

public static class Batteries
{
	public static void Init()
	{
		Batteries_V2.Init();
	}
}
public static class Batteries_V2
{
	public static void Init()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		raw.SetProvider((ISQLite3Provider)new SQLite3Provider_e_sqlite3());
	}
}

plugins/UKSQLite/SQLitePCLRaw.core.dll

Decompiled 3 days ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SourceGear")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2014-2025 SourceGear, LLC")]
[assembly: AssemblyDescription("SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite")]
[assembly: AssemblyFileVersion("3.0.2.2801")]
[assembly: AssemblyInformationalVersion("3.0.2+ca83fcd795385c6ac99b0f9680d000f27f35c1b4")]
[assembly: AssemblyTitle("SQLitePCLRaw.core")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ericsink/SQLitePCL.raw")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.2.2801")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsReadOnlyAttribute : Attribute
	{
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class IsByRefLikeAttribute : Attribute
	{
	}
}
namespace SQLitePCL
{
	public delegate int strdelegate_collation(object user_data, string s1, string s2);
	public delegate void strdelegate_update(object user_data, int type, string database, string table, long rowid);
	public delegate void strdelegate_log(object user_data, int errorCode, string msg);
	public delegate int strdelegate_authorizer(object user_data, int action_code, string param0, string param1, string dbName, string inner_most_trigger_or_view);
	public delegate void strdelegate_trace(object user_data, string s);
	public delegate void strdelegate_profile(object user_data, string statement, long ns);
	public delegate int strdelegate_exec(object user_data, string[] values, string[] names);
	public static class raw
	{
		private static ISQLite3Provider _imp;

		private static bool _frozen;

		public const int SQLITE_UTF8 = 1;

		public const int SQLITE_UTF16LE = 2;

		public const int SQLITE_UTF16BE = 3;

		public const int SQLITE_UTF16 = 4;

		public const int SQLITE_ANY = 5;

		public const int SQLITE_UTF16_ALIGNED = 8;

		public const int SQLITE_DETERMINISTIC = 2048;

		public const int SQLITE_LIMIT_LENGTH = 0;

		public const int SQLITE_LIMIT_SQL_LENGTH = 1;

		public const int SQLITE_LIMIT_COLUMN = 2;

		public const int SQLITE_LIMIT_EXPR_DEPTH = 3;

		public const int SQLITE_LIMIT_COMPOUND_SELECT = 4;

		public const int SQLITE_LIMIT_VDBE_OP = 5;

		public const int SQLITE_LIMIT_FUNCTION_ARG = 6;

		public const int SQLITE_LIMIT_ATTACHED = 7;

		public const int SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8;

		public const int SQLITE_LIMIT_VARIABLE_NUMBER = 9;

		public const int SQLITE_LIMIT_TRIGGER_DEPTH = 10;

		public const int SQLITE_LIMIT_WORKER_THREADS = 11;

		public const int SQLITE_CONFIG_SINGLETHREAD = 1;

		public const int SQLITE_CONFIG_MULTITHREAD = 2;

		public const int SQLITE_CONFIG_SERIALIZED = 3;

		public const int SQLITE_CONFIG_MALLOC = 4;

		public const int SQLITE_CONFIG_GETMALLOC = 5;

		public const int SQLITE_CONFIG_SCRATCH = 6;

		public const int SQLITE_CONFIG_PAGECACHE = 7;

		public const int SQLITE_CONFIG_HEAP = 8;

		public const int SQLITE_CONFIG_MEMSTATUS = 9;

		public const int SQLITE_CONFIG_MUTEX = 10;

		public const int SQLITE_CONFIG_GETMUTEX = 11;

		public const int SQLITE_CONFIG_LOOKASIDE = 13;

		public const int SQLITE_CONFIG_PCACHE = 14;

		public const int SQLITE_CONFIG_GETPCACHE = 15;

		public const int SQLITE_CONFIG_LOG = 16;

		public const int SQLITE_CONFIG_URI = 17;

		public const int SQLITE_CONFIG_PCACHE2 = 18;

		public const int SQLITE_CONFIG_GETPCACHE2 = 19;

		public const int SQLITE_CONFIG_COVERING_INDEX_SCAN = 20;

		public const int SQLITE_CONFIG_SQLLOG = 21;

		public const int SQLITE_DBCONFIG_MAINDBNAME = 1000;

		public const int SQLITE_DBCONFIG_LOOKASIDE = 1001;

		public const int SQLITE_DBCONFIG_ENABLE_FKEY = 1002;

		public const int SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003;

		public const int SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004;

		public const int SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005;

		public const int SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE = 1006;

		public const int SQLITE_DBCONFIG_ENABLE_QPSG = 1007;

		public const int SQLITE_DBCONFIG_TRIGGER_EQP = 1008;

		public const int SQLITE_DBCONFIG_RESET_DATABASE = 1009;

		public const int SQLITE_DBCONFIG_DEFENSIVE = 1010;

		public const int SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011;

		public const int SQLITE_DBCONFIG_LEGACY_ALTER_TABLE = 1012;

		public const int SQLITE_DBCONFIG_DQS_DML = 1013;

		public const int SQLITE_DBCONFIG_DQS_DDL = 1014;

		public const int SQLITE_DBCONFIG_ENABLE_VIEW = 1015;

		public const int SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016;

		public const int SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017;

		public const int SQLITE_DBCONFIG_MAX = 1017;

		public const int SQLITE_OPEN_READONLY = 1;

		public const int SQLITE_OPEN_READWRITE = 2;

		public const int SQLITE_OPEN_CREATE = 4;

		public const int SQLITE_OPEN_DELETEONCLOSE = 8;

		public const int SQLITE_OPEN_EXCLUSIVE = 16;

		public const int SQLITE_OPEN_AUTOPROXY = 32;

		public const int SQLITE_OPEN_URI = 64;

		public const int SQLITE_OPEN_MEMORY = 128;

		public const int SQLITE_OPEN_MAIN_DB = 256;

		public const int SQLITE_OPEN_TEMP_DB = 512;

		public const int SQLITE_OPEN_TRANSIENT_DB = 1024;

		public const int SQLITE_OPEN_MAIN_JOURNAL = 2048;

		public const int SQLITE_OPEN_TEMP_JOURNAL = 4096;

		public const int SQLITE_OPEN_SUBJOURNAL = 8192;

		public const int SQLITE_OPEN_MASTER_JOURNAL = 16384;

		public const int SQLITE_OPEN_NOMUTEX = 32768;

		public const int SQLITE_OPEN_FULLMUTEX = 65536;

		public const int SQLITE_OPEN_SHAREDCACHE = 131072;

		public const int SQLITE_OPEN_PRIVATECACHE = 262144;

		public const int SQLITE_OPEN_WAL = 524288;

		public const int SQLITE_PREPARE_PERSISTENT = 1;

		public const int SQLITE_PREPARE_NORMALIZE = 2;

		public const int SQLITE_PREPARE_NO_VTAB = 4;

		public const int SQLITE_INTEGER = 1;

		public const int SQLITE_FLOAT = 2;

		public const int SQLITE_TEXT = 3;

		public const int SQLITE_BLOB = 4;

		public const int SQLITE_NULL = 5;

		public const int SQLITE_OK = 0;

		public const int SQLITE_ERROR = 1;

		public const int SQLITE_INTERNAL = 2;

		public const int SQLITE_PERM = 3;

		public const int SQLITE_ABORT = 4;

		public const int SQLITE_BUSY = 5;

		public const int SQLITE_LOCKED = 6;

		public const int SQLITE_NOMEM = 7;

		public const int SQLITE_READONLY = 8;

		public const int SQLITE_INTERRUPT = 9;

		public const int SQLITE_IOERR = 10;

		public const int SQLITE_CORRUPT = 11;

		public const int SQLITE_NOTFOUND = 12;

		public const int SQLITE_FULL = 13;

		public const int SQLITE_CANTOPEN = 14;

		public const int SQLITE_PROTOCOL = 15;

		public const int SQLITE_EMPTY = 16;

		public const int SQLITE_SCHEMA = 17;

		public const int SQLITE_TOOBIG = 18;

		public const int SQLITE_CONSTRAINT = 19;

		public const int SQLITE_MISMATCH = 20;

		public const int SQLITE_MISUSE = 21;

		public const int SQLITE_NOLFS = 22;

		public const int SQLITE_AUTH = 23;

		public const int SQLITE_FORMAT = 24;

		public const int SQLITE_RANGE = 25;

		public const int SQLITE_NOTADB = 26;

		public const int SQLITE_NOTICE = 27;

		public const int SQLITE_WARNING = 28;

		public const int SQLITE_ROW = 100;

		public const int SQLITE_DONE = 101;

		public const int SQLITE_IOERR_READ = 266;

		public const int SQLITE_IOERR_SHORT_READ = 522;

		public const int SQLITE_IOERR_WRITE = 778;

		public const int SQLITE_IOERR_FSYNC = 1034;

		public const int SQLITE_IOERR_DIR_FSYNC = 1290;

		public const int SQLITE_IOERR_TRUNCATE = 1546;

		public const int SQLITE_IOERR_FSTAT = 1802;

		public const int SQLITE_IOERR_UNLOCK = 2058;

		public const int SQLITE_IOERR_RDLOCK = 2314;

		public const int SQLITE_IOERR_DELETE = 2570;

		public const int SQLITE_IOERR_BLOCKED = 2826;

		public const int SQLITE_IOERR_NOMEM = 3082;

		public const int SQLITE_IOERR_ACCESS = 3338;

		public const int SQLITE_IOERR_CHECKRESERVEDLOCK = 3594;

		public const int SQLITE_IOERR_LOCK = 3850;

		public const int SQLITE_IOERR_CLOSE = 4106;

		public const int SQLITE_IOERR_DIR_CLOSE = 4362;

		public const int SQLITE_IOERR_SHMOPEN = 4618;

		public const int SQLITE_IOERR_SHMSIZE = 4874;

		public const int SQLITE_IOERR_SHMLOCK = 5130;

		public const int SQLITE_IOERR_SHMMAP = 5386;

		public const int SQLITE_IOERR_SEEK = 5642;

		public const int SQLITE_IOERR_DELETE_NOENT = 5898;

		public const int SQLITE_IOERR_MMAP = 6154;

		public const int SQLITE_IOERR_GETTEMPPATH = 6410;

		public const int SQLITE_IOERR_CONVPATH = 6666;

		public const int SQLITE_LOCKED_SHAREDCACHE = 262;

		public const int SQLITE_BUSY_RECOVERY = 261;

		public const int SQLITE_BUSY_SNAPSHOT = 517;

		public const int SQLITE_CANTOPEN_NOTEMPDIR = 270;

		public const int SQLITE_CANTOPEN_ISDIR = 526;

		public const int SQLITE_CANTOPEN_FULLPATH = 782;

		public const int SQLITE_CANTOPEN_CONVPATH = 1038;

		public const int SQLITE_CORRUPT_VTAB = 267;

		public const int SQLITE_READONLY_RECOVERY = 264;

		public const int SQLITE_READONLY_CANTLOCK = 520;

		public const int SQLITE_READONLY_ROLLBACK = 776;

		public const int SQLITE_READONLY_DBMOVED = 1032;

		public const int SQLITE_ABORT_ROLLBACK = 516;

		public const int SQLITE_CONSTRAINT_CHECK = 275;

		public const int SQLITE_CONSTRAINT_COMMITHOOK = 531;

		public const int SQLITE_CONSTRAINT_FOREIGNKEY = 787;

		public const int SQLITE_CONSTRAINT_FUNCTION = 1043;

		public const int SQLITE_CONSTRAINT_NOTNULL = 1299;

		public const int SQLITE_CONSTRAINT_PRIMARYKEY = 1555;

		public const int SQLITE_CONSTRAINT_TRIGGER = 1811;

		public const int SQLITE_CONSTRAINT_UNIQUE = 2067;

		public const int SQLITE_CONSTRAINT_VTAB = 2323;

		public const int SQLITE_CONSTRAINT_ROWID = 2579;

		public const int SQLITE_NOTICE_RECOVER_WAL = 283;

		public const int SQLITE_NOTICE_RECOVER_ROLLBACK = 539;

		public const int SQLITE_WARNING_AUTOINDEX = 284;

		public const int SQLITE_CREATE_INDEX = 1;

		public const int SQLITE_CREATE_TABLE = 2;

		public const int SQLITE_CREATE_TEMP_INDEX = 3;

		public const int SQLITE_CREATE_TEMP_TABLE = 4;

		public const int SQLITE_CREATE_TEMP_TRIGGER = 5;

		public const int SQLITE_CREATE_TEMP_VIEW = 6;

		public const int SQLITE_CREATE_TRIGGER = 7;

		public const int SQLITE_CREATE_VIEW = 8;

		public const int SQLITE_DELETE = 9;

		public const int SQLITE_DROP_INDEX = 10;

		public const int SQLITE_DROP_TABLE = 11;

		public const int SQLITE_DROP_TEMP_INDEX = 12;

		public const int SQLITE_DROP_TEMP_TABLE = 13;

		public const int SQLITE_DROP_TEMP_TRIGGER = 14;

		public const int SQLITE_DROP_TEMP_VIEW = 15;

		public const int SQLITE_DROP_TRIGGER = 16;

		public const int SQLITE_DROP_VIEW = 17;

		public const int SQLITE_INSERT = 18;

		public const int SQLITE_PRAGMA = 19;

		public const int SQLITE_READ = 20;

		public const int SQLITE_SELECT = 21;

		public const int SQLITE_TRANSACTION = 22;

		public const int SQLITE_UPDATE = 23;

		public const int SQLITE_ATTACH = 24;

		public const int SQLITE_DETACH = 25;

		public const int SQLITE_ALTER_TABLE = 26;

		public const int SQLITE_REINDEX = 27;

		public const int SQLITE_ANALYZE = 28;

		public const int SQLITE_CREATE_VTABLE = 29;

		public const int SQLITE_DROP_VTABLE = 30;

		public const int SQLITE_FUNCTION = 31;

		public const int SQLITE_SAVEPOINT = 32;

		public const int SQLITE_COPY = 0;

		public const int SQLITE_RECURSIVE = 33;

		public const int SQLITE_CHECKPOINT_PASSIVE = 0;

		public const int SQLITE_CHECKPOINT_FULL = 1;

		public const int SQLITE_CHECKPOINT_RESTART = 2;

		public const int SQLITE_CHECKPOINT_TRUNCATE = 3;

		public const int SQLITE_DBSTATUS_LOOKASIDE_USED = 0;

		public const int SQLITE_DBSTATUS_CACHE_USED = 1;

		public const int SQLITE_DBSTATUS_SCHEMA_USED = 2;

		public const int SQLITE_DBSTATUS_STMT_USED = 3;

		public const int SQLITE_DBSTATUS_LOOKASIDE_HIT = 4;

		public const int SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5;

		public const int SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6;

		public const int SQLITE_DBSTATUS_CACHE_HIT = 7;

		public const int SQLITE_DBSTATUS_CACHE_MISS = 8;

		public const int SQLITE_DBSTATUS_CACHE_WRITE = 9;

		public const int SQLITE_DBSTATUS_DEFERRED_FKS = 10;

		public const int SQLITE_STATUS_MEMORY_USED = 0;

		public const int SQLITE_STATUS_PAGECACHE_USED = 1;

		public const int SQLITE_STATUS_PAGECACHE_OVERFLOW = 2;

		public const int SQLITE_STATUS_SCRATCH_USED = 3;

		public const int SQLITE_STATUS_SCRATCH_OVERFLOW = 4;

		public const int SQLITE_STATUS_MALLOC_SIZE = 5;

		public const int SQLITE_STATUS_PARSER_STACK = 6;

		public const int SQLITE_STATUS_PAGECACHE_SIZE = 7;

		public const int SQLITE_STATUS_SCRATCH_SIZE = 8;

		public const int SQLITE_STATUS_MALLOC_COUNT = 9;

		public const int SQLITE_STMTSTATUS_FULLSCAN_STEP = 1;

		public const int SQLITE_STMTSTATUS_SORT = 2;

		public const int SQLITE_STMTSTATUS_AUTOINDEX = 3;

		public const int SQLITE_STMTSTATUS_VM_STEP = 4;

		public const int SQLITE_DENY = 1;

		public const int SQLITE_IGNORE = 2;

		public const int SQLITE_TRACE_STMT = 1;

		public const int SQLITE_TRACE_PROFILE = 2;

		public const int SQLITE_TRACE_ROW = 4;

		public const int SQLITE_TRACE_CLOSE = 8;

		public const int SQLITE_SERIALIZE_NOCOPY = 1;

		public const int SQLITE_DESERIALIZE_FREEONCLOSE = 1;

		public const int SQLITE_DESERIALIZE_RESIZEABLE = 2;

		public const int SQLITE_DESERIALIZE_READONLY = 4;

		private static ISQLite3Provider Provider
		{
			get
			{
				if (_imp == null)
				{
					throw new Exception("You need to call SQLitePCL.raw.SetProvider().  If you are using a bundle package, this is done by calling SQLitePCL.Batteries.Init().");
				}
				return _imp;
			}
		}

		static raw()
		{
			_frozen = false;
		}

		public static void SetProvider(ISQLite3Provider imp)
		{
			if (!_frozen)
			{
				imp.sqlite3_libversion_number();
				_imp = imp;
			}
		}

		public static void FreezeProvider(bool b = true)
		{
			_frozen = b;
		}

		public static string GetNativeLibraryName()
		{
			return Provider.GetNativeLibraryName();
		}

		public static int sqlite3_open(utf8z filename, out sqlite3 db)
		{
			IntPtr db2;
			int result = Provider.sqlite3_open(filename, out db2);
			db = sqlite3.New(db2);
			return result;
		}

		public static int sqlite3_open(string filename, out sqlite3 db)
		{
			return sqlite3_open(filename.to_utf8z(), out db);
		}

		public static int sqlite3_open_v2(utf8z filename, out sqlite3 db, int flags, utf8z vfs)
		{
			IntPtr db2;
			int result = Provider.sqlite3_open_v2(filename, out db2, flags, vfs);
			db = sqlite3.New(db2);
			return result;
		}

		public static int sqlite3_open_v2(string filename, out sqlite3 db, int flags, string vfs)
		{
			return sqlite3_open_v2(filename.to_utf8z(), out db, flags, vfs.to_utf8z());
		}

		public static int sqlite3__vfs__delete(utf8z vfs, utf8z pathname, int syncdir)
		{
			return Provider.sqlite3__vfs__delete(vfs, pathname, syncdir);
		}

		public static int sqlite3__vfs__delete(string vfs, string pathname, int syncdir)
		{
			return sqlite3__vfs__delete(vfs.to_utf8z(), pathname.to_utf8z(), syncdir);
		}

		internal static int internal_sqlite3_close_v2(IntPtr p)
		{
			return Provider.sqlite3_close_v2(p);
		}

		internal static int internal_sqlite3_close(IntPtr p)
		{
			return Provider.sqlite3_close(p);
		}

		public static int sqlite3_close_v2(sqlite3 db)
		{
			return db.manual_close_v2();
		}

		public static int sqlite3_close(sqlite3 db)
		{
			return db.manual_close();
		}

		public static int sqlite3_enable_shared_cache(int enable)
		{
			return Provider.sqlite3_enable_shared_cache(enable);
		}

		public static void sqlite3_interrupt(sqlite3 db)
		{
			Provider.sqlite3_interrupt(db);
		}

		public static int sqlite3_config_log(delegate_log f, object v)
		{
			return Provider.sqlite3_config_log(f, v);
		}

		public static int sqlite3_config_log(strdelegate_log f, object v)
		{
			delegate_log f2 = ((f != null) ? ((delegate_log)delegate(object ob, int e, utf8z msg)
			{
				f(ob, e, msg.utf8_to_string());
			}) : null);
			return sqlite3_config_log(f2, v);
		}

		public static void sqlite3_log(int errcode, utf8z s)
		{
			Provider.sqlite3_log(errcode, s);
		}

		public static void sqlite3_log(int errcode, string s)
		{
			sqlite3_log(errcode, s.to_utf8z());
		}

		public static void sqlite3_commit_hook(sqlite3 db, delegate_commit f, object v)
		{
			Provider.sqlite3_commit_hook(db, f, v);
		}

		public static void sqlite3_rollback_hook(sqlite3 db, delegate_rollback f, object v)
		{
			Provider.sqlite3_rollback_hook(db, f, v);
		}

		public static void sqlite3_trace(sqlite3 db, delegate_trace f, object v)
		{
			Provider.sqlite3_trace(db, f, v);
		}

		public static void sqlite3_trace(sqlite3 db, strdelegate_trace f, object v)
		{
			delegate_trace f2 = ((f != null) ? ((delegate_trace)delegate(object ob, utf8z sp)
			{
				f(v, sp.utf8_to_string());
			}) : null);
			sqlite3_trace(db, f2, v);
		}

		public static void sqlite3_profile(sqlite3 db, delegate_profile f, object v)
		{
			Provider.sqlite3_profile(db, f, v);
		}

		public static void sqlite3_profile(sqlite3 db, strdelegate_profile f, object v)
		{
			delegate_profile f2 = ((f != null) ? ((delegate_profile)delegate(object ob, utf8z sp, long ns)
			{
				f(v, sp.utf8_to_string(), ns);
			}) : null);
			sqlite3_profile(db, f2, v);
		}

		public static void sqlite3_progress_handler(sqlite3 db, int instructions, delegate_progress func, object v)
		{
			Provider.sqlite3_progress_handler(db, instructions, func, v);
		}

		public static void sqlite3_update_hook(sqlite3 db, delegate_update f, object v)
		{
			Provider.sqlite3_update_hook(db, f, v);
		}

		public static void sqlite3_update_hook(sqlite3 db, strdelegate_update f, object v)
		{
			delegate_update f2 = ((f != null) ? ((delegate_update)delegate(object ob, int typ, utf8z dbname, utf8z tbl, long rowid)
			{
				f(ob, typ, dbname.utf8_to_string(), tbl.utf8_to_string(), rowid);
			}) : null);
			sqlite3_update_hook(db, f2, v);
		}

		public static int sqlite3_create_collation(sqlite3 db, string name, object v, strdelegate_collation f)
		{
			byte[] name2 = name.to_utf8_with_z();
			delegate_collation func = ((f != null) ? ((delegate_collation)((object ob, ReadOnlySpan<byte> s1, ReadOnlySpan<byte> s2) => f(ob, s1.utf8_span_to_string(), s2.utf8_span_to_string()))) : null);
			return Provider.sqlite3_create_collation(db, name2, v, func);
		}

		public static int sqlite3__create_collation_utf8(sqlite3 db, string name, object v, delegate_collation f)
		{
			byte[] name2 = name.to_utf8_with_z();
			return Provider.sqlite3_create_collation(db, name2, v, f);
		}

		public static int sqlite3_create_function(sqlite3 db, string name, int nArg, int flags, object v, delegate_function_scalar func)
		{
			byte[] name2 = name.to_utf8_with_z();
			return Provider.sqlite3_create_function(db, name2, nArg, flags, v, func);
		}

		public static int sqlite3_create_function(sqlite3 db, string name, int nArg, int flags, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)
		{
			byte[] name2 = name.to_utf8_with_z();
			return Provider.sqlite3_create_function(db, name2, nArg, flags, v, func_step, func_final);
		}

		public static int sqlite3_create_function(sqlite3 db, string name, int nArg, object v, delegate_function_scalar func)
		{
			return sqlite3_create_function(db, name, nArg, 0, v, func);
		}

		public static int sqlite3_create_function(sqlite3 db, string name, int nArg, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)
		{
			return sqlite3_create_function(db, name, nArg, 0, v, func_step, func_final);
		}

		public static int sqlite3_db_status(sqlite3 db, int op, out int current, out int highest, int resetFlg)
		{
			return Provider.sqlite3_db_status(db, op, out current, out highest, resetFlg);
		}

		public unsafe static string utf8_span_to_string(this ReadOnlySpan<byte> p)
		{
			if (p.Length == 0)
			{
				return "";
			}
			fixed (byte* bytes = p)
			{
				return Encoding.UTF8.GetString(bytes, p.Length);
			}
		}

		public static int sqlite3_key(sqlite3 db, ReadOnlySpan<byte> k)
		{
			return Provider.sqlite3_key(db, k);
		}

		public static int sqlite3_key_v2(sqlite3 db, utf8z name, ReadOnlySpan<byte> k)
		{
			return Provider.sqlite3_key_v2(db, name, k);
		}

		public static int sqlite3_rekey(sqlite3 db, ReadOnlySpan<byte> k)
		{
			return Provider.sqlite3_rekey(db, k);
		}

		public static int sqlite3_rekey_v2(sqlite3 db, utf8z name, ReadOnlySpan<byte> k)
		{
			return Provider.sqlite3_rekey_v2(db, name, k);
		}

		public static utf8z sqlite3_libversion()
		{
			return Provider.sqlite3_libversion();
		}

		public static int sqlite3_libversion_number()
		{
			return Provider.sqlite3_libversion_number();
		}

		public static int sqlite3_threadsafe()
		{
			return Provider.sqlite3_threadsafe();
		}

		public static int sqlite3_initialize()
		{
			return Provider.sqlite3_initialize();
		}

		public static int sqlite3_shutdown()
		{
			return Provider.sqlite3_shutdown();
		}

		public static int sqlite3_limit(sqlite3 db, int id, int newVal)
		{
			return Provider.sqlite3_limit(db, id, newVal);
		}

		public static int sqlite3_config(int op)
		{
			return Provider.sqlite3_config(op);
		}

		public static int sqlite3_config(int op, int val)
		{
			return Provider.sqlite3_config(op, val);
		}

		public static int sqlite3_db_config(sqlite3 db, int op, utf8z val)
		{
			return Provider.sqlite3_db_config(db, op, val);
		}

		public static int sqlite3_db_config(sqlite3 db, int op, int val, out int result)
		{
			return Provider.sqlite3_db_config(db, op, val, out result);
		}

		public static int sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1)
		{
			return Provider.sqlite3_db_config(db, op, ptr, int0, int1);
		}

		public static int sqlite3_enable_load_extension(sqlite3 db, int onoff)
		{
			return Provider.sqlite3_enable_load_extension(db, onoff);
		}

		public static int sqlite3_load_extension(sqlite3 db, utf8z file, utf8z proc, out utf8z errmsg)
		{
			return Provider.sqlite3_load_extension(db, file, proc, out errmsg);
		}

		public static utf8z sqlite3_sourceid()
		{
			return Provider.sqlite3_sourceid();
		}

		public static long sqlite3_memory_used()
		{
			return Provider.sqlite3_memory_used();
		}

		public static long sqlite3_memory_highwater(int resetFlag)
		{
			return Provider.sqlite3_memory_highwater(resetFlag);
		}

		public static long sqlite3_soft_heap_limit64(long n)
		{
			return Provider.sqlite3_soft_heap_limit64(n);
		}

		public static long sqlite3_hard_heap_limit64(long n)
		{
			return Provider.sqlite3_hard_heap_limit64(n);
		}

		public static int sqlite3_status(int op, out int current, out int highwater, int resetFlag)
		{
			return Provider.sqlite3_status(op, out current, out highwater, resetFlag);
		}

		public static utf8z sqlite3_errmsg(sqlite3 db)
		{
			return Provider.sqlite3_errmsg(db);
		}

		public static int sqlite3_db_readonly(sqlite3 db, utf8z dbName)
		{
			return Provider.sqlite3_db_readonly(db, dbName);
		}

		public static int sqlite3_db_readonly(sqlite3 db, string dbName)
		{
			return sqlite3_db_readonly(db, dbName.to_utf8z());
		}

		public static utf8z sqlite3_db_filename(sqlite3 db, utf8z att)
		{
			return Provider.sqlite3_db_filename(db, att);
		}

		public static utf8z sqlite3_db_filename(sqlite3 db, string att)
		{
			return sqlite3_db_filename(db, att.to_utf8z());
		}

		public static long sqlite3_last_insert_rowid(sqlite3 db)
		{
			return Provider.sqlite3_last_insert_rowid(db);
		}

		public static int sqlite3_changes(sqlite3 db)
		{
			return Provider.sqlite3_changes(db);
		}

		public static int sqlite3_total_changes(sqlite3 db)
		{
			return Provider.sqlite3_total_changes(db);
		}

		public static int sqlite3_get_autocommit(sqlite3 db)
		{
			return Provider.sqlite3_get_autocommit(db);
		}

		public static int sqlite3_busy_timeout(sqlite3 db, int ms)
		{
			return Provider.sqlite3_busy_timeout(db, ms);
		}

		public static int sqlite3_extended_result_codes(sqlite3 db, int onoff)
		{
			return Provider.sqlite3_extended_result_codes(db, onoff);
		}

		public static int sqlite3_errcode(sqlite3 db)
		{
			return Provider.sqlite3_errcode(db);
		}

		public static int sqlite3_extended_errcode(sqlite3 db)
		{
			return Provider.sqlite3_extended_errcode(db);
		}

		public static utf8z sqlite3_errstr(int rc)
		{
			return Provider.sqlite3_errstr(rc);
		}

		public static int sqlite3_prepare_v2(sqlite3 db, ReadOnlySpan<byte> sql, out sqlite3_stmt stmt)
		{
			IntPtr stmt2;
			ReadOnlySpan<byte> remain;
			int result = Provider.sqlite3_prepare_v2(db, sql, out stmt2, out remain);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v2(sqlite3 db, utf8z sql, out sqlite3_stmt stmt)
		{
			IntPtr stmt2;
			utf8z remain;
			int result = Provider.sqlite3_prepare_v2(db, sql, out stmt2, out remain);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt)
		{
			byte[] array = sql.to_utf8_with_z();
			ReadOnlySpan<byte> sql2 = new ReadOnlySpan<byte>(array);
			ReadOnlySpan<byte> tail;
			return sqlite3_prepare_v2(db, sql2, out stmt, out tail);
		}

		public static int sqlite3_prepare_v2(sqlite3 db, ReadOnlySpan<byte> sql, out sqlite3_stmt stmt, out ReadOnlySpan<byte> tail)
		{
			IntPtr stmt2;
			int result = Provider.sqlite3_prepare_v2(db, sql, out stmt2, out tail);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v2(sqlite3 db, utf8z sql, out sqlite3_stmt stmt, out utf8z tail)
		{
			IntPtr stmt2;
			int result = Provider.sqlite3_prepare_v2(db, sql, out stmt2, out tail);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v2(sqlite3 db, string sql, out sqlite3_stmt stmt, out string tail)
		{
			byte[] array = sql.to_utf8_with_z();
			ReadOnlySpan<byte> sql2 = new ReadOnlySpan<byte>(array);
			ReadOnlySpan<byte> tail2;
			int result = sqlite3_prepare_v2(db, sql2, out stmt, out tail2);
			tail = tail2.Slice(0, tail2.Length - 1).utf8_span_to_string();
			return result;
		}

		public static int sqlite3_prepare_v3(sqlite3 db, ReadOnlySpan<byte> sql, uint flags, out sqlite3_stmt stmt)
		{
			IntPtr stmt2;
			ReadOnlySpan<byte> remain;
			int result = Provider.sqlite3_prepare_v3(db, sql, flags, out stmt2, out remain);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v3(sqlite3 db, utf8z sql, uint flags, out sqlite3_stmt stmt)
		{
			IntPtr stmt2;
			utf8z remain;
			int result = Provider.sqlite3_prepare_v3(db, sql, flags, out stmt2, out remain);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v3(sqlite3 db, string sql, uint flags, out sqlite3_stmt stmt)
		{
			byte[] array = sql.to_utf8_with_z();
			ReadOnlySpan<byte> sql2 = new ReadOnlySpan<byte>(array);
			ReadOnlySpan<byte> tail;
			return sqlite3_prepare_v3(db, sql2, flags, out stmt, out tail);
		}

		public static int sqlite3_prepare_v3(sqlite3 db, ReadOnlySpan<byte> sql, uint flags, out sqlite3_stmt stmt, out ReadOnlySpan<byte> tail)
		{
			IntPtr stmt2;
			int result = Provider.sqlite3_prepare_v3(db, sql, flags, out stmt2, out tail);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v3(sqlite3 db, utf8z sql, uint flags, out sqlite3_stmt stmt, out utf8z tail)
		{
			IntPtr stmt2;
			int result = Provider.sqlite3_prepare_v3(db, sql, flags, out stmt2, out tail);
			stmt = sqlite3_stmt.From(stmt2, db);
			return result;
		}

		public static int sqlite3_prepare_v3(sqlite3 db, string sql, uint flags, out sqlite3_stmt stmt, out string tail)
		{
			byte[] array = sql.to_utf8_with_z();
			ReadOnlySpan<byte> sql2 = new ReadOnlySpan<byte>(array);
			ReadOnlySpan<byte> tail2;
			int result = sqlite3_prepare_v3(db, sql2, flags, out stmt, out tail2);
			tail = tail2.Slice(0, tail2.Length - 1).utf8_span_to_string();
			return result;
		}

		public static int sqlite3_exec(sqlite3 db, string sql, strdelegate_exec callback, object user_data, out string errMsg)
		{
			delegate_exec callback2 = ((callback == null) ? null : ((delegate_exec)delegate(object ob, IntPtr[] values, IntPtr[] names)
			{
				string[] array = new string[values.Length];
				string[] array2 = new string[names.Length];
				for (int i = 0; i < values.Length; i++)
				{
					array[i] = util.from_utf8_z(values[i]);
					array2[i] = util.from_utf8_z(names[i]);
				}
				return callback(ob, array, array2);
			}));
			IntPtr errMsg2;
			int result = Provider.sqlite3_exec(db, sql.to_utf8z(), callback2, user_data, out errMsg2);
			if (errMsg2 == IntPtr.Zero)
			{
				errMsg = null;
				return result;
			}
			errMsg = util.from_utf8_z(errMsg2);
			Provider.sqlite3_free(errMsg2);
			return result;
		}

		public static int sqlite3_exec(sqlite3 db, string sql, out string errMsg)
		{
			IntPtr errMsg2;
			int result = Provider.sqlite3_exec(db, sql.to_utf8z(), null, null, out errMsg2);
			if (errMsg2 == IntPtr.Zero)
			{
				errMsg = null;
				return result;
			}
			errMsg = util.from_utf8_z(errMsg2);
			Provider.sqlite3_free(errMsg2);
			return result;
		}

		public static int sqlite3_exec(sqlite3 db, string sql)
		{
			IntPtr errMsg;
			int result = Provider.sqlite3_exec(db, sql.to_utf8z(), null, null, out errMsg);
			if (!(errMsg == IntPtr.Zero))
			{
				Provider.sqlite3_free(errMsg);
			}
			return result;
		}

		public static int sqlite3_step(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_step(stmt);
		}

		public static int sqlite3_finalize(sqlite3_stmt stmt)
		{
			return stmt.manual_close();
		}

		public static int internal_sqlite3_finalize(IntPtr stmt)
		{
			return Provider.sqlite3_finalize(stmt);
		}

		public static int sqlite3_reset(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_reset(stmt);
		}

		public static int sqlite3_clear_bindings(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_clear_bindings(stmt);
		}

		public static int sqlite3_stmt_status(sqlite3_stmt stmt, int op, int resetFlg)
		{
			return Provider.sqlite3_stmt_status(stmt, op, resetFlg);
		}

		public static int sqlite3_complete(utf8z sql)
		{
			return Provider.sqlite3_complete(sql);
		}

		public static int sqlite3_complete(string sql)
		{
			return sqlite3_complete(sql.to_utf8z());
		}

		public static int sqlite3_compileoption_used(utf8z s)
		{
			return Provider.sqlite3_compileoption_used(s);
		}

		public static int sqlite3_compileoption_used(string s)
		{
			return sqlite3_compileoption_used(s.to_utf8z());
		}

		public static utf8z sqlite3_compileoption_get(int n)
		{
			return Provider.sqlite3_compileoption_get(n);
		}

		public static int sqlite3_table_column_metadata(sqlite3 db, utf8z dbName, utf8z tblName, utf8z colName, out utf8z dataType, out utf8z collSeq, out int notNull, out int primaryKey, out int autoInc)
		{
			return Provider.sqlite3_table_column_metadata(db, dbName, tblName, colName, out dataType, out collSeq, out notNull, out primaryKey, out autoInc);
		}

		public static int sqlite3_table_column_metadata(sqlite3 db, string dbName, string tblName, string colName, out string dataType, out string collSeq, out int notNull, out int primaryKey, out int autoInc)
		{
			utf8z dataType2;
			utf8z collSeq2;
			int result = sqlite3_table_column_metadata(db, dbName.to_utf8z(), tblName.to_utf8z(), colName.to_utf8z(), out dataType2, out collSeq2, out notNull, out primaryKey, out autoInc);
			dataType = dataType2.utf8_to_string();
			collSeq = collSeq2.utf8_to_string();
			return result;
		}

		public static utf8z sqlite3_sql(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_sql(stmt);
		}

		public static sqlite3 sqlite3_db_handle(sqlite3_stmt stmt)
		{
			return stmt.db;
		}

		public static sqlite3_stmt sqlite3_next_stmt(sqlite3 db, sqlite3_stmt stmt)
		{
			IntPtr intPtr = Provider.sqlite3_next_stmt(db, stmt?.ptr ?? IntPtr.Zero);
			if (intPtr == IntPtr.Zero)
			{
				return null;
			}
			return db.find_stmt(intPtr);
		}

		public static int sqlite3_bind_zeroblob(sqlite3_stmt stmt, int index, int size)
		{
			return Provider.sqlite3_bind_zeroblob(stmt, index, size);
		}

		public static utf8z sqlite3_bind_parameter_name(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_bind_parameter_name(stmt, index);
		}

		public static object sqlite3_user_data(sqlite3_context context)
		{
			return context.user_data;
		}

		public static void sqlite3_result_null(sqlite3_context context)
		{
			Provider.sqlite3_result_null(context.ptr);
		}

		public static void sqlite3_result_blob(sqlite3_context context, ReadOnlySpan<byte> val)
		{
			Provider.sqlite3_result_blob(context.ptr, val);
		}

		public static void sqlite3_result_error(sqlite3_context context, ReadOnlySpan<byte> val)
		{
			Provider.sqlite3_result_error(context.ptr, val);
		}

		public static void sqlite3_result_error(sqlite3_context context, utf8z val)
		{
			Provider.sqlite3_result_error(context.ptr, val);
		}

		public static void sqlite3_result_error(sqlite3_context context, string val)
		{
			sqlite3_result_error(context, val.to_utf8z());
		}

		public static void sqlite3_result_text(sqlite3_context context, ReadOnlySpan<byte> val)
		{
			Provider.sqlite3_result_text(context.ptr, val);
		}

		public static void sqlite3_result_text(sqlite3_context context, utf8z val)
		{
			Provider.sqlite3_result_text(context.ptr, val);
		}

		public static void sqlite3_result_text(sqlite3_context context, string val)
		{
			sqlite3_result_text(context, val.to_utf8z());
		}

		public static void sqlite3_result_double(sqlite3_context context, double val)
		{
			Provider.sqlite3_result_double(context.ptr, val);
		}

		public static void sqlite3_result_int(sqlite3_context context, int val)
		{
			Provider.sqlite3_result_int(context.ptr, val);
		}

		public static void sqlite3_result_int64(sqlite3_context context, long val)
		{
			Provider.sqlite3_result_int64(context.ptr, val);
		}

		public static void sqlite3_result_zeroblob(sqlite3_context context, int n)
		{
			Provider.sqlite3_result_zeroblob(context.ptr, n);
		}

		public static void sqlite3_result_error_toobig(sqlite3_context context)
		{
			Provider.sqlite3_result_error_toobig(context.ptr);
		}

		public static void sqlite3_result_error_nomem(sqlite3_context context)
		{
			Provider.sqlite3_result_error_nomem(context.ptr);
		}

		public static void sqlite3_result_error_code(sqlite3_context context, int code)
		{
			Provider.sqlite3_result_error_code(context.ptr, code);
		}

		public static ReadOnlySpan<byte> sqlite3_value_blob(sqlite3_value val)
		{
			return Provider.sqlite3_value_blob(val.ptr);
		}

		public static int sqlite3_value_bytes(sqlite3_value val)
		{
			return Provider.sqlite3_value_bytes(val.ptr);
		}

		public static double sqlite3_value_double(sqlite3_value val)
		{
			return Provider.sqlite3_value_double(val.ptr);
		}

		public static int sqlite3_value_int(sqlite3_value val)
		{
			return Provider.sqlite3_value_int(val.ptr);
		}

		public static long sqlite3_value_int64(sqlite3_value val)
		{
			return Provider.sqlite3_value_int64(val.ptr);
		}

		public static int sqlite3_value_type(sqlite3_value val)
		{
			return Provider.sqlite3_value_type(val.ptr);
		}

		public static utf8z sqlite3_value_text(sqlite3_value val)
		{
			return Provider.sqlite3_value_text(val.ptr);
		}

		public static int sqlite3_bind_blob(sqlite3_stmt stmt, int index, ReadOnlySpan<byte> blob)
		{
			return Provider.sqlite3_bind_blob(stmt, index, blob);
		}

		public static int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val)
		{
			return Provider.sqlite3_bind_double(stmt, index, val);
		}

		public static int sqlite3_bind_int(sqlite3_stmt stmt, int index, int val)
		{
			return Provider.sqlite3_bind_int(stmt, index, val);
		}

		public static int sqlite3_bind_int64(sqlite3_stmt stmt, int index, long val)
		{
			return Provider.sqlite3_bind_int64(stmt, index, val);
		}

		public static int sqlite3_bind_null(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_bind_null(stmt, index);
		}

		public static int sqlite3_bind_text(sqlite3_stmt stmt, int index, ReadOnlySpan<byte> val)
		{
			return Provider.sqlite3_bind_text(stmt, index, val);
		}

		public static int sqlite3_bind_text16(sqlite3_stmt stmt, int index, ReadOnlySpan<char> val)
		{
			return Provider.sqlite3_bind_text16(stmt, index, val);
		}

		public static int sqlite3_bind_text(sqlite3_stmt stmt, int index, utf8z val)
		{
			return Provider.sqlite3_bind_text(stmt, index, val);
		}

		public unsafe static int sqlite3_bind_text(sqlite3_stmt stmt, int index, string val)
		{
			if (val != null && val.Length <= 512)
			{
				int byteCount = Encoding.UTF8.GetByteCount(val);
				if (byteCount <= 512 && byteCount > 0)
				{
					Span<byte> span = stackalloc byte[byteCount];
					fixed (char* chars = val)
					{
						fixed (byte* bytes = span)
						{
							Encoding.UTF8.GetBytes(chars, val.Length, bytes, byteCount);
						}
					}
					return sqlite3_bind_text(stmt, index, span);
				}
			}
			return sqlite3_bind_text(stmt, index, val.to_utf8z());
		}

		public static int sqlite3_bind_parameter_count(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_bind_parameter_count(stmt);
		}

		public static int sqlite3_bind_parameter_index(sqlite3_stmt stmt, utf8z strName)
		{
			return Provider.sqlite3_bind_parameter_index(stmt, strName);
		}

		public static int sqlite3_bind_parameter_index(sqlite3_stmt stmt, string strName)
		{
			return sqlite3_bind_parameter_index(stmt, strName.to_utf8z());
		}

		public static int sqlite3_stmt_isexplain(sqlite3_stmt stmt)
		{
			return _imp.sqlite3_stmt_isexplain(stmt);
		}

		public static int sqlite3_stmt_busy(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_stmt_busy(stmt);
		}

		public static int sqlite3_stmt_readonly(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_stmt_readonly(stmt);
		}

		public static utf8z sqlite3_column_database_name(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_database_name(stmt, index);
		}

		public static utf8z sqlite3_column_name(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_name(stmt, index);
		}

		public static utf8z sqlite3_column_origin_name(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_origin_name(stmt, index);
		}

		public static utf8z sqlite3_column_table_name(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_table_name(stmt, index);
		}

		public static utf8z sqlite3_column_text(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_text(stmt, index);
		}

		public static int sqlite3_column_count(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_column_count(stmt);
		}

		public static int sqlite3_data_count(sqlite3_stmt stmt)
		{
			return Provider.sqlite3_data_count(stmt);
		}

		public static double sqlite3_column_double(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_double(stmt, index);
		}

		public static int sqlite3_column_int(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_int(stmt, index);
		}

		public static long sqlite3_column_int64(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_int64(stmt, index);
		}

		public static ReadOnlySpan<byte> sqlite3_column_blob(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_blob(stmt, index);
		}

		public static int sqlite3_column_bytes(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_bytes(stmt, index);
		}

		public static int sqlite3_column_type(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_type(stmt, index);
		}

		public static utf8z sqlite3_column_decltype(sqlite3_stmt stmt, int index)
		{
			return Provider.sqlite3_column_decltype(stmt, index);
		}

		public static sqlite3_backup sqlite3_backup_init(sqlite3 destDb, string destName, sqlite3 sourceDb, string sourceName)
		{
			return Provider.sqlite3_backup_init(destDb, destName.to_utf8z(), sourceDb, sourceName.to_utf8z());
		}

		public static int sqlite3_backup_step(sqlite3_backup backup, int nPage)
		{
			return Provider.sqlite3_backup_step(backup, nPage);
		}

		public static int sqlite3_backup_remaining(sqlite3_backup backup)
		{
			return Provider.sqlite3_backup_remaining(backup);
		}

		public static int sqlite3_backup_pagecount(sqlite3_backup backup)
		{
			return Provider.sqlite3_backup_pagecount(backup);
		}

		public static int sqlite3_backup_finish(sqlite3_backup backup)
		{
			return backup.manual_close();
		}

		internal static int internal_sqlite3_backup_finish(IntPtr p)
		{
			return Provider.sqlite3_backup_finish(p);
		}

		public static int sqlite3_snapshot_get(sqlite3 db, string schema, out sqlite3_snapshot snap)
		{
			IntPtr snap2;
			int result = Provider.sqlite3_snapshot_get(db, schema.to_utf8z(), out snap2);
			snap = sqlite3_snapshot.From(snap2);
			return result;
		}

		public static int sqlite3_snapshot_cmp(sqlite3_snapshot p1, sqlite3_snapshot p2)
		{
			return Provider.sqlite3_snapshot_cmp(p1, p2);
		}

		public static int sqlite3_snapshot_open(sqlite3 db, string schema, sqlite3_snapshot snap)
		{
			return Provider.sqlite3_snapshot_open(db, schema.to_utf8z(), snap);
		}

		public static int sqlite3_snapshot_recover(sqlite3 db, string name)
		{
			return Provider.sqlite3_snapshot_recover(db, name.to_utf8z());
		}

		public static void sqlite3_snapshot_free(sqlite3_snapshot snap)
		{
			snap.manual_close();
		}

		internal static void internal_sqlite3_snapshot_free(IntPtr p)
		{
			Provider.sqlite3_snapshot_free(p);
		}

		public static int sqlite3_blob_open(sqlite3 db, utf8z db_utf8, utf8z table_utf8, utf8z col_utf8, long rowid, int flags, out sqlite3_blob blob)
		{
			return Provider.sqlite3_blob_open(db, db_utf8, table_utf8, col_utf8, rowid, flags, out blob);
		}

		public static int sqlite3_blob_open(sqlite3 db, string sdb, string table, string col, long rowid, int flags, out sqlite3_blob blob)
		{
			return sqlite3_blob_open(db, sdb.to_utf8z(), table.to_utf8z(), col.to_utf8z(), rowid, flags, out blob);
		}

		public static int sqlite3_blob_bytes(sqlite3_blob blob)
		{
			return Provider.sqlite3_blob_bytes(blob);
		}

		public static int sqlite3_blob_reopen(sqlite3_blob blob, long rowid)
		{
			return Provider.sqlite3_blob_reopen(blob, rowid);
		}

		public static int sqlite3_blob_write(sqlite3_blob blob, ReadOnlySpan<byte> b, int offset)
		{
			return Provider.sqlite3_blob_write(blob, b, offset);
		}

		public static int sqlite3_blob_read(sqlite3_blob blob, Span<byte> b, int offset)
		{
			return Provider.sqlite3_blob_read(blob, b, offset);
		}

		public static int sqlite3_blob_close(sqlite3_blob blob)
		{
			return blob.manual_close();
		}

		internal static int internal_sqlite3_blob_close(IntPtr blob)
		{
			return Provider.sqlite3_blob_close(blob);
		}

		public static int sqlite3_wal_autocheckpoint(sqlite3 db, int n)
		{
			return Provider.sqlite3_wal_autocheckpoint(db, n);
		}

		public static int sqlite3_wal_checkpoint(sqlite3 db, string dbName)
		{
			return Provider.sqlite3_wal_checkpoint(db, dbName.to_utf8z());
		}

		public static int sqlite3_wal_checkpoint_v2(sqlite3 db, string dbName, int eMode, out int logSize, out int framesCheckPointed)
		{
			return Provider.sqlite3_wal_checkpoint_v2(db, dbName.to_utf8z(), eMode, out logSize, out framesCheckPointed);
		}

		public static int sqlite3_set_authorizer(sqlite3 db, delegate_authorizer f, object user_data)
		{
			return Provider.sqlite3_set_authorizer(db, f, user_data);
		}

		public static int sqlite3_set_authorizer(sqlite3 db, strdelegate_authorizer f, object user_data)
		{
			delegate_authorizer f2 = ((f != null) ? ((delegate_authorizer)((object ob, int a, utf8z p0, utf8z p1, utf8z dbname, utf8z v) => f(ob, a, p0.utf8_to_string(), p1.utf8_to_string(), dbname.utf8_to_string(), v.utf8_to_string()))) : null);
			return sqlite3_set_authorizer(db, f2, user_data);
		}

		public static int sqlite3_win32_set_directory(int typ, string path)
		{
			return Provider.sqlite3_win32_set_directory(typ, path.to_utf8z());
		}

		public static int sqlite3_keyword_count()
		{
			return Provider.sqlite3_keyword_count();
		}

		public static int sqlite3_keyword_name(int i, out string name)
		{
			return Provider.sqlite3_keyword_name(i, out name);
		}

		public static IntPtr sqlite3_malloc(int n)
		{
			return Provider.sqlite3_malloc(n);
		}

		public static IntPtr sqlite3_malloc64(long n)
		{
			return Provider.sqlite3_malloc64(n);
		}

		public static void sqlite3_free(IntPtr p)
		{
			Provider.sqlite3_free(p);
		}

		public static IntPtr sqlite3_serialize(sqlite3 db, string schema, out long size, int flags)
		{
			return Provider.sqlite3_serialize(db, schema.to_utf8z(), out size, flags);
		}

		public static int sqlite3_deserialize(sqlite3 db, string schema, IntPtr data, long deserializedDataSize, long maxDataSize, int flags)
		{
			return Provider.sqlite3_deserialize(db, schema.to_utf8z(), data, deserializedDataSize, maxDataSize, flags);
		}
	}
	public class sqlite3_backup : SafeHandle
	{
		public override bool IsInvalid => handle == IntPtr.Zero;

		private sqlite3_backup()
			: base(IntPtr.Zero, ownsHandle: true)
		{
		}

		public static sqlite3_backup From(IntPtr p)
		{
			sqlite3_backup obj = new sqlite3_backup();
			obj.SetHandle(p);
			return obj;
		}

		protected override bool ReleaseHandle()
		{
			raw.internal_sqlite3_backup_finish(handle);
			return true;
		}

		public int manual_close()
		{
			int result = raw.internal_sqlite3_backup_finish(handle);
			handle = IntPtr.Zero;
			return result;
		}
	}
	public class sqlite3_context
	{
		private IntPtr _p;

		private object _user_data;

		public object state;

		internal object user_data => _user_data;

		internal IntPtr ptr => _p;

		protected sqlite3_context(object user_data)
		{
			_user_data = user_data;
		}

		protected void set_context_ptr(IntPtr p)
		{
			_p = p;
		}
	}
	public class sqlite3_value
	{
		private IntPtr _p;

		internal IntPtr ptr => _p;

		public sqlite3_value(IntPtr p)
		{
			_p = p;
		}
	}
	public class sqlite3_blob : SafeHandle
	{
		public override bool IsInvalid => handle == IntPtr.Zero;

		private sqlite3_blob()
			: base(IntPtr.Zero, ownsHandle: true)
		{
		}

		internal static sqlite3_blob From(IntPtr p)
		{
			sqlite3_blob obj = new sqlite3_blob();
			obj.SetHandle(p);
			return obj;
		}

		protected override bool ReleaseHandle()
		{
			raw.internal_sqlite3_blob_close(handle);
			return true;
		}

		public int manual_close()
		{
			int result = raw.internal_sqlite3_blob_close(handle);
			handle = IntPtr.Zero;
			return result;
		}
	}
	public class sqlite3_snapshot : SafeHandle
	{
		public override bool IsInvalid => handle == IntPtr.Zero;

		private sqlite3_snapshot()
			: base(IntPtr.Zero, ownsHandle: true)
		{
		}

		internal static sqlite3_snapshot From(IntPtr p)
		{
			sqlite3_snapshot obj = new sqlite3_snapshot();
			obj.SetHandle(p);
			return obj;
		}

		protected override bool ReleaseHandle()
		{
			raw.internal_sqlite3_snapshot_free(handle);
			return true;
		}

		public void manual_close()
		{
			raw.internal_sqlite3_snapshot_free(handle);
			handle = IntPtr.Zero;
		}
	}
	public class sqlite3_stmt : SafeHandle
	{
		private sqlite3 _db;

		public override bool IsInvalid => handle == IntPtr.Zero;

		internal IntPtr ptr => handle;

		internal sqlite3 db => _db;

		internal static sqlite3_stmt From(IntPtr p, sqlite3 db)
		{
			sqlite3_stmt sqlite3_stmt2 = new sqlite3_stmt();
			sqlite3_stmt2.SetHandle(p);
			db.add_stmt(sqlite3_stmt2);
			sqlite3_stmt2._db = db;
			return sqlite3_stmt2;
		}

		private sqlite3_stmt()
			: base(IntPtr.Zero, ownsHandle: true)
		{
		}

		protected override bool ReleaseHandle()
		{
			raw.internal_sqlite3_finalize(handle);
			_db.remove_stmt(this);
			return true;
		}

		public int manual_close()
		{
			int result = raw.internal_sqlite3_finalize(handle);
			handle = IntPtr.Zero;
			_db.remove_stmt(this);
			return result;
		}
	}
	public class sqlite3 : SafeHandle
	{
		private ConcurrentDictionary<IntPtr, sqlite3_stmt> _stmts;

		private IDisposable extra;

		public override bool IsInvalid => handle == IntPtr.Zero;

		private sqlite3()
			: base(IntPtr.Zero, ownsHandle: true)
		{
		}

		protected override bool ReleaseHandle()
		{
			raw.internal_sqlite3_close_v2(handle);
			dispose_extra();
			return true;
		}

		public int manual_close_v2()
		{
			int result = raw.internal_sqlite3_close_v2(handle);
			handle = IntPtr.Zero;
			dispose_extra();
			return result;
		}

		public int manual_close()
		{
			int result = raw.internal_sqlite3_close(handle);
			handle = IntPtr.Zero;
			dispose_extra();
			return result;
		}

		internal static sqlite3 New(IntPtr p)
		{
			sqlite3 obj = new sqlite3();
			obj.SetHandle(p);
			return obj;
		}

		public void enable_sqlite3_next_stmt(bool enabled)
		{
			if (enabled)
			{
				if (_stmts == null)
				{
					_stmts = new ConcurrentDictionary<IntPtr, sqlite3_stmt>();
				}
			}
			else
			{
				_stmts = null;
			}
		}

		internal void add_stmt(sqlite3_stmt stmt)
		{
			if (_stmts != null)
			{
				_stmts[stmt.ptr] = stmt;
			}
		}

		internal sqlite3_stmt find_stmt(IntPtr p)
		{
			if (_stmts != null)
			{
				return _stmts[p];
			}
			throw new Exception("The sqlite3_next_stmt() function is disabled.  To enable it, call sqlite3.enable_sqlite3_next_stmt(true) immediately after opening the sqlite3 connection.");
		}

		internal void remove_stmt(sqlite3_stmt s)
		{
			if (_stmts != null)
			{
				_stmts.TryRemove(s.ptr, out var _);
			}
		}

		public T GetOrCreateExtra<T>(Func<T> f) where T : class, IDisposable
		{
			if (extra != null)
			{
				return (T)extra;
			}
			return (T)(extra = f());
		}

		private void dispose_extra()
		{
			if (extra != null)
			{
				extra.Dispose();
				extra = null;
			}
		}
	}
	public delegate int delegate_collation(object user_data, ReadOnlySpan<byte> s1, ReadOnlySpan<byte> s2);
	public delegate void delegate_update(object user_data, int type, utf8z database, utf8z table, long rowid);
	public delegate void delegate_log(object user_data, int errorCode, utf8z msg);
	public delegate int delegate_authorizer(object user_data, int action_code, utf8z param0, utf8z param1, utf8z dbName, utf8z inner_most_trigger_or_view);
	public delegate int delegate_exec(object user_data, IntPtr[] values, IntPtr[] names);
	public delegate int delegate_commit(object user_data);
	public delegate void delegate_rollback(object user_data);
	public delegate void delegate_trace(object user_data, utf8z statement);
	public delegate void delegate_profile(object user_data, utf8z statement, long ns);
	public delegate int delegate_progress(object user_data);
	public delegate void delegate_function_scalar(sqlite3_context ctx, object user_data, sqlite3_value[] args);
	public delegate void delegate_function_aggregate_step(sqlite3_context ctx, object user_data, sqlite3_value[] args);
	public delegate void delegate_function_aggregate_final(sqlite3_context ctx, object user_data);
	public interface ISQLite3Provider
	{
		string GetNativeLibraryName();

		int sqlite3_open(utf8z filename, out IntPtr db);

		int sqlite3_open_v2(utf8z filename, out IntPtr db, int flags, utf8z vfs);

		int sqlite3_close_v2(IntPtr db);

		int sqlite3_close(IntPtr db);

		int sqlite3_enable_shared_cache(int enable);

		void sqlite3_interrupt(sqlite3 db);

		int sqlite3__vfs__delete(utf8z vfs, utf8z pathname, int syncDir);

		int sqlite3_threadsafe();

		utf8z sqlite3_libversion();

		int sqlite3_libversion_number();

		utf8z sqlite3_sourceid();

		long sqlite3_memory_used();

		long sqlite3_memory_highwater(int resetFlag);

		long sqlite3_soft_heap_limit64(long n);

		long sqlite3_hard_heap_limit64(long n);

		int sqlite3_status(int op, out int current, out int highwater, int resetFlag);

		int sqlite3_db_readonly(sqlite3 db, utf8z dbName);

		utf8z sqlite3_db_filename(sqlite3 db, utf8z att);

		utf8z sqlite3_errmsg(sqlite3 db);

		long sqlite3_last_insert_rowid(sqlite3 db);

		int sqlite3_changes(sqlite3 db);

		int sqlite3_total_changes(sqlite3 db);

		int sqlite3_get_autocommit(sqlite3 db);

		int sqlite3_busy_timeout(sqlite3 db, int ms);

		int sqlite3_extended_result_codes(sqlite3 db, int onoff);

		int sqlite3_errcode(sqlite3 db);

		int sqlite3_extended_errcode(sqlite3 db);

		utf8z sqlite3_errstr(int rc);

		int sqlite3_prepare_v2(sqlite3 db, ReadOnlySpan<byte> sql, out IntPtr stmt, out ReadOnlySpan<byte> remain);

		int sqlite3_prepare_v3(sqlite3 db, ReadOnlySpan<byte> sql, uint flags, out IntPtr stmt, out ReadOnlySpan<byte> remain);

		[Obsolete]
		int sqlite3_prepare_v2(sqlite3 db, utf8z sql, out IntPtr stmt, out utf8z remain);

		[Obsolete]
		int sqlite3_prepare_v3(sqlite3 db, utf8z sql, uint flags, out IntPtr stmt, out utf8z remain);

		int sqlite3_step(sqlite3_stmt stmt);

		int sqlite3_finalize(IntPtr stmt);

		int sqlite3_reset(sqlite3_stmt stmt);

		int sqlite3_clear_bindings(sqlite3_stmt stmt);

		int sqlite3_stmt_status(sqlite3_stmt stmt, int op, int resetFlg);

		utf8z sqlite3_sql(sqlite3_stmt stmt);

		IntPtr sqlite3_db_handle(IntPtr stmt);

		IntPtr sqlite3_next_stmt(sqlite3 db, IntPtr stmt);

		int sqlite3_bind_zeroblob(sqlite3_stmt stmt, int index, int size);

		utf8z sqlite3_bind_parameter_name(sqlite3_stmt stmt, int index);

		int sqlite3_bind_blob(sqlite3_stmt stmt, int index, ReadOnlySpan<byte> blob);

		int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val);

		int sqlite3_bind_int(sqlite3_stmt stmt, int index, int val);

		int sqlite3_bind_int64(sqlite3_stmt stmt, int index, long val);

		int sqlite3_bind_null(sqlite3_stmt stmt, int index);

		int sqlite3_bind_text(sqlite3_stmt stmt, int index, ReadOnlySpan<byte> text);

		int sqlite3_bind_text16(sqlite3_stmt stmt, int index, ReadOnlySpan<char> text);

		int sqlite3_bind_text(sqlite3_stmt stmt, int index, utf8z text);

		int sqlite3_bind_parameter_count(sqlite3_stmt stmt);

		int sqlite3_bind_parameter_index(sqlite3_stmt stmt, utf8z strName);

		utf8z sqlite3_column_database_name(sqlite3_stmt stmt, int index);

		utf8z sqlite3_column_name(sqlite3_stmt stmt, int index);

		utf8z sqlite3_column_origin_name(sqlite3_stmt stmt, int index);

		utf8z sqlite3_column_table_name(sqlite3_stmt stmt, int index);

		utf8z sqlite3_column_text(sqlite3_stmt stmt, int index);

		int sqlite3_data_count(sqlite3_stmt stmt);

		int sqlite3_column_count(sqlite3_stmt stmt);

		double sqlite3_column_double(sqlite3_stmt stmt, int index);

		int sqlite3_column_int(sqlite3_stmt stmt, int index);

		long sqlite3_column_int64(sqlite3_stmt stmt, int index);

		ReadOnlySpan<byte> sqlite3_column_blob(sqlite3_stmt stmt, int index);

		int sqlite3_column_bytes(sqlite3_stmt stmt, int index);

		int sqlite3_column_type(sqlite3_stmt stmt, int index);

		utf8z sqlite3_column_decltype(sqlite3_stmt stmt, int index);

		int sqlite3_snapshot_get(sqlite3 db, utf8z schema, out IntPtr snap);

		int sqlite3_snapshot_cmp(sqlite3_snapshot p1, sqlite3_snapshot p2);

		int sqlite3_snapshot_open(sqlite3 db, utf8z schema, sqlite3_snapshot snap);

		int sqlite3_snapshot_recover(sqlite3 db, utf8z name);

		void sqlite3_snapshot_free(IntPtr snap);

		sqlite3_backup sqlite3_backup_init(sqlite3 destDb, utf8z destName, sqlite3 sourceDb, utf8z sourceName);

		int sqlite3_backup_step(sqlite3_backup backup, int nPage);

		int sqlite3_backup_remaining(sqlite3_backup backup);

		int sqlite3_backup_pagecount(sqlite3_backup backup);

		int sqlite3_backup_finish(IntPtr backup);

		int sqlite3_blob_open(sqlite3 db, utf8z db_utf8, utf8z table_utf8, utf8z col_utf8, long rowid, int flags, out sqlite3_blob blob);

		int sqlite3_blob_bytes(sqlite3_blob blob);

		int sqlite3_blob_reopen(sqlite3_blob blob, long rowid);

		int sqlite3_blob_write(sqlite3_blob blob, ReadOnlySpan<byte> b, int offset);

		int sqlite3_blob_read(sqlite3_blob blob, Span<byte> b, int offset);

		int sqlite3_blob_close(IntPtr blob);

		int sqlite3_config_log(delegate_log func, object v);

		void sqlite3_log(int errcode, utf8z s);

		void sqlite3_commit_hook(sqlite3 db, delegate_commit func, object v);

		void sqlite3_rollback_hook(sqlite3 db, delegate_rollback func, object v);

		void sqlite3_trace(sqlite3 db, delegate_trace func, object v);

		void sqlite3_profile(sqlite3 db, delegate_profile func, object v);

		void sqlite3_progress_handler(sqlite3 db, int instructions, delegate_progress func, object v);

		void sqlite3_update_hook(sqlite3 db, delegate_update func, object v);

		int sqlite3_create_collation(sqlite3 db, byte[] name, object v, delegate_collation func);

		int sqlite3_create_function(sqlite3 db, byte[] name, int nArg, int flags, object v, delegate_function_scalar func);

		int sqlite3_create_function(sqlite3 db, byte[] name, int nArg, int flags, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final);

		int sqlite3_db_status(sqlite3 db, int op, out int current, out int highest, int resetFlg);

		void sqlite3_result_blob(IntPtr context, ReadOnlySpan<byte> val);

		void sqlite3_result_double(IntPtr context, double val);

		void sqlite3_result_error(IntPtr context, ReadOnlySpan<byte> strErr);

		void sqlite3_result_error(IntPtr context, utf8z strErr);

		void sqlite3_result_int(IntPtr context, int val);

		void sqlite3_result_int64(IntPtr context, long val);

		void sqlite3_result_null(IntPtr context);

		void sqlite3_result_text(IntPtr context, ReadOnlySpan<byte> val);

		void sqlite3_result_text(IntPtr context, utf8z val);

		void sqlite3_result_zeroblob(IntPtr context, int n);

		void sqlite3_result_error_toobig(IntPtr context);

		void sqlite3_result_error_nomem(IntPtr context);

		void sqlite3_result_error_code(IntPtr context, int code);

		ReadOnlySpan<byte> sqlite3_value_blob(IntPtr p);

		int sqlite3_value_bytes(IntPtr p);

		double sqlite3_value_double(IntPtr p);

		int sqlite3_value_int(IntPtr p);

		long sqlite3_value_int64(IntPtr p);

		int sqlite3_value_type(IntPtr p);

		utf8z sqlite3_value_text(IntPtr p);

		int sqlite3_stmt_isexplain(sqlite3_stmt stmt);

		int sqlite3_stmt_busy(sqlite3_stmt stmt);

		int sqlite3_stmt_readonly(sqlite3_stmt stmt);

		int sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec callback, object user_data, out IntPtr errMsg);

		int sqlite3_complete(utf8z sql);

		int sqlite3_compileoption_used(utf8z sql);

		utf8z sqlite3_compileoption_get(int n);

		int sqlite3_wal_autocheckpoint(sqlite3 db, int n);

		int sqlite3_wal_checkpoint(sqlite3 db, utf8z dbName);

		int sqlite3_wal_checkpoint_v2(sqlite3 db, utf8z dbName, int eMode, out int logSize, out int framesCheckPointed);

		int sqlite3_table_column_metadata(sqlite3 db, utf8z dbName, utf8z tblName, utf8z colName, out utf8z dataType, out utf8z collSeq, out int notNull, out int primaryKey, out int autoInc);

		int sqlite3_set_authorizer(sqlite3 db, delegate_authorizer authorizer, object user_data);

		int sqlite3_stricmp(IntPtr p, IntPtr q);

		int sqlite3_strnicmp(IntPtr p, IntPtr q, int n);

		IntPtr sqlite3_malloc(int n);

		IntPtr sqlite3_malloc64(long n);

		void sqlite3_free(IntPtr p);

		int sqlite3_key(sqlite3 db, ReadOnlySpan<byte> key);

		int sqlite3_key_v2(sqlite3 db, utf8z dbname, ReadOnlySpan<byte> key);

		int sqlite3_rekey(sqlite3 db, ReadOnlySpan<byte> key);

		int sqlite3_rekey_v2(sqlite3 db, utf8z dbname, ReadOnlySpan<byte> key);

		int sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8z zProc, out utf8z pzErrMsg);

		int sqlite3_initialize();

		int sqlite3_shutdown();

		int sqlite3_limit(sqlite3 db, int id, int newVal);

		int sqlite3_config(int op);

		int sqlite3_config(int op, int val);

		int sqlite3_db_config(sqlite3 db, int op, utf8z val);

		int sqlite3_db_config(sqlite3 db, int op, int val, out int result);

		int sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1);

		int sqlite3_enable_load_extension(sqlite3 db, int enable);

		int sqlite3_win32_set_directory(int typ, utf8z path);

		int sqlite3_keyword_count();

		int sqlite3_keyword_name(int i, out string name);

		IntPtr sqlite3_serialize(sqlite3 db, utf8z schema, out long size, int flags);

		int sqlite3_deserialize(sqlite3 db, utf8z schema, IntPtr data, long szDb, long szBuf, int flags);
	}
	internal static class util
	{
		public static utf8z to_utf8z(this string s)
		{
			return utf8z.FromString(s);
		}

		public static byte[] to_utf8_with_z(this string sourceText)
		{
			if (sourceText == null)
			{
				return null;
			}
			byte[] array = new byte[Encoding.UTF8.GetByteCount(sourceText) + 1];
			int bytes = Encoding.UTF8.GetBytes(sourceText, 0, sourceText.Length, array, 0);
			array[bytes] = 0;
			return array;
		}

		private static int my_strlen(IntPtr nativeString)
		{
			int i = 0;
			if (nativeString != IntPtr.Zero)
			{
				for (; Marshal.ReadByte(nativeString, i) > 0; i++)
				{
				}
			}
			return i;
		}

		public static string from_utf8_z(IntPtr nativeString)
		{
			return from_utf8(nativeString, my_strlen(nativeString));
		}

		public unsafe static string from_utf8(IntPtr nativeString, int size)
		{
			string result = null;
			if (nativeString != IntPtr.Zero)
			{
				result = Encoding.UTF8.GetString((byte*)nativeString.ToPointer(), size);
			}
			return result;
		}
	}
	public readonly ref struct utf8z
	{
		private readonly ReadOnlySpan<byte> sp;

		public ref readonly byte GetPinnableReference()
		{
			return ref sp.GetPinnableReference();
		}

		private utf8z(ReadOnlySpan<byte> a)
		{
			sp = a;
		}

		public static utf8z FromSpan(ReadOnlySpan<byte> span)
		{
			if (span.Length > 0 && span[span.Length - 1] != 0)
			{
				throw new ArgumentException("zero terminator required");
			}
			return new utf8z(span);
		}

		public static utf8z FromString(string s)
		{
			if (s == null)
			{
				return new utf8z(ReadOnlySpan<byte>.Empty);
			}
			return new utf8z(s.to_utf8_with_z());
		}

		private unsafe static long my_strlen(byte* p)
		{
			byte* ptr;
			for (ptr = p; *ptr != 0; ptr++)
			{
			}
			return ptr - p;
		}

		private unsafe static ReadOnlySpan<byte> find_zero_terminator(byte* p)
		{
			int num = (int)my_strlen(p);
			return new ReadOnlySpan<byte>(p, num + 1);
		}

		public unsafe static utf8z FromPtr(byte* p)
		{
			if (p == null)
			{
				return new utf8z(ReadOnlySpan<byte>.Empty);
			}
			return new utf8z(find_zero_terminator(p));
		}

		public unsafe static utf8z FromPtrLen(byte* p, int len)
		{
			if (p == null)
			{
				return new utf8z(ReadOnlySpan<byte>.Empty);
			}
			return FromSpan(new ReadOnlySpan<byte>(p, len + 1));
		}

		public unsafe static utf8z FromIntPtr(IntPtr p)
		{
			if (p == IntPtr.Zero)
			{
				return new utf8z(ReadOnlySpan<byte>.Empty);
			}
			return new utf8z(find_zero_terminator((byte*)p.ToPointer()));
		}

		public unsafe string utf8_to_string()
		{
			if (sp.Length == 0)
			{
				return null;
			}
			fixed (byte* bytes = sp)
			{
				return Encoding.UTF8.GetString(bytes, sp.Length - 1);
			}
		}

		public static byte[] GetZeroTerminatedUTF8Bytes(string value)
		{
			return value.to_utf8_with_z();
		}
	}
	public sealed class PreserveAttribute : Attribute
	{
		public bool AllMembers;

		public bool Conditional;
	}
	public sealed class MonoPInvokeCallbackAttribute : Attribute
	{
		public MonoPInvokeCallbackAttribute(Type t)
		{
		}
	}
	public class SafeGCHandle : SafeHandle
	{
		public override bool IsInvalid => handle == IntPtr.Zero;

		public SafeGCHandle(object v, GCHandleType typ)
			: base(IntPtr.Zero, ownsHandle: true)
		{
			if (v != null)
			{
				GCHandle value = GCHandle.Alloc(v, typ);
				SetHandle(GCHandle.ToIntPtr(value));
			}
		}

		protected override bool ReleaseHandle()
		{
			GCHandle.FromIntPtr(handle).Free();
			return true;
		}
	}
	public class hook_handle : SafeGCHandle
	{
		public hook_handle(object target)
			: base(target, GCHandleType.Normal)
		{
		}

		public IDisposable ForDispose()
		{
			if (IsInvalid)
			{
				return null;
			}
			return this;
		}
	}
	internal class CompareBuf : EqualityComparer<byte[]>
	{
		private Func<IntPtr, IntPtr, int, bool> _f;

		public CompareBuf(Func<IntPtr, IntPtr, int, bool> f)
		{
			_f = f;
		}

		public override bool Equals(byte[] p1, byte[] p2)
		{
			if (p1.Length != p2.Length)
			{
				return false;
			}
			GCHandle gCHandle = GCHandle.Alloc(p1, GCHandleType.Pinned);
			GCHandle gCHandle2 = GCHandle.Alloc(p2, GCHandleType.Pinned);
			bool result = _f(gCHandle.AddrOfPinnedObject(), gCHandle2.AddrOfPinnedObject(), p1.Length);
			gCHandle.Free();
			gCHandle2.Free();
			return result;
		}

		public override int GetHashCode(byte[] p)
		{
			return p.Length;
		}
	}
	internal class FuncName
	{
		public byte[] name { get; private set; }

		public int n { get; private set; }

		public FuncName(byte[] _name, int _n)
		{
			name = _name;
			n = _n;
		}
	}
	internal class CompareFuncName : EqualityComparer<FuncName>
	{
		private IEqualityComparer<byte[]> _ptrlencmp;

		public CompareFuncName(IEqualityComparer<byte[]> ptrlencmp)
		{
			_ptrlencmp = ptrlencmp;
		}

		public override bool Equals(FuncName p1, FuncName p2)
		{
			if (p1.n != p2.n)
			{
				return false;
			}
			return _ptrlencmp.Equals(p1.name, p2.name);
		}

		public override int GetHashCode(FuncName p)
		{
			return p.n + p.name.Length;
		}
	}
	public class hook_handles : IDisposable
	{
		private readonly ConcurrentDictionary<byte[], IDisposable> collation;

		private readonly ConcurrentDictionary<FuncName, IDisposable> scalar;

		private readonly ConcurrentDictionary<FuncName, IDisposable> agg;

		public IDisposable update;

		public IDisposable rollback;

		public IDisposable commit;

		public IDisposable trace;

		public IDisposable profile;

		public IDisposable progress;

		public IDisposable authorizer;

		public hook_handles(Func<IntPtr, IntPtr, int, bool> f)
		{
			CompareBuf compareBuf = new CompareBuf(f);
			collation = new ConcurrentDictionary<byte[], IDisposable>(compareBuf);
			scalar = new ConcurrentDictionary<FuncName, IDisposable>(new CompareFuncName(compareBuf));
			agg = new ConcurrentDictionary<FuncName, IDisposable>(new CompareFuncName(compareBuf));
		}

		public bool RemoveScalarFunction(byte[] name, int nargs)
		{
			FuncName key = new FuncName(name, nargs);
			if (scalar.TryRemove(key, out var value))
			{
				value.Dispose();
				return true;
			}
			return false;
		}

		public void AddScalarFunction(byte[] name, int nargs, IDisposable d)
		{
			FuncName key = new FuncName(name, nargs);
			scalar[key] = d;
		}

		public bool RemoveAggFunction(byte[] name, int nargs)
		{
			FuncName key = new FuncName(name, nargs);
			if (agg.TryRemove(key, out var value))
			{
				value.Dispose();
				return true;
			}
			return false;
		}

		public void AddAggFunction(byte[] name, int nargs, IDisposable d)
		{
			FuncName key = new FuncName(name, nargs);
			agg[key] = d;
		}

		public bool RemoveCollation(byte[] name)
		{
			if (collation.TryRemove(name, out var value))
			{
				value.Dispose();
				return true;
			}
			return false;
		}

		public void AddCollation(byte[] name, IDisposable d)
		{
			collation[name] = d;
		}

		public void Dispose()
		{
			foreach (IDisposable value in collation.Values)
			{
				value.Dispose();
			}
			foreach (IDisposable value2 in scalar.Values)
			{
				value2.Dispose();
			}
			foreach (IDisposable value3 in agg.Values)
			{
				value3.Dispose();
			}
			if (update != null)
			{
				update.Dispose();
			}
			if (rollback != null)
			{
				rollback.Dispose();
			}
			if (commit != null)
			{
				commit.Dispose();
			}
			if (trace != null)
			{
				trace.Dispose();
			}
			if (profile != null)
			{
				profile.Dispose();
			}
			if (progress != null)
			{
				progress.Dispose();
			}
			if (authorizer != null)
			{
				authorizer.Dispose();
			}
		}
	}
	public class log_hook_info
	{
		private delegate_log _func;

		private object _user_data;

		public log_hook_info(delegate_log func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static log_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as log_hook_info;
		}

		public void call(int rc, utf8z msg)
		{
			_func(_user_data, rc, msg);
		}
	}
	public class commit_hook_info
	{
		public delegate_commit _func { get; private set; }

		public object _user_data { get; private set; }

		public commit_hook_info(delegate_commit func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public int call()
		{
			return _func(_user_data);
		}

		public static commit_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as commit_hook_info;
		}
	}
	public class rollback_hook_info
	{
		private delegate_rollback _func;

		private object _user_data;

		public rollback_hook_info(delegate_rollback func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static rollback_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as rollback_hook_info;
		}

		public void call()
		{
			_func(_user_data);
		}
	}
	public class trace_hook_info
	{
		private delegate_trace _func;

		private object _user_data;

		public trace_hook_info(delegate_trace func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static trace_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as trace_hook_info;
		}

		public void call(utf8z s)
		{
			_func(_user_data, s);
		}
	}
	public class profile_hook_info
	{
		private delegate_profile _func;

		private object _user_data;

		public profile_hook_info(delegate_profile func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static profile_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as profile_hook_info;
		}

		public void call(utf8z s, long elapsed)
		{
			_func(_user_data, s, elapsed);
		}
	}
	public class progress_hook_info
	{
		private delegate_progress _func;

		private object _user_data;

		public progress_hook_info(delegate_progress func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static progress_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as progress_hook_info;
		}

		public int call()
		{
			return _func(_user_data);
		}
	}
	public class update_hook_info
	{
		private delegate_update _func;

		private object _user_data;

		public update_hook_info(delegate_update func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static update_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as update_hook_info;
		}

		public void call(int typ, utf8z db, utf8z tbl, long rowid)
		{
			_func(_user_data, typ, db, tbl, rowid);
		}
	}
	public class collation_hook_info
	{
		private delegate_collation _func;

		private object _user_data;

		public collation_hook_info(delegate_collation func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static collation_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as collation_hook_info;
		}

		public int call(ReadOnlySpan<byte> s1, ReadOnlySpan<byte> s2)
		{
			return _func(_user_data, s1, s2);
		}
	}
	public class exec_hook_info
	{
		private delegate_exec _func;

		private object _user_data;

		public exec_hook_info(delegate_exec func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static exec_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as exec_hook_info;
		}

		public int call(int n, IntPtr values_ptr, IntPtr names_ptr)
		{
			IntPtr[] array = new IntPtr[n];
			IntPtr[] array2 = new IntPtr[n];
			int num = Marshal.SizeOf(typeof(IntPtr));
			for (int i = 0; i < n; i++)
			{
				IntPtr intPtr = Marshal.ReadIntPtr(values_ptr, i * num);
				array[i] = intPtr;
				intPtr = Marshal.ReadIntPtr(names_ptr, i * num);
				array2[i] = intPtr;
			}
			return _func(_user_data, array, array2);
		}
	}
	public class function_hook_info
	{
		private class agg_sqlite3_context : sqlite3_context
		{
			public agg_sqlite3_context(object v)
				: base(v)
			{
			}

			public void fix_ptr(IntPtr p)
			{
				set_context_ptr(p);
			}
		}

		private class scalar_sqlite3_context : sqlite3_context
		{
			public scalar_sqlite3_context(IntPtr p, object v)
				: base(v)
			{
				set_context_ptr(p);
			}
		}

		private delegate_function_scalar _func_scalar;

		private delegate_function_aggregate_step _func_step;

		private delegate_function_aggregate_final _func_final;

		private object _user_data;

		public function_hook_info(delegate_function_scalar func_scalar, object user_data)
		{
			_func_scalar = func_scalar;
			_user_data = user_data;
		}

		public function_hook_info(delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final, object user_data)
		{
			_func_step = func_step;
			_func_final = func_final;
			_user_data = user_data;
		}

		public static function_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as function_hook_info;
		}

		private sqlite3_context get_context(IntPtr context, IntPtr agg_context)
		{
			IntPtr intPtr = Marshal.ReadIntPtr(agg_context);
			agg_sqlite3_context agg_sqlite3_context;
			if (intPtr == IntPtr.Zero)
			{
				agg_sqlite3_context = new agg_sqlite3_context(_user_data);
				GCHandle gCHandle = GCHandle.Alloc(agg_sqlite3_context);
				Marshal.WriteIntPtr(agg_context, (IntPtr)gCHandle);
			}
			else
			{
				agg_sqlite3_context = ((GCHandle)intPtr).Target as agg_sqlite3_context;
			}
			agg_sqlite3_context.fix_ptr(context);
			return agg_sqlite3_context;
		}

		public void call_scalar(IntPtr context, int num_args, IntPtr argsptr)
		{
			scalar_sqlite3_context ctx = new scalar_sqlite3_context(context, _user_data);
			sqlite3_value[] array = new sqlite3_value[num_args];
			int num = Marshal.SizeOf(typeof(IntPtr));
			for (int i = 0; i < num_args; i++)
			{
				IntPtr p = Marshal.ReadIntPtr(argsptr, i * num);
				array[i] = new sqlite3_value(p);
			}
			_func_scalar(ctx, _user_data, array);
		}

		public void call_step(IntPtr context, IntPtr agg_context, int num_args, IntPtr argsptr)
		{
			sqlite3_context ctx = get_context(context, agg_context);
			sqlite3_value[] array = new sqlite3_value[num_args];
			int num = Marshal.SizeOf(typeof(IntPtr));
			for (int i = 0; i < num_args; i++)
			{
				IntPtr p = Marshal.ReadIntPtr(argsptr, i * num);
				array[i] = new sqlite3_value(p);
			}
			_func_step(ctx, _user_data, array);
		}

		public void call_final(IntPtr context, IntPtr agg_context)
		{
			sqlite3_context ctx = get_context(context, agg_context);
			_func_final(ctx, _user_data);
			((GCHandle)Marshal.ReadIntPtr(agg_context)).Free();
		}
	}
	public class authorizer_hook_info
	{
		private delegate_authorizer _func;

		private object _user_data;

		public authorizer_hook_info(delegate_authorizer func, object v)
		{
			_func = func;
			_user_data = v;
		}

		public static authorizer_hook_info from_ptr(IntPtr p)
		{
			return ((GCHandle)p).Target as authorizer_hook_info;
		}

		public int call(int action_code, utf8z param0, utf8z param1, utf8z dbName, utf8z inner_most_trigger_or_view)
		{
			return _func(_user_data, action_code, param0, param1, dbName, inner_most_trigger_or_view);
		}
	}
	public sealed class EntryPointAttribute : Attribute
	{
		public string Name { get; private set; }

		public EntryPointAttribute(string name)
		{
			Name = name;
		}
	}
	public interface IGetFunctionPointer
	{
		IntPtr GetFunctionPointer(string name);
	}
}

plugins/UKSQLite/SQLitePCLRaw.provider.e_sqlite3.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SourceGear")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright 2014-2025 SourceGear, LLC")]
[assembly: AssemblyDescription("SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite")]
[assembly: AssemblyFileVersion("3.0.2.2801")]
[assembly: AssemblyInformationalVersion("3.0.2+ca83fcd795385c6ac99b0f9680d000f27f35c1b4")]
[assembly: AssemblyTitle("SQLitePCLRaw.provider.e_sqlite3")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/ericsink/SQLitePCL.raw")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.2.2801")]
[module: UnverifiableCode]
namespace SQLitePCL;

[Preserve(AllMembers = true)]
public sealed class SQLite3Provider_e_sqlite3 : ISQLite3Provider
{
	private struct sqlite3_vfs
	{
		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public unsafe delegate int SQLiteDeleteDelegate(IntPtr pVfs, byte* zName, int syncDir);

		public int iVersion;

		public int szOsFile;

		public int mxPathname;

		public IntPtr pNext;

		public IntPtr zName;

		public IntPtr pAppData;

		public IntPtr xOpen;

		public SQLiteDeleteDelegate xDelete;

		public IntPtr xAccess;

		public IntPtr xFullPathname;

		public IntPtr xDlOpen;

		public IntPtr xDlError;

		public IntPtr xDlSym;

		public IntPtr xDlClose;

		public IntPtr xRandomness;

		public IntPtr xSleep;

		public IntPtr xCurrentTime;

		public IntPtr xGetLastError;
	}

	private static class NativeMethods
	{
		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_log(IntPtr pUserData, int errorCode, IntPtr pMessage);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_scalar_function(IntPtr context, int nArgs, IntPtr argsptr);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_agg_function_step(IntPtr context, int nArgs, IntPtr argsptr);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_agg_function_final(IntPtr context);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_destroy(IntPtr p);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate int callback_collation(IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_update(IntPtr p, int typ, IntPtr db, IntPtr tbl, long rowid);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate int callback_commit(IntPtr puser);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_profile(IntPtr puser, IntPtr statement, long elapsed);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate int callback_progress_handler(IntPtr puser);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate int callback_authorizer(IntPtr puser, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_trace(IntPtr puser, IntPtr statement);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate void callback_rollback(IntPtr puser);

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		public delegate int callback_exec(IntPtr db, int n, IntPtr values, IntPtr names);

		private const string SQLITE_DLL = "e_sqlite3";

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_close(IntPtr db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_close_v2(IntPtr db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_enable_shared_cache(int enable);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_interrupt(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_finalize(IntPtr stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_reset(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_clear_bindings(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_stmt_status(sqlite3_stmt stm, int op, int resetFlg);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_bind_parameter_name(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_database_name(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_decltype(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_name(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_origin_name(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_table_name(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_column_text(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_errmsg(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_db_readonly(sqlite3 db, byte* dbName);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_db_filename(sqlite3 db, byte* att);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_prepare_v2(sqlite3 db, byte* pSql, int nBytes, out IntPtr stmt, out byte* ptrRemain);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_prepare_v3(sqlite3 db, byte* pSql, int nBytes, uint flags, out IntPtr stmt, out byte* ptrRemain);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_db_status(sqlite3 db, int op, out int current, out int highest, int resetFlg);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_complete(byte* pSql);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_compileoption_used(byte* pSql);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_compileoption_get(int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_table_column_metadata(sqlite3 db, byte* dbName, byte* tblName, byte* colName, out byte* ptrDataType, out byte* ptrCollSeq, out int notNull, out int primaryKey, out int autoInc);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_value_text(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_enable_load_extension(sqlite3 db, int enable);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_limit(sqlite3 db, int id, int newVal);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_initialize();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_shutdown();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_libversion();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_libversion_number();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_threadsafe();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_sourceid();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_malloc(int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_malloc64(long n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_realloc(IntPtr p, int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_free(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_stricmp(IntPtr p, IntPtr q);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_strnicmp(IntPtr p, IntPtr q, int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_open(byte* filename, out IntPtr db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_open_v2(byte* filename, out IntPtr db, int flags, byte* vfs);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern IntPtr sqlite3_vfs_find(byte* vfs);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_last_insert_rowid(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_changes(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_total_changes(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_memory_used();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_memory_highwater(int resetFlag);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_soft_heap_limit64(long n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_hard_heap_limit64(long n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_status(int op, out int current, out int highwater, int resetFlag);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_busy_timeout(sqlite3 db, int ms);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_bind_blob(sqlite3_stmt stmt, int index, byte* val, int nSize, IntPtr nTransient);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_zeroblob(sqlite3_stmt stmt, int index, int size);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_double(sqlite3_stmt stmt, int index, double val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_int(sqlite3_stmt stmt, int index, int val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_int64(sqlite3_stmt stmt, int index, long val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_null(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_bind_text(sqlite3_stmt stmt, int index, byte* val, int nlen, IntPtr pvReserved);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_bind_text16(sqlite3_stmt stmt, int index, char* val, int nlen, IntPtr pvReserved);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_bind_parameter_count(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_bind_parameter_index(sqlite3_stmt stmt, byte* strName);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_column_count(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_data_count(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_step(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_sql(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern double sqlite3_column_double(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_column_int(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_column_int64(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_column_blob(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_column_bytes(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_column_type(sqlite3_stmt stmt, int index);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_aggregate_count(IntPtr context);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_value_blob(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_value_bytes(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern double sqlite3_value_double(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_value_int(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern long sqlite3_value_int64(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_value_type(IntPtr p);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_user_data(IntPtr context);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_blob(IntPtr context, IntPtr val, int nSize, IntPtr pvReserved);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_double(IntPtr context, double val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern void sqlite3_result_error(IntPtr context, byte* strErr, int nLen);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_int(IntPtr context, int val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_int64(IntPtr context, long val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_null(IntPtr context);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern void sqlite3_result_text(IntPtr context, byte* val, int nLen, IntPtr pvReserved);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_zeroblob(IntPtr context, int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_error_toobig(IntPtr context);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_error_nomem(IntPtr context);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_result_error_code(IntPtr context, int code);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_key(sqlite3 db, byte* key, int keylen);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_key_v2(sqlite3 db, byte* dbname, byte* key, int keylen);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_rekey(sqlite3 db, byte* key, int keylen);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_rekey_v2(sqlite3 db, byte* dbname, byte* key, int keylen);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_config", ExactSpelling = true)]
		public static extern int sqlite3_config_none(int op);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_config", ExactSpelling = true)]
		public static extern int sqlite3_config_int(int op, int val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_config", ExactSpelling = true)]
		public static extern int sqlite3_config_int_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_config", ExactSpelling = true)]
		public static extern int sqlite3_config_log(int op, callback_log func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_config", ExactSpelling = true)]
		public static extern int sqlite3_config_log_arm64cc(int op, IntPtr dummy1, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, callback_log func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public unsafe static extern int sqlite3_db_config_charptr(sqlite3 db, int op, byte* val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public unsafe static extern int sqlite3_db_config_charptr_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, byte* val);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public unsafe static extern int sqlite3_db_config_int_outint(sqlite3 db, int op, int val, int* result);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public unsafe static extern int sqlite3_db_config_int_outint_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, int val, int* result);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public static extern int sqlite3_db_config_intptr_int_int(sqlite3 db, int op, IntPtr ptr, int int0, int int1);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_db_config", ExactSpelling = true)]
		public static extern int sqlite3_db_config_intptr_int_int_arm64cc(sqlite3 db, int op, IntPtr dummy2, IntPtr dummy3, IntPtr dummy4, IntPtr dummy5, IntPtr dummy6, IntPtr dummy7, IntPtr ptr, int int0, int int1);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_create_collation(sqlite3 db, byte[] strName, int nType, hook_handle pvUser, callback_collation func);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_update_hook(sqlite3 db, callback_update func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_commit_hook(sqlite3 db, callback_commit func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_profile(sqlite3 db, callback_profile func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_progress_handler(sqlite3 db, int instructions, callback_progress_handler func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_trace(sqlite3 db, callback_trace func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_rollback_hook(sqlite3 db, callback_rollback func, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_db_handle(IntPtr stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern IntPtr sqlite3_next_stmt(sqlite3 db, IntPtr stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_stmt_isexplain(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_stmt_busy(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_stmt_readonly(sqlite3_stmt stmt);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_exec(sqlite3 db, byte* strSql, callback_exec cb, hook_handle pvParam, out IntPtr errMsg);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_get_autocommit(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_extended_result_codes(sqlite3 db, int onoff);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_errcode(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_extended_errcode(sqlite3 db);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern byte* sqlite3_errstr(int rc);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern void sqlite3_log(int iErrCode, byte* zFormat);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_file_control(sqlite3 db, byte[] zDbName, int op, IntPtr pArg);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern sqlite3_backup sqlite3_backup_init(sqlite3 destDb, byte* zDestName, sqlite3 sourceDb, byte* zSourceName);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_backup_step(sqlite3_backup backup, int nPage);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_backup_remaining(sqlite3_backup backup);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_backup_pagecount(sqlite3_backup backup);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_backup_finish(IntPtr backup);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_snapshot_get(sqlite3 db, byte* schema, out IntPtr snap);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_snapshot_open(sqlite3 db, byte* schema, sqlite3_snapshot snap);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_snapshot_recover(sqlite3 db, byte* name);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_snapshot_cmp(sqlite3_snapshot p1, sqlite3_snapshot p2);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern void sqlite3_snapshot_free(IntPtr snap);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_blob_open(sqlite3 db, byte* sdb, byte* table, byte* col, long rowid, int flags, out sqlite3_blob blob);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_blob_write(sqlite3_blob blob, byte* b, int n, int offset);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_blob_read(sqlite3_blob blob, byte* b, int n, int offset);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_blob_bytes(sqlite3_blob blob);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_blob_reopen(sqlite3_blob blob, long rowid);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_blob_close(IntPtr blob);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_wal_autocheckpoint(sqlite3 db, int n);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_wal_checkpoint(sqlite3 db, byte* dbName);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_wal_checkpoint_v2(sqlite3 db, byte* dbName, int eMode, out int logSize, out int framesCheckPointed);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_set_authorizer(sqlite3 db, callback_authorizer cb, hook_handle pvUser);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_create_function_v2(sqlite3 db, byte[] strName, int nArgs, int nType, hook_handle pvUser, callback_scalar_function func, callback_agg_function_step fstep, callback_agg_function_final ffinal, callback_destroy fdestroy);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public static extern int sqlite3_keyword_count();

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_keyword_name(int i, out byte* name, out int length);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern IntPtr sqlite3_serialize(sqlite3 db, byte* schema, out long size, int flags);

		[DllImport("e_sqlite3", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
		public unsafe static extern int sqlite3_deserialize(sqlite3 db, byte* schema, IntPtr data, long szDb, long szBuf, int flags);
	}

	private const CallingConvention CALLING_CONVENTION = CallingConvention.Cdecl;

	private static readonly bool IsArm64cc = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 && (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")));

	private readonly NativeMethods.callback_commit commit_hook_bridge = commit_hook_bridge_impl;

	private readonly NativeMethods.callback_scalar_function scalar_function_hook_bridge = scalar_function_hook_bridge_impl;

	private static hook_handle disp_log_hook_handle;

	private readonly NativeMethods.callback_log log_hook_bridge = log_hook_bridge_impl;

	private readonly NativeMethods.callback_agg_function_step agg_function_step_hook_bridge = agg_function_step_hook_bridge_impl;

	private readonly NativeMethods.callback_agg_function_final agg_function_final_hook_bridge = agg_function_final_hook_bridge_impl;

	private readonly NativeMethods.callback_collation collation_hook_bridge = collation_hook_bridge_impl;

	private readonly NativeMethods.callback_update update_hook_bridge = update_hook_bridge_impl;

	private readonly NativeMethods.callback_rollback rollback_hook_bridge = rollback_hook_bridge_impl;

	private readonly NativeMethods.callback_trace trace_hook_bridge = trace_hook_bridge_impl;

	private readonly NativeMethods.callback_profile profile_hook_bridge = profile_hook_bridge_impl;

	private readonly NativeMethods.callback_progress_handler progress_handler_hook_bridge = progress_handler_hook_bridge_impl;

	private readonly NativeMethods.callback_authorizer authorizer_hook_bridge = authorizer_hook_bridge_impl;

	string ISQLite3Provider.GetNativeLibraryName()
	{
		return "e_sqlite3";
	}

	private bool my_streq(IntPtr p, IntPtr q, int len)
	{
		return NativeMethods.sqlite3_strnicmp(p, q, len) == 0;
	}

	private hook_handles get_hooks(sqlite3 db)
	{
		return db.GetOrCreateExtra<hook_handles>((Func<hook_handles>)(() => new hook_handles((Func<IntPtr, IntPtr, int, bool>)my_streq)));
	}

	int ISQLite3Provider.sqlite3_win32_set_directory(int typ, utf8z path)
	{
		return 1;
	}

	unsafe int ISQLite3Provider.sqlite3_open(utf8z filename, out IntPtr db)
	{
		fixed (byte* filename2 = ((utf8z)(ref filename)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_open(filename2, out db);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_open_v2(utf8z filename, out IntPtr db, int flags, utf8z vfs)
	{
		fixed (byte* filename2 = ((utf8z)(ref filename)).GetPinnableReference())
		{
			fixed (byte* vfs2 = ((utf8z)(ref vfs)).GetPinnableReference())
			{
				return NativeMethods.sqlite3_open_v2(filename2, out db, flags, vfs2);
			}
		}
	}

	unsafe int ISQLite3Provider.sqlite3__vfs__delete(utf8z vfs, utf8z filename, int syncDir)
	{
		fixed (byte* vfs2 = ((utf8z)(ref vfs)).GetPinnableReference())
		{
			fixed (byte* zName = ((utf8z)(ref filename)).GetPinnableReference())
			{
				IntPtr intPtr = NativeMethods.sqlite3_vfs_find(vfs2);
				return ((sqlite3_vfs)Marshal.PtrToStructure(intPtr, typeof(sqlite3_vfs))).xDelete(intPtr, zName, 1);
			}
		}
	}

	int ISQLite3Provider.sqlite3_close_v2(IntPtr db)
	{
		return NativeMethods.sqlite3_close_v2(db);
	}

	int ISQLite3Provider.sqlite3_close(IntPtr db)
	{
		return NativeMethods.sqlite3_close(db);
	}

	IntPtr ISQLite3Provider.sqlite3_malloc(int n)
	{
		return NativeMethods.sqlite3_malloc(n);
	}

	IntPtr ISQLite3Provider.sqlite3_malloc64(long n)
	{
		return NativeMethods.sqlite3_malloc64(n);
	}

	void ISQLite3Provider.sqlite3_free(IntPtr p)
	{
		NativeMethods.sqlite3_free(p);
	}

	int ISQLite3Provider.sqlite3_stricmp(IntPtr p, IntPtr q)
	{
		return NativeMethods.sqlite3_stricmp(p, q);
	}

	int ISQLite3Provider.sqlite3_strnicmp(IntPtr p, IntPtr q, int n)
	{
		return NativeMethods.sqlite3_strnicmp(p, q, n);
	}

	int ISQLite3Provider.sqlite3_enable_shared_cache(int enable)
	{
		return NativeMethods.sqlite3_enable_shared_cache(enable);
	}

	void ISQLite3Provider.sqlite3_interrupt(sqlite3 db)
	{
		NativeMethods.sqlite3_interrupt(db);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_exec))]
	private static int exec_hook_bridge_impl(IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr)
	{
		return exec_hook_info.from_ptr(p).call(n, values_ptr, names_ptr);
	}

	unsafe int ISQLite3Provider.sqlite3_exec(sqlite3 db, utf8z sql, delegate_exec func, object user_data, out IntPtr errMsg)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		NativeMethods.callback_exec cb;
		exec_hook_info val;
		if (func != null)
		{
			cb = exec_hook_bridge_impl;
			val = new exec_hook_info(func, user_data);
		}
		else
		{
			cb = null;
			val = null;
		}
		hook_handle val2 = new hook_handle((object)val);
		int result;
		fixed (byte* strSql = ((utf8z)(ref sql)).GetPinnableReference())
		{
			result = NativeMethods.sqlite3_exec(db, strSql, cb, val2, out errMsg);
		}
		((SafeHandle)(object)val2).Dispose();
		return result;
	}

	unsafe int ISQLite3Provider.sqlite3_complete(utf8z sql)
	{
		fixed (byte* pSql = ((utf8z)(ref sql)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_complete(pSql);
		}
	}

	unsafe utf8z ISQLite3Provider.sqlite3_compileoption_get(int n)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_compileoption_get(n));
	}

	unsafe int ISQLite3Provider.sqlite3_compileoption_used(utf8z s)
	{
		fixed (byte* pSql = ((utf8z)(ref s)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_compileoption_used(pSql);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_table_column_metadata(sqlite3 db, utf8z dbName, utf8z tblName, utf8z colName, out utf8z dataType, out utf8z collSeq, out int notNull, out int primaryKey, out int autoInc)
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		fixed (byte* dbName2 = ((utf8z)(ref dbName)).GetPinnableReference())
		{
			fixed (byte* tblName2 = ((utf8z)(ref tblName)).GetPinnableReference())
			{
				fixed (byte* colName2 = ((utf8z)(ref colName)).GetPinnableReference())
				{
					byte* ptrDataType;
					byte* ptrCollSeq;
					int result = NativeMethods.sqlite3_table_column_metadata(db, dbName2, tblName2, colName2, out ptrDataType, out ptrCollSeq, out notNull, out primaryKey, out autoInc);
					dataType = utf8z.FromPtr(ptrDataType);
					collSeq = utf8z.FromPtr(ptrCollSeq);
					return result;
				}
			}
		}
	}

	unsafe int ISQLite3Provider.sqlite3_key(sqlite3 db, ReadOnlySpan<byte> k)
	{
		fixed (byte* key = k)
		{
			return NativeMethods.sqlite3_key(db, key, k.Length);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_key_v2(sqlite3 db, utf8z name, ReadOnlySpan<byte> k)
	{
		fixed (byte* key = k)
		{
			fixed (byte* dbname = ((utf8z)(ref name)).GetPinnableReference())
			{
				return NativeMethods.sqlite3_key_v2(db, dbname, key, k.Length);
			}
		}
	}

	unsafe int ISQLite3Provider.sqlite3_rekey(sqlite3 db, ReadOnlySpan<byte> k)
	{
		fixed (byte* key = k)
		{
			return NativeMethods.sqlite3_rekey(db, key, k.Length);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_rekey_v2(sqlite3 db, utf8z name, ReadOnlySpan<byte> k)
	{
		fixed (byte* key = k)
		{
			fixed (byte* dbname = ((utf8z)(ref name)).GetPinnableReference())
			{
				return NativeMethods.sqlite3_rekey_v2(db, dbname, key, k.Length);
			}
		}
	}

	unsafe int ISQLite3Provider.sqlite3_prepare_v2(sqlite3 db, ReadOnlySpan<byte> sql, out IntPtr stm, out ReadOnlySpan<byte> tail)
	{
		fixed (byte* ptr = sql)
		{
			byte* ptrRemain;
			int result = NativeMethods.sqlite3_prepare_v2(db, ptr, sql.Length, out stm, out ptrRemain);
			int num = (int)(ptrRemain - ptr);
			int num2 = sql.Length - num;
			if (num2 > 0)
			{
				tail = sql.Slice(num, num2);
				return result;
			}
			tail = ReadOnlySpan<byte>.Empty;
			return result;
		}
	}

	unsafe int ISQLite3Provider.sqlite3_prepare_v2(sqlite3 db, utf8z sql, out IntPtr stm, out utf8z tail)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		fixed (byte* pSql = ((utf8z)(ref sql)).GetPinnableReference())
		{
			byte* ptrRemain;
			int result = NativeMethods.sqlite3_prepare_v2(db, pSql, -1, out stm, out ptrRemain);
			tail = utf8z.FromPtr(ptrRemain);
			return result;
		}
	}

	unsafe int ISQLite3Provider.sqlite3_prepare_v3(sqlite3 db, ReadOnlySpan<byte> sql, uint flags, out IntPtr stm, out ReadOnlySpan<byte> tail)
	{
		fixed (byte* ptr = sql)
		{
			byte* ptrRemain;
			int result = NativeMethods.sqlite3_prepare_v3(db, ptr, sql.Length, flags, out stm, out ptrRemain);
			int num = (int)(ptrRemain - ptr);
			int num2 = sql.Length - num;
			if (num2 > 0)
			{
				tail = sql.Slice(num, num2);
				return result;
			}
			tail = ReadOnlySpan<byte>.Empty;
			return result;
		}
	}

	unsafe int ISQLite3Provider.sqlite3_prepare_v3(sqlite3 db, utf8z sql, uint flags, out IntPtr stm, out utf8z tail)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		fixed (byte* pSql = ((utf8z)(ref sql)).GetPinnableReference())
		{
			byte* ptrRemain;
			int result = NativeMethods.sqlite3_prepare_v3(db, pSql, -1, flags, out stm, out ptrRemain);
			tail = utf8z.FromPtr(ptrRemain);
			return result;
		}
	}

	int ISQLite3Provider.sqlite3_db_status(sqlite3 db, int op, out int current, out int highest, int resetFlg)
	{
		return NativeMethods.sqlite3_db_status(db, op, out current, out highest, resetFlg);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_sql(sqlite3_stmt stmt)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_sql(stmt));
	}

	IntPtr ISQLite3Provider.sqlite3_db_handle(IntPtr stmt)
	{
		return NativeMethods.sqlite3_db_handle(stmt);
	}

	unsafe int ISQLite3Provider.sqlite3_blob_open(sqlite3 db, utf8z db_utf8, utf8z table_utf8, utf8z col_utf8, long rowid, int flags, out sqlite3_blob blob)
	{
		fixed (byte* sdb = ((utf8z)(ref db_utf8)).GetPinnableReference())
		{
			fixed (byte* table = ((utf8z)(ref table_utf8)).GetPinnableReference())
			{
				fixed (byte* col = ((utf8z)(ref col_utf8)).GetPinnableReference())
				{
					return NativeMethods.sqlite3_blob_open(db, sdb, table, col, rowid, flags, out blob);
				}
			}
		}
	}

	int ISQLite3Provider.sqlite3_blob_bytes(sqlite3_blob blob)
	{
		return NativeMethods.sqlite3_blob_bytes(blob);
	}

	int ISQLite3Provider.sqlite3_blob_reopen(sqlite3_blob blob, long rowid)
	{
		return NativeMethods.sqlite3_blob_reopen(blob, rowid);
	}

	unsafe int ISQLite3Provider.sqlite3_blob_read(sqlite3_blob blob, Span<byte> b, int offset)
	{
		fixed (byte* b2 = b)
		{
			return NativeMethods.sqlite3_blob_read(blob, b2, b.Length, offset);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_blob_write(sqlite3_blob blob, ReadOnlySpan<byte> b, int offset)
	{
		fixed (byte* b2 = b)
		{
			return NativeMethods.sqlite3_blob_write(blob, b2, b.Length, offset);
		}
	}

	int ISQLite3Provider.sqlite3_blob_close(IntPtr blob)
	{
		return NativeMethods.sqlite3_blob_close(blob);
	}

	unsafe int ISQLite3Provider.sqlite3_snapshot_get(sqlite3 db, utf8z schema, out IntPtr snap)
	{
		fixed (byte* schema2 = ((utf8z)(ref schema)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_snapshot_get(db, schema2, out snap);
		}
	}

	int ISQLite3Provider.sqlite3_snapshot_cmp(sqlite3_snapshot p1, sqlite3_snapshot p2)
	{
		return NativeMethods.sqlite3_snapshot_cmp(p1, p2);
	}

	unsafe int ISQLite3Provider.sqlite3_snapshot_open(sqlite3 db, utf8z schema, sqlite3_snapshot snap)
	{
		fixed (byte* schema2 = ((utf8z)(ref schema)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_snapshot_open(db, schema2, snap);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_snapshot_recover(sqlite3 db, utf8z name)
	{
		fixed (byte* name2 = ((utf8z)(ref name)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_snapshot_recover(db, name2);
		}
	}

	void ISQLite3Provider.sqlite3_snapshot_free(IntPtr snap)
	{
		NativeMethods.sqlite3_snapshot_free(snap);
	}

	unsafe sqlite3_backup ISQLite3Provider.sqlite3_backup_init(sqlite3 destDb, utf8z destName, sqlite3 sourceDb, utf8z sourceName)
	{
		fixed (byte* zDestName = ((utf8z)(ref destName)).GetPinnableReference())
		{
			fixed (byte* zSourceName = ((utf8z)(ref sourceName)).GetPinnableReference())
			{
				return NativeMethods.sqlite3_backup_init(destDb, zDestName, sourceDb, zSourceName);
			}
		}
	}

	int ISQLite3Provider.sqlite3_backup_step(sqlite3_backup backup, int nPage)
	{
		return NativeMethods.sqlite3_backup_step(backup, nPage);
	}

	int ISQLite3Provider.sqlite3_backup_remaining(sqlite3_backup backup)
	{
		return NativeMethods.sqlite3_backup_remaining(backup);
	}

	int ISQLite3Provider.sqlite3_backup_pagecount(sqlite3_backup backup)
	{
		return NativeMethods.sqlite3_backup_pagecount(backup);
	}

	int ISQLite3Provider.sqlite3_backup_finish(IntPtr backup)
	{
		return NativeMethods.sqlite3_backup_finish(backup);
	}

	IntPtr ISQLite3Provider.sqlite3_next_stmt(sqlite3 db, IntPtr stmt)
	{
		return NativeMethods.sqlite3_next_stmt(db, stmt);
	}

	long ISQLite3Provider.sqlite3_last_insert_rowid(sqlite3 db)
	{
		return NativeMethods.sqlite3_last_insert_rowid(db);
	}

	int ISQLite3Provider.sqlite3_changes(sqlite3 db)
	{
		return NativeMethods.sqlite3_changes(db);
	}

	int ISQLite3Provider.sqlite3_total_changes(sqlite3 db)
	{
		return NativeMethods.sqlite3_total_changes(db);
	}

	int ISQLite3Provider.sqlite3_extended_result_codes(sqlite3 db, int onoff)
	{
		return NativeMethods.sqlite3_extended_result_codes(db, onoff);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_errstr(int rc)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_errstr(rc));
	}

	int ISQLite3Provider.sqlite3_errcode(sqlite3 db)
	{
		return NativeMethods.sqlite3_errcode(db);
	}

	int ISQLite3Provider.sqlite3_extended_errcode(sqlite3 db)
	{
		return NativeMethods.sqlite3_extended_errcode(db);
	}

	int ISQLite3Provider.sqlite3_busy_timeout(sqlite3 db, int ms)
	{
		return NativeMethods.sqlite3_busy_timeout(db, ms);
	}

	int ISQLite3Provider.sqlite3_get_autocommit(sqlite3 db)
	{
		return NativeMethods.sqlite3_get_autocommit(db);
	}

	unsafe int ISQLite3Provider.sqlite3_db_readonly(sqlite3 db, utf8z dbName)
	{
		fixed (byte* dbName2 = ((utf8z)(ref dbName)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_db_readonly(db, dbName2);
		}
	}

	unsafe utf8z ISQLite3Provider.sqlite3_db_filename(sqlite3 db, utf8z att)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		fixed (byte* att2 = ((utf8z)(ref att)).GetPinnableReference())
		{
			return utf8z.FromPtr(NativeMethods.sqlite3_db_filename(db, att2));
		}
	}

	unsafe utf8z ISQLite3Provider.sqlite3_errmsg(sqlite3 db)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_errmsg(db));
	}

	unsafe utf8z ISQLite3Provider.sqlite3_libversion()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_libversion());
	}

	int ISQLite3Provider.sqlite3_libversion_number()
	{
		return NativeMethods.sqlite3_libversion_number();
	}

	int ISQLite3Provider.sqlite3_threadsafe()
	{
		return NativeMethods.sqlite3_threadsafe();
	}

	int ISQLite3Provider.sqlite3_config(int op)
	{
		return NativeMethods.sqlite3_config_none(op);
	}

	int ISQLite3Provider.sqlite3_config(int op, int val)
	{
		if (IsArm64cc)
		{
			return NativeMethods.sqlite3_config_int_arm64cc(op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val);
		}
		return NativeMethods.sqlite3_config_int(op, val);
	}

	unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, utf8z val)
	{
		fixed (byte* val2 = ((utf8z)(ref val)).GetPinnableReference())
		{
			if (IsArm64cc)
			{
				return NativeMethods.sqlite3_db_config_charptr_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val2);
			}
			return NativeMethods.sqlite3_db_config_charptr(db, op, val2);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, int val, out int result)
	{
		int num = 0;
		int result2 = ((!IsArm64cc) ? NativeMethods.sqlite3_db_config_int_outint(db, op, val, &num) : NativeMethods.sqlite3_db_config_int_outint_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, val, &num));
		result = num;
		return result2;
	}

	int ISQLite3Provider.sqlite3_db_config(sqlite3 db, int op, IntPtr ptr, int int0, int int1)
	{
		if (IsArm64cc)
		{
			return NativeMethods.sqlite3_db_config_intptr_int_int_arm64cc(db, op, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ptr, int0, int1);
		}
		return NativeMethods.sqlite3_db_config_intptr_int_int(db, op, ptr, int0, int1);
	}

	int ISQLite3Provider.sqlite3_limit(sqlite3 db, int id, int newVal)
	{
		return NativeMethods.sqlite3_limit(db, id, newVal);
	}

	int ISQLite3Provider.sqlite3_initialize()
	{
		return NativeMethods.sqlite3_initialize();
	}

	int ISQLite3Provider.sqlite3_shutdown()
	{
		return NativeMethods.sqlite3_shutdown();
	}

	int ISQLite3Provider.sqlite3_enable_load_extension(sqlite3 db, int onoff)
	{
		return NativeMethods.sqlite3_enable_load_extension(db, onoff);
	}

	unsafe int ISQLite3Provider.sqlite3_load_extension(sqlite3 db, utf8z zFile, utf8z zProc, out utf8z pzErrMsg)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		pzErrMsg = utf8z.FromPtr((byte*)null);
		return 1;
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_commit))]
	private static int commit_hook_bridge_impl(IntPtr p)
	{
		return commit_hook_info.from_ptr(p).call();
	}

	void ISQLite3Provider.sqlite3_commit_hook(sqlite3 db, delegate_commit func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.commit != null)
		{
			val.commit.Dispose();
			val.commit = null;
		}
		NativeMethods.callback_commit func2;
		commit_hook_info val2;
		if (func != null)
		{
			func2 = commit_hook_bridge;
			val2 = new commit_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		NativeMethods.sqlite3_commit_hook(db, func2, val3);
		val.commit = val3.ForDispose();
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_scalar_function))]
	private static void scalar_function_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr)
	{
		function_hook_info.from_ptr(NativeMethods.sqlite3_user_data(context)).call_scalar(context, num_args, argsptr);
	}

	int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int nargs, int flags, object v, delegate_function_scalar func)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		val.RemoveScalarFunction(name, nargs);
		int nType = 1 | flags;
		NativeMethods.callback_scalar_function callback_scalar_function;
		function_hook_info val2;
		if (func != null)
		{
			callback_scalar_function = scalar_function_hook_bridge;
			val2 = new function_hook_info(func, v);
		}
		else
		{
			callback_scalar_function = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		int num = NativeMethods.sqlite3_create_function_v2(db, name, nargs, nType, val3, callback_scalar_function, null, null, null);
		if (num == 0 && callback_scalar_function != null)
		{
			val.AddScalarFunction(name, nargs, val3.ForDispose());
		}
		return num;
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_log))]
	private static void log_hook_bridge_impl(IntPtr p, int rc, IntPtr s)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		log_hook_info.from_ptr(p).call(rc, utf8z.FromIntPtr(s));
	}

	int ISQLite3Provider.sqlite3_config_log(delegate_log func, object v)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		if (disp_log_hook_handle != null)
		{
			((SafeHandle)(object)disp_log_hook_handle).Dispose();
			disp_log_hook_handle = null;
		}
		NativeMethods.callback_log func2;
		log_hook_info val;
		if (func != null)
		{
			func2 = log_hook_bridge;
			val = new log_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val = null;
		}
		hook_handle pvUser = (disp_log_hook_handle = new hook_handle((object)val));
		if (IsArm64cc)
		{
			return NativeMethods.sqlite3_config_log_arm64cc(16, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, func2, pvUser);
		}
		return NativeMethods.sqlite3_config_log(16, func2, pvUser);
	}

	unsafe void ISQLite3Provider.sqlite3_log(int errcode, utf8z s)
	{
		fixed (byte* zFormat = ((utf8z)(ref s)).GetPinnableReference())
		{
			NativeMethods.sqlite3_log(errcode, zFormat);
		}
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_agg_function_step))]
	private static void agg_function_step_hook_bridge_impl(IntPtr context, int num_args, IntPtr argsptr)
	{
		IntPtr intPtr = NativeMethods.sqlite3_aggregate_context(context, 8);
		function_hook_info.from_ptr(NativeMethods.sqlite3_user_data(context)).call_step(context, intPtr, num_args, argsptr);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_agg_function_final))]
	private static void agg_function_final_hook_bridge_impl(IntPtr context)
	{
		IntPtr intPtr = NativeMethods.sqlite3_aggregate_context(context, 8);
		function_hook_info.from_ptr(NativeMethods.sqlite3_user_data(context)).call_final(context, intPtr);
	}

	int ISQLite3Provider.sqlite3_create_function(sqlite3 db, byte[] name, int nargs, int flags, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		val.RemoveAggFunction(name, nargs);
		int nType = 1 | flags;
		NativeMethods.callback_agg_function_step callback_agg_function_step;
		NativeMethods.callback_agg_function_final ffinal;
		function_hook_info val2;
		if (func_step != null)
		{
			callback_agg_function_step = agg_function_step_hook_bridge;
			ffinal = agg_function_final_hook_bridge;
			val2 = new function_hook_info(func_step, func_final, v);
		}
		else
		{
			callback_agg_function_step = null;
			ffinal = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		int num = NativeMethods.sqlite3_create_function_v2(db, name, nargs, nType, val3, null, callback_agg_function_step, ffinal, null);
		if (num == 0 && callback_agg_function_step != null)
		{
			val.AddAggFunction(name, nargs, val3.ForDispose());
		}
		return num;
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_collation))]
	private unsafe static int collation_hook_bridge_impl(IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2)
	{
		collation_hook_info obj = collation_hook_info.from_ptr(p);
		ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(pv1.ToPointer(), len1);
		ReadOnlySpan<byte> readOnlySpan2 = new ReadOnlySpan<byte>(pv2.ToPointer(), len2);
		return obj.call(readOnlySpan, readOnlySpan2);
	}

	int ISQLite3Provider.sqlite3_create_collation(sqlite3 db, byte[] name, object v, delegate_collation func)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		val.RemoveCollation(name);
		NativeMethods.callback_collation callback_collation;
		collation_hook_info val2;
		if (func != null)
		{
			callback_collation = collation_hook_bridge;
			val2 = new collation_hook_info(func, v);
		}
		else
		{
			callback_collation = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		int num = NativeMethods.sqlite3_create_collation(db, name, 1, val3, callback_collation);
		if (num == 0 && callback_collation != null)
		{
			val.AddCollation(name, val3.ForDispose());
		}
		return num;
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_update))]
	private static void update_hook_bridge_impl(IntPtr p, int typ, IntPtr db, IntPtr tbl, long rowid)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		update_hook_info.from_ptr(p).call(typ, utf8z.FromIntPtr(db), utf8z.FromIntPtr(tbl), rowid);
	}

	void ISQLite3Provider.sqlite3_update_hook(sqlite3 db, delegate_update func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.update != null)
		{
			val.update.Dispose();
			val.update = null;
		}
		NativeMethods.callback_update func2;
		update_hook_info val2;
		if (func != null)
		{
			func2 = update_hook_bridge;
			val2 = new update_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.update = val3.ForDispose();
		NativeMethods.sqlite3_update_hook(db, func2, val3);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_rollback))]
	private static void rollback_hook_bridge_impl(IntPtr p)
	{
		rollback_hook_info.from_ptr(p).call();
	}

	void ISQLite3Provider.sqlite3_rollback_hook(sqlite3 db, delegate_rollback func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.rollback != null)
		{
			val.rollback.Dispose();
			val.rollback = null;
		}
		NativeMethods.callback_rollback func2;
		rollback_hook_info val2;
		if (func != null)
		{
			func2 = rollback_hook_bridge;
			val2 = new rollback_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.rollback = val3.ForDispose();
		NativeMethods.sqlite3_rollback_hook(db, func2, val3);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_trace))]
	private static void trace_hook_bridge_impl(IntPtr p, IntPtr s)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		trace_hook_info.from_ptr(p).call(utf8z.FromIntPtr(s));
	}

	void ISQLite3Provider.sqlite3_trace(sqlite3 db, delegate_trace func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.trace != null)
		{
			val.trace.Dispose();
			val.trace = null;
		}
		NativeMethods.callback_trace func2;
		trace_hook_info val2;
		if (func != null)
		{
			func2 = trace_hook_bridge;
			val2 = new trace_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.trace = val3.ForDispose();
		NativeMethods.sqlite3_trace(db, func2, val3);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_profile))]
	private static void profile_hook_bridge_impl(IntPtr p, IntPtr s, long elapsed)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		profile_hook_info.from_ptr(p).call(utf8z.FromIntPtr(s), elapsed);
	}

	void ISQLite3Provider.sqlite3_profile(sqlite3 db, delegate_profile func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.profile != null)
		{
			val.profile.Dispose();
			val.profile = null;
		}
		NativeMethods.callback_profile func2;
		profile_hook_info val2;
		if (func != null)
		{
			func2 = profile_hook_bridge;
			val2 = new profile_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.profile = val3.ForDispose();
		NativeMethods.sqlite3_profile(db, func2, val3);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_progress_handler))]
	private static int progress_handler_hook_bridge_impl(IntPtr p)
	{
		return progress_hook_info.from_ptr(p).call();
	}

	void ISQLite3Provider.sqlite3_progress_handler(sqlite3 db, int instructions, delegate_progress func, object v)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.progress != null)
		{
			val.progress.Dispose();
			val.progress = null;
		}
		NativeMethods.callback_progress_handler func2;
		progress_hook_info val2;
		if (func != null)
		{
			func2 = progress_handler_hook_bridge;
			val2 = new progress_hook_info(func, v);
		}
		else
		{
			func2 = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.progress = val3.ForDispose();
		NativeMethods.sqlite3_progress_handler(db, instructions, func2, val3);
	}

	[MonoPInvokeCallback(typeof(NativeMethods.callback_authorizer))]
	private static int authorizer_hook_bridge_impl(IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		return authorizer_hook_info.from_ptr(p).call(action_code, utf8z.FromIntPtr(param0), utf8z.FromIntPtr(param1), utf8z.FromIntPtr(dbName), utf8z.FromIntPtr(inner_most_trigger_or_view));
	}

	int ISQLite3Provider.sqlite3_set_authorizer(sqlite3 db, delegate_authorizer func, object v)
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		hook_handles val = get_hooks(db);
		if (val.authorizer != null)
		{
			val.authorizer.Dispose();
			val.authorizer = null;
		}
		NativeMethods.callback_authorizer cb;
		authorizer_hook_info val2;
		if (func != null)
		{
			cb = authorizer_hook_bridge;
			val2 = new authorizer_hook_info(func, v);
		}
		else
		{
			cb = null;
			val2 = null;
		}
		hook_handle val3 = new hook_handle((object)val2);
		val.authorizer = val3.ForDispose();
		return NativeMethods.sqlite3_set_authorizer(db, cb, val3);
	}

	long ISQLite3Provider.sqlite3_memory_used()
	{
		return NativeMethods.sqlite3_memory_used();
	}

	long ISQLite3Provider.sqlite3_memory_highwater(int resetFlag)
	{
		return NativeMethods.sqlite3_memory_highwater(resetFlag);
	}

	long ISQLite3Provider.sqlite3_soft_heap_limit64(long n)
	{
		return NativeMethods.sqlite3_soft_heap_limit64(n);
	}

	long ISQLite3Provider.sqlite3_hard_heap_limit64(long n)
	{
		return NativeMethods.sqlite3_hard_heap_limit64(n);
	}

	int ISQLite3Provider.sqlite3_status(int op, out int current, out int highwater, int resetFlag)
	{
		return NativeMethods.sqlite3_status(op, out current, out highwater, resetFlag);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_sourceid()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_sourceid());
	}

	void ISQLite3Provider.sqlite3_result_int64(IntPtr ctx, long val)
	{
		NativeMethods.sqlite3_result_int64(ctx, val);
	}

	void ISQLite3Provider.sqlite3_result_int(IntPtr ctx, int val)
	{
		NativeMethods.sqlite3_result_int(ctx, val);
	}

	void ISQLite3Provider.sqlite3_result_double(IntPtr ctx, double val)
	{
		NativeMethods.sqlite3_result_double(ctx, val);
	}

	void ISQLite3Provider.sqlite3_result_null(IntPtr stm)
	{
		NativeMethods.sqlite3_result_null(stm);
	}

	unsafe void ISQLite3Provider.sqlite3_result_error(IntPtr ctx, ReadOnlySpan<byte> val)
	{
		fixed (byte* strErr = val)
		{
			NativeMethods.sqlite3_result_error(ctx, strErr, val.Length);
		}
	}

	unsafe void ISQLite3Provider.sqlite3_result_error(IntPtr ctx, utf8z val)
	{
		fixed (byte* strErr = ((utf8z)(ref val)).GetPinnableReference())
		{
			NativeMethods.sqlite3_result_error(ctx, strErr, -1);
		}
	}

	unsafe void ISQLite3Provider.sqlite3_result_text(IntPtr ctx, ReadOnlySpan<byte> val)
	{
		fixed (byte* val2 = val)
		{
			NativeMethods.sqlite3_result_text(ctx, val2, val.Length, new IntPtr(-1));
		}
	}

	unsafe void ISQLite3Provider.sqlite3_result_text(IntPtr ctx, utf8z val)
	{
		fixed (byte* val2 = ((utf8z)(ref val)).GetPinnableReference())
		{
			NativeMethods.sqlite3_result_text(ctx, val2, -1, new IntPtr(-1));
		}
	}

	unsafe void ISQLite3Provider.sqlite3_result_blob(IntPtr ctx, ReadOnlySpan<byte> blob)
	{
		fixed (byte* ptr = blob)
		{
			NativeMethods.sqlite3_result_blob(ctx, (IntPtr)ptr, blob.Length, new IntPtr(-1));
		}
	}

	void ISQLite3Provider.sqlite3_result_zeroblob(IntPtr ctx, int n)
	{
		NativeMethods.sqlite3_result_zeroblob(ctx, n);
	}

	void ISQLite3Provider.sqlite3_result_error_toobig(IntPtr ctx)
	{
		NativeMethods.sqlite3_result_error_toobig(ctx);
	}

	void ISQLite3Provider.sqlite3_result_error_nomem(IntPtr ctx)
	{
		NativeMethods.sqlite3_result_error_nomem(ctx);
	}

	void ISQLite3Provider.sqlite3_result_error_code(IntPtr ctx, int code)
	{
		NativeMethods.sqlite3_result_error_code(ctx, code);
	}

	unsafe ReadOnlySpan<byte> ISQLite3Provider.sqlite3_value_blob(IntPtr p)
	{
		IntPtr intPtr = NativeMethods.sqlite3_value_blob(p);
		if (intPtr == IntPtr.Zero)
		{
			return null;
		}
		int length = NativeMethods.sqlite3_value_bytes(p);
		return new ReadOnlySpan<byte>(intPtr.ToPointer(), length);
	}

	int ISQLite3Provider.sqlite3_value_bytes(IntPtr p)
	{
		return NativeMethods.sqlite3_value_bytes(p);
	}

	double ISQLite3Provider.sqlite3_value_double(IntPtr p)
	{
		return NativeMethods.sqlite3_value_double(p);
	}

	int ISQLite3Provider.sqlite3_value_int(IntPtr p)
	{
		return NativeMethods.sqlite3_value_int(p);
	}

	long ISQLite3Provider.sqlite3_value_int64(IntPtr p)
	{
		return NativeMethods.sqlite3_value_int64(p);
	}

	int ISQLite3Provider.sqlite3_value_type(IntPtr p)
	{
		return NativeMethods.sqlite3_value_type(p);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_value_text(IntPtr p)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_value_text(p));
	}

	int ISQLite3Provider.sqlite3_bind_int(sqlite3_stmt stm, int paramIndex, int val)
	{
		return NativeMethods.sqlite3_bind_int(stm, paramIndex, val);
	}

	int ISQLite3Provider.sqlite3_bind_int64(sqlite3_stmt stm, int paramIndex, long val)
	{
		return NativeMethods.sqlite3_bind_int64(stm, paramIndex, val);
	}

	unsafe int ISQLite3Provider.sqlite3_bind_text(sqlite3_stmt stm, int paramIndex, ReadOnlySpan<byte> t)
	{
		if (t.Length == 0)
		{
			byte b = 0;
			return NativeMethods.sqlite3_bind_text(stm, paramIndex, &b, 0, new IntPtr(-1));
		}
		fixed (byte* val = t)
		{
			return NativeMethods.sqlite3_bind_text(stm, paramIndex, val, t.Length, new IntPtr(-1));
		}
	}

	unsafe int ISQLite3Provider.sqlite3_bind_text16(sqlite3_stmt stm, int paramIndex, ReadOnlySpan<char> t)
	{
		if (t.Length == 0)
		{
			char c = '\0';
			return NativeMethods.sqlite3_bind_text16(stm, paramIndex, &c, 0, new IntPtr(-1));
		}
		fixed (char* val = t)
		{
			return NativeMethods.sqlite3_bind_text16(stm, paramIndex, val, t.Length * 2, new IntPtr(-1));
		}
	}

	unsafe int ISQLite3Provider.sqlite3_bind_text(sqlite3_stmt stm, int paramIndex, utf8z t)
	{
		fixed (byte* val = ((utf8z)(ref t)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_bind_text(stm, paramIndex, val, -1, new IntPtr(-1));
		}
	}

	int ISQLite3Provider.sqlite3_bind_double(sqlite3_stmt stm, int paramIndex, double val)
	{
		return NativeMethods.sqlite3_bind_double(stm, paramIndex, val);
	}

	unsafe int ISQLite3Provider.sqlite3_bind_blob(sqlite3_stmt stm, int paramIndex, ReadOnlySpan<byte> blob)
	{
		if (blob.Length == 0)
		{
			byte b = 0;
			return NativeMethods.sqlite3_bind_blob(stm, paramIndex, &b, 0, new IntPtr(-1));
		}
		fixed (byte* val = blob)
		{
			return NativeMethods.sqlite3_bind_blob(stm, paramIndex, val, blob.Length, new IntPtr(-1));
		}
	}

	int ISQLite3Provider.sqlite3_bind_zeroblob(sqlite3_stmt stm, int paramIndex, int size)
	{
		return NativeMethods.sqlite3_bind_zeroblob(stm, paramIndex, size);
	}

	int ISQLite3Provider.sqlite3_bind_null(sqlite3_stmt stm, int paramIndex)
	{
		return NativeMethods.sqlite3_bind_null(stm, paramIndex);
	}

	int ISQLite3Provider.sqlite3_bind_parameter_count(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_bind_parameter_count(stm);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_bind_parameter_name(sqlite3_stmt stm, int paramIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_bind_parameter_name(stm, paramIndex));
	}

	unsafe int ISQLite3Provider.sqlite3_bind_parameter_index(sqlite3_stmt stm, utf8z paramName)
	{
		fixed (byte* strName = ((utf8z)(ref paramName)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_bind_parameter_index(stm, strName);
		}
	}

	int ISQLite3Provider.sqlite3_step(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_step(stm);
	}

	int ISQLite3Provider.sqlite3_stmt_isexplain(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_stmt_isexplain(stm);
	}

	int ISQLite3Provider.sqlite3_stmt_busy(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_stmt_busy(stm);
	}

	int ISQLite3Provider.sqlite3_stmt_readonly(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_stmt_readonly(stm);
	}

	int ISQLite3Provider.sqlite3_column_int(sqlite3_stmt stm, int columnIndex)
	{
		return NativeMethods.sqlite3_column_int(stm, columnIndex);
	}

	long ISQLite3Provider.sqlite3_column_int64(sqlite3_stmt stm, int columnIndex)
	{
		return NativeMethods.sqlite3_column_int64(stm, columnIndex);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_text(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		byte* intPtr = NativeMethods.sqlite3_column_text(stm, columnIndex);
		int num = NativeMethods.sqlite3_column_bytes(stm, columnIndex);
		return utf8z.FromPtrLen(intPtr, num);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_decltype(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_column_decltype(stm, columnIndex));
	}

	double ISQLite3Provider.sqlite3_column_double(sqlite3_stmt stm, int columnIndex)
	{
		return NativeMethods.sqlite3_column_double(stm, columnIndex);
	}

	unsafe ReadOnlySpan<byte> ISQLite3Provider.sqlite3_column_blob(sqlite3_stmt stm, int columnIndex)
	{
		IntPtr intPtr = NativeMethods.sqlite3_column_blob(stm, columnIndex);
		if (intPtr == IntPtr.Zero)
		{
			return null;
		}
		int length = NativeMethods.sqlite3_column_bytes(stm, columnIndex);
		return new ReadOnlySpan<byte>(intPtr.ToPointer(), length);
	}

	int ISQLite3Provider.sqlite3_column_type(sqlite3_stmt stm, int columnIndex)
	{
		return NativeMethods.sqlite3_column_type(stm, columnIndex);
	}

	int ISQLite3Provider.sqlite3_column_bytes(sqlite3_stmt stm, int columnIndex)
	{
		return NativeMethods.sqlite3_column_bytes(stm, columnIndex);
	}

	int ISQLite3Provider.sqlite3_column_count(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_column_count(stm);
	}

	int ISQLite3Provider.sqlite3_data_count(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_data_count(stm);
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_name(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_column_name(stm, columnIndex));
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_origin_name(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_column_origin_name(stm, columnIndex));
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_table_name(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_column_table_name(stm, columnIndex));
	}

	unsafe utf8z ISQLite3Provider.sqlite3_column_database_name(sqlite3_stmt stm, int columnIndex)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return utf8z.FromPtr(NativeMethods.sqlite3_column_database_name(stm, columnIndex));
	}

	int ISQLite3Provider.sqlite3_reset(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_reset(stm);
	}

	int ISQLite3Provider.sqlite3_clear_bindings(sqlite3_stmt stm)
	{
		return NativeMethods.sqlite3_clear_bindings(stm);
	}

	int ISQLite3Provider.sqlite3_stmt_status(sqlite3_stmt stm, int op, int resetFlg)
	{
		return NativeMethods.sqlite3_stmt_status(stm, op, resetFlg);
	}

	int ISQLite3Provider.sqlite3_finalize(IntPtr stm)
	{
		return NativeMethods.sqlite3_finalize(stm);
	}

	int ISQLite3Provider.sqlite3_wal_autocheckpoint(sqlite3 db, int n)
	{
		return NativeMethods.sqlite3_wal_autocheckpoint(db, n);
	}

	unsafe int ISQLite3Provider.sqlite3_wal_checkpoint(sqlite3 db, utf8z dbName)
	{
		fixed (byte* dbName2 = ((utf8z)(ref dbName)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_wal_checkpoint(db, dbName2);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_wal_checkpoint_v2(sqlite3 db, utf8z dbName, int eMode, out int logSize, out int framesCheckPointed)
	{
		fixed (byte* dbName2 = ((utf8z)(ref dbName)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_wal_checkpoint_v2(db, dbName2, eMode, out logSize, out framesCheckPointed);
		}
	}

	int ISQLite3Provider.sqlite3_keyword_count()
	{
		return NativeMethods.sqlite3_keyword_count();
	}

	unsafe int ISQLite3Provider.sqlite3_keyword_name(int i, out string name)
	{
		byte* name2;
		int length;
		int result = NativeMethods.sqlite3_keyword_name(i, out name2, out length);
		name = Encoding.UTF8.GetString(name2, length);
		return result;
	}

	unsafe IntPtr ISQLite3Provider.sqlite3_serialize(sqlite3 db, utf8z schema, out long size, int flags)
	{
		fixed (byte* schema2 = ((utf8z)(ref schema)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_serialize(db, schema2, out size, flags);
		}
	}

	unsafe int ISQLite3Provider.sqlite3_deserialize(sqlite3 db, utf8z schema, IntPtr data, long szDb, long szBuf, int flags)
	{
		fixed (byte* schema2 = ((utf8z)(ref schema)).GetPinnableReference())
		{
			return NativeMethods.sqlite3_deserialize(db, schema2, data, szDb, szBuf, flags);
		}
	}
}

plugins/UKSQLite/UKSQLite.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using SQLitePCL;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("UKSQLite")]
[assembly: AssemblyConfiguration("Package")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5ea8e60157e0ecbfb2ce3cec5474b8c8a6684e42")]
[assembly: AssemblyProduct("UKSQLite")]
[assembly: AssemblyTitle("UKSQLite")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace UKSQLite
{
	internal static class PluginInfo
	{
		public const string PLUGIN_GUID = "atom.uksqlite";

		public const string PLUGIN_NAME = "UKSQLite";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	[BepInProcess("ULTRAKILL.exe")]
	[BepInPlugin("atom.uksqlite", "UKSQLite", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private static bool initialized;

		private void Awake()
		{
			EnsureInitialized();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"UKSQLite initialized.");
		}

		public static void EnsureInitialized()
		{
			if (!initialized)
			{
				AddPluginFolderToPath();
				Batteries_V2.Init();
				initialized = true;
			}
		}

		private static void AddPluginFolderToPath()
		{
			string text = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty;
			if (!string.IsNullOrEmpty(text))
			{
				string text2 = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
				if (!text2.Contains(text))
				{
					Environment.SetEnvironmentVariable("PATH", text + Path.PathSeparator + text2);
				}
			}
		}
	}
}