Select query without FROM with JetDriver

Description

To reproduce the issue run the attached application. The query it's here:

string hql = "select f1, f2.Artlta from FArt f1, FLta f2 where f1.Codart = f2.Artlta";

IQuery q = s.CreateQuery(hql);

q.List();

The line fix for this could be this in the method TransformFromClause:

"return "from " + transformed;"

Here it's the resultant code:

private string TransformFromClause(string fromClause)
{
string transformed;

//"from ".Length
const int fromLength = 5;
fromClause = fromClause.Substring(fromLength, fromClause.Length - fromLength);
string[] blocks = fromClause.Split(',');
if (blocks.Length > 1)
{
for (int i = 0; i < blocks.Length; i++)
{
string tr = TransformJoinBlock(blocks[i]);
if (tr.IndexOf(" join ") > -1)
{
blocks[i] = "(select * from " + tr + ") as jetJoinAlias" + i.ToString();
}
else
{
blocks[i] = tr;
}
}

transformed = string.Join(",", blocks);
}
else
{
transformed = "from " + TransformJoinBlock(blocks[0]);
}

return "from " + transformed;
}

Environment

None

Attachments

1
100% Done
Loading...

Activity

Show:

Gene Trog 
August 21, 2008 at 1:46 PM

I inadvertently posted a duplicate of this issue, but as of the latest revision from the 1.2.1 branch, this is still an issue. I've included a small sample that demonstrates the problem

My duplicate issue: https://nhibernate.jira.com/browse/NHCD-2

Sergey Cherkasov 
August 18, 2008 at 5:43 AM

SQL query is still built without key word 'from' in the case, when the request from 2 and more tables is done.
File: JetDriver.cs
Method: private string TransformFromClause(string fromClause)
Line: 155
Old line: transformed = string.Join(",", blocks);
Corrected line: transformed = "from " + string.Join(",", blocks);

Former user 
September 21, 2007 at 2:57 PM

Looks like it's a duplicate.

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created August 10, 2007 at 7:38 AM
Updated August 21, 2008 at 1:46 PM
Resolved September 21, 2007 at 2:57 PM
Who's Looking?