Skip to content

Commit 19a4cf3

Browse files
committed
C#: Update test cases that depends on System.Data.cs to use generated stubs.
1 parent 7cb758a commit 19a4cf3

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
semmle-extractor-options: /r:System.Data.dll /r:System.ComponentModel.Primitives.dll /r:System.ComponentModel.TypeConverter.dll ${testdir}/../../../resources/stubs/EntityFramework.cs ${testdir}/../../../resources/stubs/System.Data.cs /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll /r:System.Linq.dll
2-
semmle-extractor-options: ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.Annotations.cs ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.cs
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
3+
semmle-extractor-options: ${testdir}/../../../resources/stubs/EntityFramework.cs
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
sqlExpressions
2-
| sql.cs:44:23:44:44 | object creation of type MySqlCommand | sql.cs:44:40:44:43 | access to parameter text |
3-
| sql.cs:45:13:45:38 | ... = ... | sql.cs:45:35:45:38 | access to parameter text |
4-
| sql.cs:46:13:46:34 | object creation of type MySqlCommand | sql.cs:46:30:46:33 | access to parameter text |
5-
| sql.cs:46:13:46:53 | ... = ... | sql.cs:46:50:46:53 | access to parameter text |
2+
| sql.cs:54:23:54:44 | object creation of type MySqlCommand | sql.cs:54:40:54:43 | access to parameter text |
3+
| sql.cs:55:13:55:38 | ... = ... | sql.cs:55:35:55:38 | access to parameter text |
4+
| sql.cs:56:13:56:34 | object creation of type MySqlCommand | sql.cs:56:30:56:33 | access to parameter text |
5+
| sql.cs:56:13:56:53 | ... = ... | sql.cs:56:50:56:53 | access to parameter text |
66
sqlCsvSinks
7-
| sql.cs:43:46:43:65 | object creation of type SqlCommand | sql.cs:43:61:43:64 | access to parameter text |
8-
| sql.cs:47:13:47:42 | object creation of type SqlDataAdapter | sql.cs:47:32:47:35 | access to parameter text |
9-
| sql.cs:48:13:48:47 | call to method ExecuteScalar | sql.cs:48:43:48:46 | access to parameter text |
10-
| sql.cs:49:13:49:75 | call to method ExecuteScalar | sql.cs:49:71:49:74 | access to parameter text |
7+
| sql.cs:53:46:53:65 | object creation of type SqlCommand | sql.cs:53:61:53:64 | access to parameter text |
8+
| sql.cs:57:13:57:50 | object creation of type SqlDataAdapter | sql.cs:57:32:57:35 | access to parameter text |
9+
| sql.cs:58:13:58:47 | call to method ExecuteScalar | sql.cs:58:43:58:46 | access to parameter text |
10+
| sql.cs:59:13:59:75 | call to method ExecuteScalar | sql.cs:59:71:59:74 | access to parameter text |
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Data.cs
2-
semmle-extractor-options: ${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/System.ComponentModel.cs
3-
semmle-extractor-options: /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
3+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/System.Data.SqlClient/4.8.5/System.Data.SqlClient.csproj

csharp/ql/test/library-tests/frameworks/sql/sql.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ public class MySqlCommand : IDbCommand
88
{
99
public MySqlCommand(string commandText) { }
1010

11+
public void Cancel() => throw null;
1112
public string CommandText { get; set; }
12-
13-
public IDataReader ExecuteReader() => throw null;
13+
public int CommandTimeout { get; set; }
1414
public CommandType CommandType { get; set; }
15-
public IDataParameterCollection Parameters { get; set; }
15+
public IDbConnection Connection { get; set; }
16+
public IDbDataParameter CreateParameter() => throw null;
17+
public int ExecuteNonQuery() => throw null;
18+
public IDataReader ExecuteReader() => throw null;
19+
public IDataReader ExecuteReader(CommandBehavior behavior) => throw null;
20+
public object ExecuteScalar() => throw null;
21+
public IDataParameterCollection Parameters { get; }
22+
public void Prepare() => throw null;
23+
public IDbTransaction Transaction { get; set; }
24+
public UpdateRowSource UpdatedRowSource { get; set; }
25+
public void Dispose() => throw null;
1626
}
1727

1828
public class MySqlHelper
@@ -44,7 +54,7 @@ public static void TestMethod(string text)
4454
command = new MySqlCommand(text);
4555
command.CommandText = text;
4656
new MySqlCommand(text).CommandText = text;
47-
new SqlDataAdapter(text, null);
57+
new SqlDataAdapter(text, string.Empty);
4858
MySqlHelper.ExecuteScalar("", text);
4959
SqlHelper.ExecuteScalar("", System.Data.CommandType.Text, text);
5060
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
semmle-extractor-options: /r:System.Data.dll /r:System.ComponentModel.Primitives.dll /r:System.ComponentModel.TypeConverter.dll ${testdir}/../../../../resources/stubs/EntityFramework.cs ${testdir}/../../../../resources/stubs/System.Data.cs /r:System.ComponentModel.TypeConverter.dll /r:System.Data.Common.dll
1+
semmle-extractor-options: /nostdlib /noconfig
2+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
3+
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../../resources/stubs/System.Data.OleDb/8.0.0/System.Data.OleDb.csproj
4+
semmle-extractor-options: ${testdir}/../../../../resources/stubs/EntityFramework.cs

0 commit comments

Comments
 (0)