Skip to content

Commit b23d189

Browse files
committed
1
1 parent 4017905 commit b23d189

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

HttpReports.Web/DataContext/DBFactory.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ private void InitSqlServer(string Constr)
5656
{
5757
using (SqlConnection con = new SqlConnection(Constr))
5858
{
59-
string TempConstr = Constr.Replace("httpreports", "master");
59+
//string TempConstr = Constr.Replace("httpreports", "master");
6060

61-
string DB_id = con.QueryFirstOrDefault<string>(" SELECT DB_ID('HttpReports') ");
61+
//string DB_id = con.QueryFirstOrDefault<string>(" SELECT DB_ID('HttpReports') ");
6262

63-
if (string.IsNullOrEmpty(DB_id))
64-
{
65-
int i = con.Execute(" Create Database HttpReports ");
66-
}
63+
//if (string.IsNullOrEmpty(DB_id))
64+
//{
65+
// int i = con.Execute(" Create Database HttpReports ");
66+
//}
6767

6868

6969
// 检查RequestInfo表
@@ -140,24 +140,24 @@ private void InitMySql(string Constr)
140140
{
141141
using (MySqlConnection con = new MySqlConnection(Constr))
142142
{
143-
string TempConstr = Constr.ToLower().Replace("httpreports", "sys");
143+
//string TempConstr = Constr.ToLower().Replace("httpreports", "sys");
144144

145-
MySqlConnection TempConn = new MySqlConnection(TempConstr);
145+
//MySqlConnection TempConn = new MySqlConnection(TempConstr);
146146

147-
var DbInfo = TempConn.QueryFirstOrDefault<string>(" show databases like 'httpreports'; ");
147+
//var DbInfo = TempConn.QueryFirstOrDefault<string>(" show databases like 'httpreports'; ");
148148

149-
if (string.IsNullOrEmpty(DbInfo))
150-
{
151-
TempConn.Execute(" create database HttpReports; ");
152-
}
149+
//if (string.IsNullOrEmpty(DbInfo))
150+
//{
151+
// TempConn.Execute(" create database HttpReports; ");
152+
//}
153153

154-
TempConn.Close();
155-
TempConn.Dispose();
154+
//TempConn.Close();
155+
//TempConn.Dispose();
156156

157-
if (con.QueryFirstOrDefault<int>(" Select count(1) from information_schema.tables where table_name ='httpreports.requestinfo'; ") == 0)
157+
if (con.QueryFirstOrDefault<int>(" Select count(1) from information_schema.tables where table_name ='RequestInfo' and table_schema = 'HttpReports'; ") == 0)
158158
{
159159
con.Execute(@"
160-
CREATE TABLE `Requestinfo` (
160+
CREATE TABLE `RequestInfo` (
161161
`Id` int(11) NOT NULL auto_increment,
162162
`Node` varchar(50) default NULL,
163163
`Route` varchar(50) default NULL,
@@ -174,7 +174,7 @@ PRIMARY KEY (`Id`)
174174

175175
}
176176

177-
if (con.QueryFirstOrDefault<int>("Select count(1) from information_schema.tables where table_name ='httpreports.job';") == 0)
177+
if (con.QueryFirstOrDefault<int>(" Select count(1) from information_schema.tables where table_name ='Job' and table_schema = 'HttpReports'; ") == 0)
178178
{
179179
con.Execute(@"
180180

0 commit comments

Comments
 (0)