简体   繁体   English

SQLite:如何使用C#从SQliteConnection获取句柄

[英]SQLite: How to get handle from SQliteConnection using C#

以后如何从SQLiteConnection获取数据库句柄以与sqlite3_limit和SQLite3的所有其他核心功能一起使用?

System.Data.SQLite does not allow access to the database connection handle; System.Data.SQLite不允许访问数据库连接句柄。 you can use only those functions that are wrapped by its API. 您只能使用其API包装的那些功能。

That depends on the .NET wrapper of SQLite you're using. 这取决于您使用的SQLite的.NET包装。 If you have one with source code that you can compile yourself, make the underlying handle public and access it in your client code. 如果您拥有可以编译的带有源代码的源代码,请公开基础句柄并在客户端代码中对其进行访问。 If you can't do that, you'll have to extract the underlying handle from the wrapper code via reflection - look for internal or private SafeHandle / IntPtr fields. 如果无法做到这一点,则必须通过反射从包装程序代码中提取底层句柄-查找内部或私有SafeHandle / IntPtr字段。 Note that your wrapper may not be designed in a way that would allow it to work if you access the handle directly, as it may expect the handle to be in a particular state when the wrapped functionality is accessed via the wrapper and you break those expectations by manipulating the handle. 请注意,您的包装器的设计方式可能无法使其在您直接访问该句柄时能够正常工作,因为当通过包装器访问包装的功能并且您打破了这些期望时,它可能期望该句柄处于特定状态通过操纵手柄。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM