SQL Parsing in C#? [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
in my application , i have a textbox where user can paste Sql (mainly from MS-ACCESS) , i need to parse this SQL and get the table names , joins , Columns etc.
is there a easy in c# rather than using string manupulation to do this activity?
i can think of implementing a BST aslo but don't have any clue where to start?

Irony for C# has an LALR parser with several grammars already created, including one for SQL (as you can see from the screenshot on the home page). It's a very easy to use parser using operator overloads to define the grammars in a way reminiscent to BNF.

I'd suggest ANTLR using SQL Server 2000 grammar as a template.

I've done some work using the gold parser to be able to parse and programatically explore SQL statements. In my case it is SQL 89 which would not include a fair amount of access syntax but may be someone you could build on.
http://www.codeproject.com/KB/linq/QueryAnything.aspx
It's still somewhat experimental but the underlying parsing is pretty flexible.

I have had some success using this: https://github.com/jehugaleahsa/SQLGeneration
It's free to use, is open source, worth checking out.

Related

Can I parse C functions with a regular expression in C#? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
For my diploma thesis I need to implement certain static C code analysis and I am desperately looking for a framework/library that would allow me to parse C source code, split it up into single functions, for every function determine what variables are changed in the function body and derive certain annotations for the code automatically.
Is there any good framework written in C# or generally as .Net class for this purpose?
What about googling for "C Parser written in C#"?
I got this as first link: http://code.google.com/p/cpp-ripper/
Also, I think the C grammar can be found in quite a lot of places, so you might just want to open up your .NET variant of lex/yacc and go from there?
You might like to check ANTLR. It comes with versions of several versions, included C and C#. There are some free grammars on ANTLR web site, including C.
I had a similiar problem and having done a research about YACC tools for C# I have chosen Gold Parsing System with Semantic Engine. My project was parsing SQL queries and generating logical query plans (from T-SQL grammar subset).
I really recommend it. Those 2 libraries make parsing stuff painless and allow to map grammar to the object model in your code. It feels very intuitive and made my project successful :) However, it may lack some advanced ANTLR features, so recognize your needs carefully.
Gold Project http://www.devincook.com/goldparser/
Semantic Engine Lib http://code.google.com/p/bsn-goldparser
If you're ok with using GPL'd code, you might want to take a look at the GCC source code. If you need to do it within .Net, you can always use p/invoke to call code from the GCC libraries.

Does a C# parser generator that returns parse forests for ambiguous statements exist? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I would like to explore the use of formal language processing in the context of natural languages. To do so, I am searching for a parser generator that is robust to ambiguity in the sense that it won't denote EBNF as invalid when it multiple productions can be used to produce the same string. Furthermore, the standard way of handling redundancy is by returning parse forests instead of parse trees.
I am NOT asking what the best tool is, but only if there are tools that can be obtained for C#. And if there are, where can I find them.
It does not matter if the tool is open-source or proprietary.
The answer will be awarded to the longest list of unique (not mentioned earlier) tools which satisfy the required constraints on the parser returned by the parser generator.
Please help me explore parse forests.
You may find an implementation of Earley's Algorithm that does what you want, e.g. https://github.com/coonsta/earley
My own natural language engine (nlp.abodit.com) is based on an algorithm similar to Earley's.

XML comments generator for VS 2008 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I am looking for XML comment generator like GhostDoc for VS 2008. I am looking for open source tool. Is there any Resharper- plug-in for generating XML comments?
Yes, there is: StyleCop for ReSharper. Among a lot of other stuff, it can automatically create comments when you clean your code.
Take a look at Sandcastle. It might be what you are looking for, at least it is open source.
It's not open source, but my addin, AtomineerUtils may suit your needs. It's similar in concept to GhostDoc, but way more powerful and configurable, so it may be able to be configured to achieve what you need without needing access to the source. If it doesn't do something you need, then just mail me - I don't turn down any reasonable feature requests and usually try to implement them as soon as I can.
Alternatively, if you want source code for something very basic in this direction that will get you started, you could take a look here.

Where can I find a graphical designer for linq [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'd like to allow my users to design and create LINQ queries even if they don't know LINQ.
So I am thinking about having a "SQL management studio" like window with the list of tables, fields and relationships and let the user drag and drop.
I could write it myself but it looks difficult. Is there a better way?
Is there a solution somewhere I could use?
LINQPad
I don't believe anyone's tried to tackle this (that I can find at the moment, at least) - it would need to be implemented with dynamic queries driven by the UI. Some links related to that:
http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx
http://www.albahari.com/nutshell/predicatebuilder.aspx
On a side note, if you're letting the users drive the query generation, though, I'm not sure what LINQ is getting you off-hand?
IOW, one alternative might be to use one of the existing GUI interfaces for generating the sql query and use that. If you want to still be able to interact with the strongly-typed classes that your linq-to-sql or linq-to-entities context gives you, you can go with query -> sqlcommand -> sqldatareader -> db.Translate as both give you Translate methods for this kind of scenario.
You could use one of available "SQL visual designers". It's very easy to translate a simple SQL to LINQ then.

Do you have any tips for C# Minification? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I need to minify some C# code in a handful of Silverlight .cs and .xmal files. What are your tips for maintaining one code base and running a "tool" to generate minified code for a project?
Are there any tools (like Resharper) that will do this? If not fully, partially or assist in some way...
EDIT: I realize that there is no need for C# minification. This is an exercise that I'm doing that does not make sense on the face of it. (This is not homework.)
How about a source-code obfuscator? They generally abbreviate names, etc - and certainly remove white space.
For example, here, with demo here (although you'd probably want to disable the string encoding if possible). Note that this isn't a direct recommendation: this is just the first hit I got for C# code obfuscator.
Is that necessary? It was my understanding that the compiled .Net assembly would be sent across the wire, not the C# (or whatever language) source code.
Here are two "Lessons Learned" posts from other 10k entrants:
Thoughts on the MIX 10K challenge
MIX09 10K Smart Coding Challenge

Categories

Resources