Yes, I am tokenizing. It is a syntax similar to a SQL where clause. It
seems simple enough. I have to know what type of token I have found. I
have that covered already with my token class. It tells me the token
type and the actual value. Hopefully this will work out smoothly.- Hide quoted text -
- Show quoted text -
Awesome! I got my parser working. The intent of the code was to allow
my database library to generate the WHERE clause of a SQL statement by
interpretting conditions on properties of my business objects.
So, say I have a Customer class with properties that map to a database
table. My library has features for mapping between database tables and
classes via XML or Attributes (similar to NHibernate or LINQ). I
wanted to allow the users of my library to get away from SQL
completely. So, they can now say something like this:
foreach (Customer customer in registry.CreateQuery<Customer>(
"(Name = {0} AND State = {1}) OR Type = {2}",
"Microsoft", "WA", "Preferred"))
{
}
My code will generate database-specific SQL with the actual table name
and column names used instead of the class and property names.
The cool thing now is that I don't need to write SQL anymore and so my
code becomes a little more database independent. I generate my classes
and attributes/mapping files using a tool I wrote too, so I don't have
to worry about writing that either.
DB development just became a whole lot easier for my users. Yay!
Thanks for everyone's input.
~Travis