Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
8fcb8ebb
Commit
8fcb8ebb
authored
Aug 26, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
r1.31; Issue 148/149: error message on bad column maps borked due to sequential access
parent
3691fe13
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
28 deletions
+46
-28
AssemblyInfo.cs
Dapper NET40/Properties/AssemblyInfo.cs
+2
-2
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+13
-13
AssemblyInfo.cs
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Dapper.Contrib/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
DapperTests NET35/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
DapperTests NET45/Properties/AssemblyInfo.cs
+2
-2
AssemblyInfo.cs
Tests/Properties/AssemblyInfo.cs
+2
-2
Tests.cs
Tests/Tests.cs
+17
-0
dapper.nuspec
dapper.nuspec
+2
-1
No files found.
Dapper NET40/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -32,5 +32,5 @@
...
@@ -32,5 +32,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper NET40/SqlMapper.cs
View file @
8fcb8ebb
...
@@ -3285,7 +3285,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3285,7 +3285,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
bool
first
=
true
;
bool
first
=
true
;
var
allDone
=
il
.
DefineLabel
();
var
allDone
=
il
.
DefineLabel
();
int
enumDeclareLocal
=
-
1
;
int
enumDeclareLocal
=
-
1
,
valueCopyLocal
=
il
.
DeclareLocal
(
typeof
(
object
)).
LocalIndex
;
foreach
(
var
item
in
members
)
foreach
(
var
item
in
members
)
{
{
if
(
item
!=
null
)
if
(
item
!=
null
)
...
@@ -3300,6 +3300,8 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3300,6 +3300,8 @@ public static void SetTypeMap(Type type, ITypeMap map)
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][reader][index][index]
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][reader][index][index]
il
.
Emit
(
OpCodes
.
Stloc_0
);
// stack is now [target][target][reader][index]
il
.
Emit
(
OpCodes
.
Stloc_0
);
// stack is now [target][target][reader][index]
il
.
Emit
(
OpCodes
.
Callvirt
,
getItem
);
// stack is now [target][target][value-as-object]
il
.
Emit
(
OpCodes
.
Callvirt
,
getItem
);
// stack is now [target][target][value-as-object]
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [target][target][value-as-object][value-as-object]
StoreLocal
(
il
,
valueCopyLocal
);
Type
colType
=
reader
.
GetFieldType
(
index
);
Type
colType
=
reader
.
GetFieldType
(
index
);
Type
memberType
=
item
.
MemberType
;
Type
memberType
=
item
.
MemberType
;
...
@@ -3332,7 +3334,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3332,7 +3334,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
StoreLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target]
StoreLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target]
il
.
Emit
(
OpCodes
.
Ldtoken
,
unboxType
);
// stack is now [target][target][enum-type-token]
il
.
Emit
(
OpCodes
.
Ldtoken
,
unboxType
);
// stack is now [target][target][enum-type-token]
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
Type
).
GetMethod
(
"GetTypeFromHandle"
),
null
);
// stack is now [target][target][enum-type]
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
Type
).
GetMethod
(
"GetTypeFromHandle"
),
null
);
// stack is now [target][target][enum-type]
il
.
Emit
(
OpCodes
.
Ldloc_2
);
// stack is now [target][target][enum-type][string]
LoadLocal
(
il
,
enumDeclareLocal
);
// stack is now [target][target][enum-type][string]
il
.
Emit
(
OpCodes
.
Ldc_I4_1
);
// stack is now [target][target][enum-type][string][true]
il
.
Emit
(
OpCodes
.
Ldc_I4_1
);
// stack is now [target][target][enum-type][string][true]
il
.
EmitCall
(
OpCodes
.
Call
,
enumParse
,
null
);
// stack is now [target][target][enum-as-object]
il
.
EmitCall
(
OpCodes
.
Call
,
enumParse
,
null
);
// stack is now [target][target][enum-as-object]
il
.
Emit
(
OpCodes
.
Unbox_Any
,
unboxType
);
// stack is now [target][target][typed-value]
il
.
Emit
(
OpCodes
.
Unbox_Any
,
unboxType
);
// stack is now [target][target][typed-value]
...
@@ -3460,6 +3462,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
...
@@ -3460,6 +3462,7 @@ public static void SetTypeMap(Type type, ITypeMap map)
il
.
BeginCatchBlock
(
typeof
(
Exception
));
// stack is Exception
il
.
BeginCatchBlock
(
typeof
(
Exception
));
// stack is Exception
il
.
Emit
(
OpCodes
.
Ldloc_0
);
// stack is Exception, index
il
.
Emit
(
OpCodes
.
Ldloc_0
);
// stack is Exception, index
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is Exception, index, reader
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is Exception, index, reader
LoadLocal
(
il
,
valueCopyLocal
);
// stack is Exception, index, reader, value
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
SqlMapper
).
GetMethod
(
"ThrowDataException"
),
null
);
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
SqlMapper
).
GetMethod
(
"ThrowDataException"
),
null
);
il
.
EndExceptionBlock
();
il
.
EndExceptionBlock
();
...
@@ -3635,36 +3638,33 @@ private static void LoadLocalAddress(ILGenerator il, int index)
...
@@ -3635,36 +3638,33 @@ private static void LoadLocalAddress(ILGenerator il, int index)
/// <summary>
/// <summary>
/// Throws a data exception, only used internally
/// Throws a data exception, only used internally
/// </summary>
/// </summary>
/// <param name="ex"></param>
[
Obsolete
(
"Intended for internal use only"
)]
/// <param name="index"></param>
public
static
void
ThrowDataException
(
Exception
ex
,
int
index
,
IDataReader
reader
,
object
value
)
/// <param name="reader"></param>
public
static
void
ThrowDataException
(
Exception
ex
,
int
index
,
IDataReader
reader
)
{
{
Exception
toThrow
;
Exception
toThrow
;
try
try
{
{
string
name
=
"(n/a)"
,
v
alue
=
"(n/a)"
;
string
name
=
"(n/a)"
,
formattedV
alue
=
"(n/a)"
;
if
(
reader
!=
null
&&
index
>=
0
&&
index
<
reader
.
FieldCount
)
if
(
reader
!=
null
&&
index
>=
0
&&
index
<
reader
.
FieldCount
)
{
{
name
=
reader
.
GetName
(
index
);
name
=
reader
.
GetName
(
index
);
try
try
{
{
object
val
=
reader
.
GetValue
(
index
);
// if there throw an exception, then I got one message, but Which column?
if
(
value
==
null
||
value
is
DBNull
)
if
(
val
==
null
||
val
is
DBNull
)
{
{
v
alue
=
"<null>"
;
formattedV
alue
=
"<null>"
;
}
}
else
else
{
{
value
=
Convert
.
ToString
(
val
)
+
" - "
+
Type
.
GetTypeCode
(
val
.
GetType
());
formattedValue
=
Convert
.
ToString
(
value
)
+
" - "
+
Type
.
GetTypeCode
(
value
.
GetType
());
}
}
}
}
catch
(
Exception
valEx
)
catch
(
Exception
valEx
)
{
{
v
alue
=
valEx
.
Message
;
formattedV
alue
=
valEx
.
Message
;
}
}
}
}
toThrow
=
new
DataException
(
string
.
Format
(
"Error parsing column {0} ({1}={2})"
,
index
,
name
,
v
alue
),
ex
);
toThrow
=
new
DataException
(
string
.
Format
(
"Error parsing column {0} ({1}={2})"
,
index
,
name
,
formattedV
alue
),
ex
);
}
}
catch
catch
{
// throw the **original** exception, wrapped as DataException
{
// throw the **original** exception, wrapped as DataException
...
...
Dapper.Contrib.Tests/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper.Contrib/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Dapper.SqlBuilder/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
DapperTests NET35/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
DapperTests NET45/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Tests/Properties/AssemblyInfo.cs
View file @
8fcb8ebb
...
@@ -31,5 +31,5 @@
...
@@ -31,5 +31,5 @@
//
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// by using the '*' as shown below:
[
assembly
:
AssemblyVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyVersion
(
"1.3
1
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
0
.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.3
1
.0.0"
)]
Tests/Tests.cs
View file @
8fcb8ebb
...
@@ -3476,6 +3476,23 @@ public void SO25069578_DynamicParams_Procs()
...
@@ -3476,6 +3476,23 @@ public void SO25069578_DynamicParams_Procs()
tran
.
Rollback
();
tran
.
Rollback
();
row
.
X
.
IsEqualTo
(
"bar"
);
row
.
X
.
IsEqualTo
(
"bar"
);
}
}
public
void
Issue149_TypeMismatch_SequentialAccess
()
{
string
error
;
Guid
guid
=
Guid
.
Parse
(
"cf0ef7ac-b6fe-4e24-aeda-a2b45bb5654e"
);
try
{
var
result
=
connection
.
Query
<
Issue149_Person
>(
@"select @guid as Id"
,
new
{
guid
}).
First
();
error
=
null
;
}
catch
(
Exception
ex
)
{
error
=
ex
.
Message
;
}
error
.
IsEqualTo
(
"Error parsing column 0 (Id=cf0ef7ac-b6fe-4e24-aeda-a2b45bb5654e - Object)"
);
}
public
class
Issue149_Person
{
public
string
Id
{
get
;
set
;
}
}
public
class
HazX
public
class
HazX
{
{
public
string
X
{
get
;
set
;
}
public
string
X
{
get
;
set
;
}
...
...
dapper.nuspec
View file @
8fcb8ebb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<package
xmlns=
"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"
>
<metadata
schemaVersion=
"2"
>
<metadata
schemaVersion=
"2"
>
<id>
Dapper
</id>
<id>
Dapper
</id>
<version>
1.3
0
</version>
<version>
1.3
1
</version>
<title>
Dapper dot net
</title>
<title>
Dapper dot net
</title>
<authors>
Sam Saffron,Marc Gravell
</authors>
<authors>
Sam Saffron,Marc Gravell
</authors>
<owners>
Sam Saffron,Marc Gravell
</owners>
<owners>
Sam Saffron,Marc Gravell
</owners>
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<frameworkAssembly
assemblyName=
"Microsoft.CSharp"
targetFramework=
".NETFramework4.0-Client, .NETFramework4.0"
/>
<frameworkAssembly
assemblyName=
"Microsoft.CSharp"
targetFramework=
".NETFramework4.0-Client, .NETFramework4.0"
/>
</frameworkAssemblies>
</frameworkAssemblies>
<releaseNotes>
<releaseNotes>
* 1.31 - Fix issue with error message when there is a column/type mismatch
* 1.30 - Better async cancellation
* 1.30 - Better async cancellation
* 1.29 - Make underscore name matching optional (opt-in) - this can be a breaking change for some people
* 1.29 - Make underscore name matching optional (opt-in) - this can be a breaking change for some people
* 1.28 - Much better numeric type conversion; fix for large oracle strings; map Foo_Bar to FooBar (etc); ExecuteScalar added; stability fixes
* 1.28 - Much better numeric type conversion; fix for large oracle strings; map Foo_Bar to FooBar (etc); ExecuteScalar added; stability fixes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment