@@ -174,11 +174,6 @@ module MSSqlServerDynamic =
174174 let dbUnboxWithDefault < 'a > def ( v : obj ) : 'a =
175175 if Convert.IsDBNull( v) then def else unbox v
176176
177- let connect ( con : IDbConnection ) f =
178- if con.State <> ConnectionState.Open then con.Open()
179- let result = f con
180- con.Close(); result
181-
182177 let executeSql sql ( con : IDbConnection ) =
183178 use com = Activator.CreateInstance( commandType.Value,[| box sql; box con|]) :?> IDbCommand
184179 com.ExecuteReader()
@@ -238,7 +233,7 @@ module MSSqlServerDynamic =
238233 let query = sprintf " SET NO_BROWSETABLE ON; SET FMTONLY ON; exec %s %s " sname.DbName parameterStr
239234 let derivedCols =
240235 let initialSchemas =
241- connect con ( fun con ->
236+ Sql. connect con ( fun con ->
242237 try
243238 let dr = executeSql query con
244239 [ yield dr.GetSchemaTable();
@@ -641,7 +636,7 @@ type internal MSSqlServerDynamicProvider(resolutionPath, contextSchemaPath, refe
641636 match tableNames with
642637 | " " -> " "
643638 | x -> " where 1=1 " + ( SchemaProjections.buildTableNameWhereFilter " TABLE_NAME" tableNames)
644- MSSqlServerDynamic .connect con ( fun con ->
639+ Sql .connect con ( fun con ->
645640 use reader = MSSqlServerDynamic.executeSql ( " select TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE from INFORMATION_SCHEMA.TABLES" + tableNamesFilter) con
646641 [ while reader.Read() do
647642 let table = { Schema = reader.GetString( 0 ) ; Name = reader.GetString( 1 ) ; Type= reader.GetString( 2 ) .ToLower() }
@@ -761,7 +756,7 @@ type internal MSSqlServerDynamicProvider(resolutionPath, contextSchemaPath, refe
761756 AND KCU2.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME
762757 AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION "
763758
764- let res = MSSqlServerDynamic .connect con ( fun con ->
759+ let res = Sql .connect con ( fun con ->
765760 let baseq1 = sprintf " %s WHERE KCU2.TABLE_NAME = @tblName" baseQuery
766761 use com1 = ( this:> ISqlProvider) .CreateCommand( con, baseq1)
767762 com1.Parameters.Add(( this:> ISqlProvider) .CreateCommandParameter( QueryParameter.Create( " @tblName" , 0 ), table.Name)) |> ignore
@@ -785,7 +780,7 @@ type internal MSSqlServerDynamicProvider(resolutionPath, contextSchemaPath, refe
785780 ( children, parents))
786781 res)
787782
788- member __.GetSprocs ( con ) = MSSqlServerDynamic .connect con MSSqlServerDynamic.getSprocs
783+ member __.GetSprocs ( con ) = Sql .connect con MSSqlServerDynamic.getSprocs
789784 member __.GetIndividualsQueryText ( table , amount ) = sprintf " SELECT TOP %i * FROM %s " amount table.FullName
790785 member __.GetIndividualQueryText ( table , column ) = sprintf " SELECT * FROM [%s ].[%s ] WHERE [%s ].[%s ].[%s ] = @id" table.Schema table.Name table.Schema table.Name column
791786
0 commit comments