@@ -131,8 +131,8 @@ module Firebird =
131
131
let mutable findDbType : ( string -> TypeMapping option ) = fun _ -> failwith " !"
132
132
133
133
let createCommandParameter sprocCommand ( param : QueryParameter ) value =
134
- let mapping = if value <> null && ( not sprocCommand) then ( findClrType ( value.GetType() .ToString())) else None
135
- let value = if value = null then ( box System.DBNull.Value) else value
134
+ let mapping = if ( not ( isNull value )) && ( not sprocCommand) then ( findClrType ( value.GetType() .ToString())) else None
135
+ let value = if isNull value then ( box System.DBNull.Value) else value
136
136
137
137
let parameterType = parameterType.Value
138
138
let firebirdDbTypeSetter =
@@ -211,19 +211,19 @@ module Firebird =
211
211
| :? System.Reflection.ReflectionTypeLoadException as ex ->
212
212
let errorfiles = ex.LoaderExceptions |> Array.map( fun e -> e.GetBaseException() .Message) |> Seq.distinct |> Seq.toArray
213
213
let msg = ex.GetBaseException() .Message + " \r\n " + String.Join( " \r\n " , errorfiles)
214
- raise( new System.Reflection.TargetInvocationException( msg, ex))
215
- | :? System.Reflection.TargetInvocationException as ex when ( ex.InnerException <> null && ex.InnerException :? DllNotFoundException) ->
214
+ raise( System.Reflection.TargetInvocationException( msg, ex))
215
+ | :? System.Reflection.TargetInvocationException as ex when (( not ( isNull ex.InnerException)) && ex.InnerException :? DllNotFoundException) ->
216
216
let platform = Reflection.getPlatform( System.Reflection.Assembly.GetExecutingAssembly())
217
217
let msg = ex.GetBaseException() .Message + " , Path: " + ( System.IO.Path.GetFullPath resolutionPath) +
218
218
( if platform <> " " then Environment.NewLine + " Current execution platform: " + platform else " " )
219
- raise( new System.Reflection.TargetInvocationException( msg, ex))
219
+ raise( System.Reflection.TargetInvocationException( msg, ex))
220
220
| :? System.TypeInitializationException as te when ( te.InnerException :? System.Reflection.TargetInvocationException) ->
221
221
let ex = te.InnerException :?> System.Reflection.TargetInvocationException
222
222
let platform = Reflection.getPlatform( System.Reflection.Assembly.GetExecutingAssembly())
223
223
let msg = ex.GetBaseException() .Message + " , Path: " + ( System.IO.Path.GetFullPath resolutionPath) +
224
224
( if platform <> " " then Environment.NewLine + " Current execution platform: " + platform else " " )
225
- raise( new System.Reflection.TargetInvocationException( msg, ex.InnerException))
226
- | :? System.TypeInitializationException as te when ( te.InnerException <> null ) -> raise ( te.GetBaseException())
225
+ raise( System.Reflection.TargetInvocationException( msg, ex.InnerException))
226
+ | :? System.TypeInitializationException as te when not ( isNull te.InnerException) -> raise ( te.GetBaseException())
227
227
228
228
let createCommand commandText connection =
229
229
Activator.CreateInstance( commandType.Value,[| box commandText; box connection|]) :?> IDbCommand
@@ -279,15 +279,15 @@ module Firebird =
279
279
|> Option.map ( fun m ->
280
280
let ordinal_position = Sql.dbUnboxWithDefault< int16> 0 s row.[ " ORDINAL_POSITION" ] |> Convert.ToInt32
281
281
let parameter_mode = Sql.dbUnbox< int16> row.[ " PARAMETER_MODE" ] |> Convert.ToInt32
282
- //let returnValue = argumentName = null && ordinal_position = 0
282
+ //let returnValue = isNull argumentName && ordinal_position = 0
283
283
let direction =
284
284
match parameter_ mode with
285
285
| 0 -> ParameterDirection.Input
286
286
| 1 -> ParameterDirection.Output
287
287
//| "INOUT" -> ParameterDirection.InputOutput
288
288
//| null when returnValue -> ParameterDirection.ReturnValue
289
289
| a -> failwithf " Direction not supported %s %i " argumentName a
290
- { Name = if argumentName = null then failwithf " Parameter name is null for procedure %s " argumentName else argumentName
290
+ { Name = if isNull argumentName then failwithf " Parameter name is null for procedure %s " argumentName else argumentName
291
291
TypeMapping = m
292
292
Direction = direction
293
293
Length = maxLength
@@ -324,11 +324,9 @@ module Firebird =
324
324
|> Seq.toList
325
325
326
326
let readParameter ( parameter : IDbDataParameter ) =
327
- if parameter <> null then
327
+ if isNull parameter then null else
328
328
let par = parameter
329
329
par.Value
330
- else null
331
-
332
330
333
331
let processReturnColumn reader ( outps :( int * IDbDataParameter )[]) ( retCol : QueryParameter ) =
334
332
match retCol.TypeMapping.ProviderTypeName with
@@ -558,7 +556,7 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
558
556
use reader = com.ExecuteReader()
559
557
if reader.Read() then
560
558
let comm = reader.GetString( 0 )
561
- if comm <> null then comm else " "
559
+ if isNull comm then " " else comm
562
560
else " "
563
561
member __.GetColumnDescription ( con , tableName , columnName ) =
564
562
let sn = tableName.Substring( 0 , tableName.LastIndexOf( " ." ))
@@ -574,7 +572,7 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
574
572
use reader = com.ExecuteReader()
575
573
if reader.Read() then
576
574
let comm = reader.GetString( 0 )
577
- if comm <> null then comm else " "
575
+ if isNull comm then " " else comm
578
576
else " "
579
577
member __.CreateConnection ( connectionString ) = Firebird.createConnection connectionString
580
578
member __.CreateCommand ( connection , commandText ) = Firebird.createCommand commandText connection
@@ -828,14 +826,14 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
828
826
match operator with
829
827
| FSharp.Data.Sql.In -> " 1<>1" // nothing is in the empty set
830
828
| FSharp.Data.Sql.NotIn -> " 1=1" // anything is not in the empty set
831
- | _ -> failwith " Should not be called with any other operator"
829
+ | _ -> failwithf " Should not be called with any other operator ( %O ) " operator
832
830
else
833
831
let text = String.Join( " ," , array |> Array.map ( fun p -> p.ParameterName))
834
832
Array.iter parameters.Add array
835
833
match operator with
836
834
| FSharp.Data.Sql.In -> sprintf " %s IN (%s )" column text
837
835
| FSharp.Data.Sql.NotIn -> sprintf " %s NOT IN (%s )" column text
838
- | _ -> failwith " Should not be called with any other operator"
836
+ | _ -> failwithf " Should not be called with any other operator ( %O ) " operator
839
837
840
838
let prefix = if i> 0 then ( sprintf " %s " op) else " "
841
839
let paras = extractData data
@@ -848,7 +846,7 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
848
846
| FSharp.Data.Sql.NestedNotIn -> sprintf " %s NOT IN (%s )" column innersql
849
847
| FSharp.Data.Sql.NestedExists -> sprintf " EXISTS (%s )" innersql
850
848
| FSharp.Data.Sql.NestedNotExists -> sprintf " NOT EXISTS (%s )" innersql
851
- | _ -> failwith " Should not be called with any other operator"
849
+ | _ -> failwithf " Should not be called with any other operator ( %O ) " operator
852
850
853
851
~~( sprintf " %s%s " prefix <|
854
852
match operator with
@@ -1109,9 +1107,9 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
1109
1107
// remove the pk to prevent this attempting to be used again
1110
1108
e.SetPkColumnOptionSilent( schemaCache.PrimaryKeys.[ e.Table.Name], None)
1111
1109
e._ State <- Deleted
1112
- | Deleted | Unchanged -> failwith " Unchanged entity encountered in update list - this should not be possible!" )
1110
+ | Deleted | Unchanged -> failwithf " Unchanged entity encountered in update list - this should not be possible! ( %O ) " e )
1113
1111
1114
- if scope<> null then scope.Complete() //scope.Complete()
1112
+ if not ( isNull scope) then scope.Complete() //scope.Complete()
1115
1113
1116
1114
finally
1117
1115
con.Close()
@@ -1166,11 +1164,11 @@ type internal FirebirdProvider(resolutionPath, contextSchemaPath, owner, referen
1166
1164
e.SetPkColumnOptionSilent( schemaCache.PrimaryKeys.[ e.Table.Name], None)
1167
1165
e._ State <- Deleted
1168
1166
}
1169
- | Deleted | Unchanged -> failwith " Unchanged entity encountered in update list - this should not be possible!"
1167
+ | Deleted | Unchanged -> failwithf " Unchanged entity encountered in update list - this should not be possible! ( %O ) " e
1170
1168
1171
1169
let! _ = Sql.evaluateOneByOne handleEntity ( CommonTasks.sortEntities entities |> Seq.toList)
1172
1170
1173
- if scope<> null then scope.Complete()
1171
+ if not ( isNull scope) then scope.Complete()
1174
1172
1175
1173
finally
1176
1174
con.Close()
0 commit comments