打开SQLiteConnection上二进制流,而不是一个文件? [英] Opening a SQLiteConnection on a binary stream instead of a file?

查看:321
本文介绍了打开SQLiteConnection上二进制流,而不是一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以打开一个二进制流SQLiteConnection没有首先将其保存到磁盘?肯定有办法'绝招'的连接,以为流是一个文件。我的意思是,在内部这是它在做什么呢,对吧?

Is it possible to open a SQLiteConnection on a binary stream without first saving it to disk? Surely there's a way to 'trick' the connection into thinking the stream is a file. I mean, internally that's what it's doing anyway, right?

推荐答案

假设你正在谈论系统.Data.SQLite 通过 http://sqlite.phxsoftware.com/ )那么您可以在连接字符串的文件名设置为:内存:,它应该创建一个内存数据库

Assuming you're talking about System.Data.SQLite from http://sqlite.phxsoftware.com/), then you can set the file name on your connection string to :memory: and it should create an in-memory database.

var connection = new SQLiteConnection("Data source=:memory:");

这篇关于打开SQLiteConnection上二进制流,而不是一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆