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
8d65caba
Commit
8d65caba
authored
May 02, 2015
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Investigate failing test: Scale/Precision is broken SqlClient (issue 1612 logged)
parent
ec6faf54
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
6 deletions
+63
-6
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+3
-4
project.json
Dapper/project.json
+1
-1
Program.cs
Tests/Program.cs
+5
-1
Tests.cs
Tests/Tests.cs
+54
-0
No files found.
Dapper NET40/SqlMapper.cs
View file @
8d65caba
...
...
@@ -4771,10 +4771,7 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
p
.
Size
=
DbString
.
DefaultLength
;
}
}
if
(
param
.
Size
!=
null
)
{
p
.
Size
=
param
.
Size
.
Value
;
}
if
(
param
.
Size
!=
null
)
p
.
Size
=
param
.
Size
.
Value
;
if
(
param
.
Precision
!=
null
)
p
.
Precision
=
param
.
Precision
.
Value
;
if
(
param
.
Scale
!=
null
)
p
.
Scale
=
param
.
Scale
.
Value
;
}
...
...
@@ -4782,6 +4779,8 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
{
if
(
dbType
!=
null
)
p
.
DbType
=
dbType
.
Value
;
if
(
param
.
Size
!=
null
)
p
.
Size
=
param
.
Size
.
Value
;
if
(
param
.
Precision
!=
null
)
p
.
Precision
=
param
.
Precision
.
Value
;
if
(
param
.
Scale
!=
null
)
p
.
Scale
=
param
.
Scale
.
Value
;
handler
.
SetValue
(
p
,
val
??
DBNull
.
Value
);
}
...
...
Dapper/project.json
View file @
8d65caba
Tests/Program.cs
View file @
8d65caba
...
...
@@ -58,7 +58,11 @@ static void RunPerformanceTests()
static
void
Main
()
{
#if DNXCORE50
Console
.
WriteLine
(
"CoreCLR"
);
#else
Console
.
WriteLine
(
Environment
.
Version
);
#endif
#if DEBUG
RunTests
();
#else
...
...
Tests/Tests.cs
View file @
8d65caba
...
...
@@ -4337,6 +4337,60 @@ public void Issue261_Decimals()
c
.
IsEqualTo
(
11.884
M
);
}
public
void
Issue261_Decimals_ADONET_SetViaBaseClass
()
{
Issue261_Decimals_ADONET
(
true
);
}
public
void
Issue261_Decimals_ADONET_SetViaConcreteClass
()
{
Issue261_Decimals_ADONET
(
false
);
}
private
void
Issue261_Decimals_ADONET
(
bool
setPrecisionScaleViaAbstractApi
)
{
try
{
using
(
var
cmd
=
connection
.
CreateCommand
())
{
cmd
.
CommandText
=
"create proc #Issue261Direct @c decimal(10,5) OUTPUT as begin set @c=11.884 end"
;
cmd
.
ExecuteNonQuery
();
}
}
catch
{
/* we don't care that it already exists */
}
using
(
var
cmd
=
connection
.
CreateCommand
())
{
cmd
.
CommandType
=
CommandType
.
StoredProcedure
;
cmd
.
CommandText
=
"#Issue261Direct"
;
var
c
=
cmd
.
CreateParameter
();
c
.
ParameterName
=
"c"
;
c
.
Direction
=
ParameterDirection
.
Output
;
c
.
Value
=
DBNull
.
Value
;
c
.
DbType
=
DbType
.
Decimal
;
if
(
setPrecisionScaleViaAbstractApi
)
{
#if DNXCORE50
DbParameter
baseParam
=
c
;
#else
IDbDataParameter
baseParam
=
c
;
#endif
baseParam
.
Precision
=
10
;
baseParam
.
Scale
=
5
;
}
else
{
c
.
Precision
=
10
;
c
.
Scale
=
5
;
}
cmd
.
Parameters
.
Add
(
c
);
cmd
.
ExecuteNonQuery
();
decimal
value
=
(
decimal
)
c
.
Value
;
value
.
IsEqualTo
(
11.884
M
);
}
}
public
void
BasicDecimals
()
{
var
c
=
connection
.
Query
<
decimal
>(
"select @c"
,
new
{
c
=
11.884
M
}).
Single
();
...
...
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