Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fdd7fcf

Browse filesBrowse files
Obsolete literal AddColumn (#3517)
1 parent b3256e7 commit fdd7fcf
Copy full SHA for fdd7fcf

File tree

Expand file treeCollapse file tree

4 files changed

+14
-2
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+14
-2
lines changed

‎src/NHibernate.Test/SqlCommandTest/SqlInsertBuilderFixture.cs

Copy file name to clipboardExpand all lines: src/NHibernate.Test/SqlCommandTest/SqlInsertBuilderFixture.cs
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public void InsertSqlStringTest()
2626

2727
insert.AddColumn("intColumn", NHibernateUtil.Int32);
2828
insert.AddColumn("longColumn", NHibernateUtil.Int64);
29+
#pragma warning disable CS0618 // Type or member is obsolete
2930
insert.AddColumn("literalColumn", false, (ILiteralType) NHibernateUtil.Boolean);
31+
#pragma warning restore CS0618 // Type or member is obsolete
3032
insert.AddColumn("stringColumn", 5.ToString());
3133

3234
SqlCommandInfo sqlCommand = insert.ToSqlCommandInfo();
@@ -53,7 +55,9 @@ public void Commented()
5355

5456
insert.SetTableName("test_insert_builder");
5557

58+
#pragma warning disable CS0618 // Type or member is obsolete
5659
insert.AddColumn("stringColumn", "aSQLValue", (ILiteralType)NHibernateUtil.String);
60+
#pragma warning restore CS0618 // Type or member is obsolete
5761
insert.SetComment("Test insert");
5862
string expectedSql =
5963
"/* Test insert */ INSERT INTO test_insert_builder (stringColumn) VALUES ('aSQLValue')";
@@ -71,7 +75,9 @@ public void MixingParametersAndValues()
7175

7276
insert.SetTableName("test_insert_builder");
7377

78+
#pragma warning disable CS0618 // Type or member is obsolete
7479
insert.AddColumn("literalColumn", false, (ILiteralType)NHibernateUtil.Boolean);
80+
#pragma warning restore CS0618 // Type or member is obsolete
7581
insert.AddColumn("intColumn", NHibernateUtil.Int32);
7682
insert.AddColumn("stringColumn", 5.ToString());
7783
insert.AddColumn("longColumn", NHibernateUtil.Int64);
@@ -89,4 +95,4 @@ public void MixingParametersAndValues()
8995
Assert.AreEqual(SqlTypeFactory.Int64, actualParameterTypes[1], "Second Parameter Type");
9096
}
9197
}
92-
}
98+
}

‎src/NHibernate.Test/SqlCommandTest/SqlUpdateBuilderFixture.cs

Copy file name to clipboardExpand all lines: src/NHibernate.Test/SqlCommandTest/SqlUpdateBuilderFixture.cs
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public void UpdateStringSqlTest()
2828

2929
update.AddColumns(new string[] {"intColumn"}, NHibernateUtil.Int32);
3030
update.AddColumns(new string[] {"longColumn"}, NHibernateUtil.Int64);
31+
#pragma warning disable CS0618 // Type or member is obsolete
3132
update.AddColumn("literalColumn", false, (ILiteralType) NHibernateUtil.Boolean);
33+
#pragma warning restore CS0618 // Type or member is obsolete
3234
update.AddColumn("stringColumn", 5.ToString());
3335

3436
update.SetIdentityColumn(new string[] {"decimalColumn"}, NHibernateUtil.Decimal);
@@ -60,4 +62,4 @@ public void UpdateStringSqlTest()
6062
Assert.AreEqual(expectedParameterTypes[3], actualParameterTypes[3], "fourthParam Type");
6163
}
6264
}
63-
}
65+
}

‎src/NHibernate/SqlCommand/SqlInsertBuilder.cs

Copy file name to clipboardExpand all lines: src/NHibernate/SqlCommand/SqlInsertBuilder.cs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public virtual SqlInsertBuilder AddColumn(string columnName, IType propertyType)
6666
/// <param name="val">The value to set for the column.</param>
6767
/// <param name="literalType">The NHibernateType to use to convert the value to a sql string.</param>
6868
/// <returns>The SqlInsertBuilder.</returns>
69+
// Since v5.6
70+
[Obsolete("This method is unsafe and has no more usages. Use the overload with a property type and use a parameterized query.")]
6971
public SqlInsertBuilder AddColumn(string columnName, object val, ILiteralType literalType)
7072
{
7173
return AddColumn(columnName, literalType.ObjectToSQLString(val, Dialect));

‎src/NHibernate/SqlCommand/SqlUpdateBuilder.cs

Copy file name to clipboardExpand all lines: src/NHibernate/SqlCommand/SqlUpdateBuilder.cs
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public SqlUpdateBuilder SetComment(string comment)
4747
/// <param name="val">The value to set for the column.</param>
4848
/// <param name="literalType">The NHibernateType to use to convert the value to a sql string.</param>
4949
/// <returns>The SqlUpdateBuilder.</returns>
50+
// Since v5.6
51+
[Obsolete("This method is unsafe and has no more usages. Use the overload with a property type and use a parameterized query.")]
5052
public SqlUpdateBuilder AddColumn(string columnName, object val, ILiteralType literalType)
5153
{
5254
return AddColumn(columnName, literalType.ObjectToSQLString(val, Dialect));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.