hytos / DTI_PID / ID2PSN / AppSQLiteDatabase.cs @ eb44d82c
이력 | 보기 | 이력해설 | 다운로드 (1.46 KB)
1 | 23a96301 | humkyung | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Data; |
||
6 | using System.Data.Common; |
||
7 | using System.Data.SQLite; |
||
8 | using System.Globalization; |
||
9 | using System.Data.SqlClient; |
||
10 | |||
11 | namespace ID2PSN |
||
12 | { |
||
13 | class AppSQLiteDatabase : AbstractDatabase<SQLiteConnection , SQLiteCommand , SQLiteDataAdapter> |
||
14 | { |
||
15 | public string FilePath{get;set;} |
||
16 | |||
17 | /// <summary> |
||
18 | /// sqlite connection string |
||
19 | /// </summary> |
||
20 | /// <author>humkyung</author> |
||
21 | /// <date>2019.02.10</date> |
||
22 | /// <returns></returns> |
||
23 | protected override string GetConnectionString() |
||
24 | { |
||
25 | return string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", this.FilePath); |
||
26 | } |
||
27 | |||
28 | /// <summary> |
||
29 | /// get table name list |
||
30 | /// </summary> |
||
31 | /// <author>humkyung</author> |
||
32 | /// <date>2021.11.04</date> |
||
33 | /// <param name="sTableName"></param> |
||
34 | /// <returns></returns> |
||
35 | public override List<string> GetTableNames() |
||
36 | { |
||
37 | List<string> res = new List<string> { }; |
||
38 | { |
||
39 | var query = "SELECT NAME FROM sqlite_master WHERE type='table'"; |
||
40 | using (var ds = ExecuteDataSet(GetSqlStringCommand(query))) |
||
41 | { |
||
42 | foreach (DataRow dr in ds.Tables[0].Rows) |
||
43 | { |
||
44 | res.Add(dr["NAME"].ToString()); |
||
45 | } |
||
46 | } |
||
47 | } |
||
48 | |||
49 | return res; |
||
50 | } |
||
51 | } |
||
52 | } |