Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

removed brackets from INSERT INTO #175

Merged
merged 1 commit into from

3 participants

@randallsutton

Brackets were added to the INSERT INTO statement around the table name. This causes an error when using schemas. The INSERT INTO statements have a table name of [schema.table] instead of [schema].[table].

I removed this change. A correct implementation would include proper schema handling as well as applying the change for all statements, not just INSERT INTO.

@CreepyGnome

I also noticed this one and seems to work find without them for both schema and non schema. If that is the case with this change does proper schema handling need to be implemented?

@randallsutton
@CreepyGnome

Well I would say its back practice to use keywords for any names in databases or in code. I wouldn't expect Massive to explicitly support someone using keywords in those situations. However I understand when you find yourself in a situation like that you just want it to work for you.

Massive may already work for you without having hard coded square brackets. Have your tried passing the table name to DynamicModel cstor with the square brackets already around it for tables that are keywords? This may also allow it to include schema naming with it if needed.

Also having a keyword as a table name should break several other places in Massive that use the TableName property to generate queries right? I count almost 20 places where this occurs other than this insert that it may also cause an error.

@randallsutton
@robconery robconery merged commit 1e38d33 into FransBouma:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 18, 2012
  1. @randallsutton
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  Massive.cs
View
2  Massive.cs
@@ -424,7 +424,7 @@ private dynamic BuildPagedResult(string sql = "", string primaryKeyField = "", s
var settings = (IDictionary<string, object>)expando;
var sbKeys = new StringBuilder();
var sbVals = new StringBuilder();
- var stub = "INSERT INTO [{0}] ({1}) \r\n VALUES ({2})";
+ var stub = "INSERT INTO {0} ({1}) \r\n VALUES ({2})";
result = CreateCommand(stub, null);
int counter = 0;
foreach (var item in settings) {
Something went wrong with that request. Please try again.