mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
Extract running SQL from the resource
in the separate assembly. This allow breaking of the SQLite.sql into separate pieces later.
This commit is contained in:
parent
e2604733f2
commit
40a5b7bc00
1 changed files with 18 additions and 9 deletions
|
|
@ -55,17 +55,26 @@ namespace Cosmos.Debug.Common {
|
||||||
|
|
||||||
internal void CreateDB()
|
internal void CreateDB()
|
||||||
{
|
{
|
||||||
using (var strm = typeof(SQL).Assembly.GetManifestResourceStream(typeof(SQL), "SQLite.sql"))
|
ExecuteAssemblyResource("SQLite.sql");
|
||||||
{
|
}
|
||||||
if (strm == null)
|
|
||||||
|
/// <summary>
|
||||||
|
/// Exceutes SQL file stored inside assembly.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="resourceName">Name of the assembly resource to execute.</param>
|
||||||
|
internal void ExecuteAssemblyResource(string resourceName)
|
||||||
|
{
|
||||||
|
using (var strm = typeof(SQL).Assembly.GetManifestResourceStream(typeof(SQL), resourceName))
|
||||||
{
|
{
|
||||||
throw new Exception("Sql resource not found!");
|
if (strm == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Sql resource not found!");
|
||||||
|
}
|
||||||
|
using (var reader = new StreamReader(strm))
|
||||||
|
{
|
||||||
|
Exec(reader.ReadToEnd());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
using (var reader = new StreamReader(strm))
|
|
||||||
{
|
|
||||||
Exec(reader.ReadToEnd());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue