Orchard Hungary is an archive

This site is now an archive. We'll keep it so the content is accessible, but we won't update it anymore. However, we frequently publish Orchard-related news on our other site Orchard Dojo, so be sure to check that out instead. And if you're interested in news about our Orchard development company, Lombiq, check out our website.

A harsh reminder that you can't forget what's below the abstraction

Tags: Orchard, SQL, exceptions

So you're a high-level programmer that much that you write software in Flash. Running in JavaScript. In a browser that runs on a virtual machine that runs on an actual OS that... Or simply you write a module that runs in a framework running on a framework running on a framework running on a framework (Orchard - ASP.NET MVC - ASP.NET - .NET) that uses an abstraction of database tables (records) aided by a layer that abstracts a layer that abstracts a data storage (Content Query - NHibernate - SQL) - that BTW itself abstracts a whole lot of things - to wrap it up quickly. And you thought you don't have to think about all that below! Got ya!

I've created a content part that had an innocent little property called Index (what, for the historical accuracy, was of type int), and below that there was a similarly named property in the part record. Guess what I got when I tried to use this?

This exception:

System.Data.SqlServerCe.SqlCeException: There was an error parsing the query. 
[ Token line number = 1,Token line offset = 402,Token in error = Index ]

Also some other rather cryptic ones. Now what's the issue? "Index" is a keyword in SQL of course so it can't be used, or at least not in the way the generated query wanted it (because there was no issue running the migrations). See, SQL is haunting your high-level, pure-OO dreams!

No Comments