-
Notifications
You must be signed in to change notification settings - Fork 0
/
DAL.cs
83 lines (75 loc) · 1.92 KB
/
DAL.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace DataAccess
{
public class DAL
{
public Adapter adapter = null;
public DAL()
{
if (this.adapter == null)
{
this.adapter = new AdapterFactory().createAdapter(Properties.Settings.Default.db_type);
}
}
public DAL(string db)
{
if (this.adapter!=null && this.adapter.Db == db)
return;
this.adapter = new AdapterFactory().createAdapter(db);
}
public DAL(string db, string Host, string Username, string Password, int port, string Catalog)
{
if (this.adapter!=null && this.adapter.Db == db && this.adapter.Host == Host && this.adapter.Catalog == Catalog)
{
return;
}
this.adapter = new AdapterFactory().createAdapter(db, Host, Username, Password, port, Catalog);
}
public DataSet GetDataSet(string sql)
{
return adapter.GetDataSet(sql);
}
public DataSet GetDataSet(string sql, List<FieldAndValue> list)
{
return adapter.GetDataSet(sql, list);
//return null;2011年2月17日9:14:54 Lwt编辑 1行
}
public int ExecuteSql(string sql)
{
return adapter.ExcuteSQL(sql);
}
public int ExecuteSql(string sql, List<FieldAndValue> list)
{
if (list.Count == 0 || list == null)
return ExecuteSql(sql);
return adapter.ExcuteSQL(sql, list);
}
public object ExecuteSqlScalar(string sql)
{
return adapter.ExecuteSqlScalar(sql);
}
public object ExecuteSqlScalar(string sql, List<FieldAndValue> list)
{
return adapter.ExecuteSqlScalar(sql, list);
}
public string GetDb()
{
return adapter.Db;
}
public string GetHost()
{
return adapter.Host;
}
public object GetReader(string sql)
{
return adapter.GetReader(sql);
}
public object GetReader(string sql, List<FieldAndValue> list)
{
return adapter.GetReader(sql, list);
}
}
}