Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing _ from Column names causes strange behaviour in MYSQL and MSSQL #45

Open
b2802 opened this issue Mar 19, 2010 · 0 comments
Open

Comments

@b2802
Copy link

b2802 commented Mar 19, 2010

For testing purpose I renamed CustomerID in Northwind DB to Customer_ID and used the checked in version of Settings.ttinclude with function CleanUpColumnName. This function has line res=res.Replace("_","") before returning. In ActiveRecords Customer_ID is "transformed" to CustomerId.
now using var cust = SouthWind.Customer.Find(x => x.CustomerId.StartsWith("A")); in code results in Exception: Unknown Column Name 'CustomerId'
[SqlException (0x80131904): Ungültiger Spaltenname 'CustomerId'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2394
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +83
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
SubSonic.DataProviders.DbDataProvider.ExecuteReader(QueryCommand qry) in E:\Develop_tools\SubSonic\Subsonic3\SubSonic-3.0\SubSonic.Core\DataProviders\DbDataProvider.cs:137
SubSonic.Linq.Structure.DbQueryProvider.Execute(QueryCommand1 query, Object[] paramValues) in E:\Develop_tools\SubSonic\Subsonic3\SubSonic-3.0\SubSonic.Core\Linq\Structure\DbQueryProvider.cs:280 lambda_method(ExecutionScope ) +605 SubSonic.Linq.Structure.DbQueryProvider.Execute(Expression expression) in E:\Develop_tools\SubSonic\Subsonic3\SubSonic-3.0\SubSonic.Core\Linq\Structure\DbQueryProvider.cs:131 SubSonic.Linq.Structure.QueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) in E:\Develop_tools\SubSonic\Subsonic3\SubSonic-3.0\SubSonic.Core\Linq\Structure\QueryProvider.cs:50 SubSonic.Linq.Structure.Query1.GetEnumerator() in E:\Develop_tools\SubSonic\Subsonic3\SubSonic-3.0\SubSonic.Core\Linq\Structure\Query.cs:85
System.Collections.Generic.List1..ctor(IEnumerable1 collection) +7667878
System.Linq.Enumerable.ToList(IEnumerable1 source) +61 SouthWind.Customer.Find(Expression1 expression) in E:\SourceWeb\SubSonic3\DALTEST\DAL_MS\ActiveRecord.cs:694
DALTEST._Default.Page_Load(Object sender, EventArgs e) in E:\SourceWeb\SubSonic3\DALTEST\Default.aspx.cs:47
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

using this code on the other hand :
var db = new SouthWind.NorthwindDB();
var cust2=db.Select.From<SouthWind.Customer().ExecuteTypedList<SouthWind.Customer>();
doesn't cause an exception and returns 91 values but all elements inside list have CustomerId=null.

Commenting out line res = res.Replace("_",""); in settings.ttinclude fixes this problem
Has anyone an explanation why changing UpperCase to LowerCase has no influence but any other changing EG. removing _ or replacing "ID" with "TEST" causes problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant