jehugaleahsa / SQLGeneration

Provides core classes for generating SQL at runtime.
The Unlicense
22 stars 10 forks source link

Insert statements - InvalidOperation exception.. #13

Closed dazinator closed 10 years ago

dazinator commented 10 years ago

So.. I have moved on from SELECT to INSERT! :)

Discovered how to make SQLGeneration throw an InvalidOperationException by using the following flavour of Insert SQL:-

            var sql = "INSERT INTO [contact] DEFAULT VALUES";
            var commandBuilder = new CommandBuilder();
            var options = new CommandBuilderOptions();
            options.PlaceholderPrefix = ParameterToken;
            var sqlCommandBuilder = commandBuilder.GetCommand(sql , options);
jehugaleahsa commented 10 years ago

Yup. I don't support that syntax.

Do you know if that is T-SQL specific or part of standard SQL? At some point I would like to extend my support of T-SQL because I love the WITH clause and update-from.

The way my language parser is configured I should be able to eventually have a grammar for each supported DBMS. I'd like to spend some time simplifying the code for actually doing the parsing at some point so it doesn't take a rocket scientist to extend the language. On Mar 27, 2014 5:50 PM, "Darrell" notifications@github.com wrote:

So.. I have moved on from SELECT to INSERT! :)

Discovered how to make SQLGeneration throw an InvalidOperationException by using the following flavour of Insert SQL:-

var sql = "INSERT INTO [contact] DEFAULT VALUES";var commandText = command.CommandText; var commandBuilder = new CommandBuilder(); var options = new CommandBuilderOptions(); options.PlaceholderPrefix = ParameterToken; var sqlCommandBuilder = commandBuilder.GetCommand(commandText, options);

Reply to this email directly or view it on GitHubhttps://github.com/jehugaleahsa/SQLGeneration/issues/13 .

dazinator commented 10 years ago

Placing my trust in the following wikipedia article, it looks like it is T-SQL and not SQL, http://en.wikipedia.org/wiki/Insert_(SQL)

Thats fine, I can live with no support for this. I doubt this is really going to impede anyone using Dynamics, hopefully thats not me being too short sighted. pah! I will keep the unit test around though, perhaps like you say it can be supported in the future, one for the back burner.

I think I have 98% of my unit tests written now around Insert, I don't think I will be raising any more issues for Insert now. I will be moving onto Update next which I am expecting to be perhaps a little more tricky we shall see..