You need to sign in to do that
Don't have an account?
.NET data provider/query tool - lets you type SQL against SFDC API and load a DataSet directly
I'm not sure where to put this, so I'll start here.
I spend a lot of time working with databases, and after reading the SFDC API documentation, I didn't think that I would ever get it right, so I wrote a .NET provider in the style of Sytem.Data.SqlClient. It uses SfdcConnection, SfdcCommand, and a language syntax that looks like SQL wrapped in XML. Only 'select' is supported - no insert/update/delete. The output can be fed directly into a DataSet. While I was at it, I added a few SQL-like things:
- Standarizes naming conventions (all uppercase with underscores)
- Automatically generates friendly names for custom fields from labels
- Strong data typing
- Rename columns
- Reorder columns
- An 'in' operator so you don't have to write all of those 'or' statements
- Enforces NOT NULL constraints
Sample code looks like this (contents of CONNECTION_STRING and XMLSQL not shown) :
SfdcConnection conn = new SfdcConnection(CONNECTION_STRING);
SfdcCommand com = conn.CreateCommand();
com.CommandText = XMLSQL;
com.CommandType = SfdcCommandType.XMLSQLText;
//-- Populate the dataset
DataSet dataSet1 = new DataSet();
dataSet1.ReadXml(com.ExecuteXmlReader());
There's also a simple query tool in the style of MS Query Analyzer. You can just type into it and hit F5 to get results back in a grid. You can also watch the request going to SFDC. Originally, this was my testing harness, so it's a little rough, but it's great if you need help developing complex "WHERE" statements.
Barry
P.S. Some help testing would be appreciated, but this is alpha code, so be nice.
P.P.S. Although it's written in .NET, internally, it's designed with a Java port in mind. I just don't need it in Java right now.
This looks great Barry - thanks for posting your sample.
In mere days were are going to release a new API that should make your work even simpler, including a SQL-like query syntax. Stay tuned.