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
db4e7a0a
Commit
db4e7a0a
authored
Oct 14, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue 192
parent
e2ccfbf2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+1
-1
Tests.cs
DapperTests NET45/Tests.cs
+18
-0
Tests.cs
Tests/Tests.cs
+25
-0
No files found.
Dapper NET40/SqlMapper.cs
View file @
db4e7a0a
...
@@ -2714,7 +2714,7 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj
...
@@ -2714,7 +2714,7 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj
}
}
}
}
var
regexIncludingUnknown
=
@"([?@:]"
+
Regex
.
Escape
(
namePrefix
)
+
@")(\s+(?i)unknown(?-i))?"
;
var
regexIncludingUnknown
=
@"([?@:]"
+
Regex
.
Escape
(
namePrefix
)
+
@")(
?!\w)(
\s+(?i)unknown(?-i))?"
;
if
(
count
==
0
)
if
(
count
==
0
)
{
{
command
.
CommandText
=
Regex
.
Replace
(
command
.
CommandText
,
regexIncludingUnknown
,
match
=>
command
.
CommandText
=
Regex
.
Replace
(
command
.
CommandText
,
regexIncludingUnknown
,
match
=>
...
...
DapperTests NET45/Tests.cs
View file @
db4e7a0a
...
@@ -705,6 +705,24 @@ public void TestMultiMapArbitraryMaps()
...
@@ -705,6 +705,24 @@ public void TestMultiMapArbitraryMaps()
}
}
}
}
public
void
Issue157_ClosedReaderAsync
()
{
using
(
var
conn
=
Program
.
GetOpenConnection
())
{
var
args
=
new
{
x
=
42
};
const
string
sql
=
@"select 123 as [A], 'abc' as [B] where @x=42"
;
var
row
=
conn
.
QueryAsync
<
SomeType
>(
new
CommandDefinition
(
sql
,
args
,
flags
:
CommandFlags
.
None
)).
Result
.
Single
();
row
.
IsNotNull
();
row
.
A
.
IsEqualTo
(
123
);
row
.
B
.
IsEqualTo
(
"abc"
);
args
=
new
{
x
=
5
};
conn
.
QueryAsync
<
SomeType
>(
new
CommandDefinition
(
sql
,
args
,
flags
:
CommandFlags
.
None
)).
Result
.
Any
().
IsFalse
();
}
}
public
void
TestAtEscaping
()
public
void
TestAtEscaping
()
{
{
using
(
var
connection
=
Program
.
GetOpenConnection
())
using
(
var
connection
=
Program
.
GetOpenConnection
())
...
...
Tests/Tests.cs
View file @
db4e7a0a
...
@@ -4041,6 +4041,31 @@ public void Issue151_ExpandoObjectArgsExec()
...
@@ -4041,6 +4041,31 @@ public void Issue151_ExpandoObjectArgsExec()
((
string
)
row
.
Name
).
Equals
(
"abc"
);
((
string
)
row
.
Name
).
Equals
(
"abc"
);
}
}
public
void
Issue192_InParameterWorksWithSimilarNames
()
{
var
rows
=
connection
.
Query
(
@"
declare @Issue192 table (
Field INT NOT NULL PRIMARY KEY IDENTITY(1,1),
Field_1 INT NOT NULL);
insert @Issue192(Field_1) values (1), (2), (3);
SELECT * FROM @Issue192 WHERE Field IN @Field AND Field_1 IN @Field_1"
,
new
{
Field
=
new
[]
{
1
,
2
},
Field_1
=
new
[]
{
2
,
3
}
}).
Single
();
((
int
)
rows
.
Field
).
IsEqualTo
(
2
);
((
int
)
rows
.
Field_1
).
IsEqualTo
(
2
);
}
public
void
Issue192_InParameterWorksWithSimilarNamesWithUnicode
()
{
var
rows
=
connection
.
Query
(
@"
declare @Issue192 table (
Field INT NOT NULL PRIMARY KEY IDENTITY(1,1),
Field_1 INT NOT NULL);
insert @Issue192(Field_1) values (1), (2), (3);
SELECT * FROM @Issue192 WHERE Field IN @µ AND Field_1 IN @µµ"
,
new
{
µ
=
new
[]
{
1
,
2
},
µµ
=
new
[]
{
2
,
3
}
}).
Single
();
((
int
)
rows
.
Field
).
IsEqualTo
(
2
);
((
int
)
rows
.
Field_1
).
IsEqualTo
(
2
);
}
#if POSTGRESQL
#if POSTGRESQL
class
Cat
class
Cat
...
...
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