https://issues.apache.org/bugzilla/show_bug.cgi?id=46522





--- Comment #4 from Yaroslav <slavk...@yahoo.com>  2009-01-14 09:35:01 PST ---
Hi Sebb2,
As you asked I did some research.

I've found some tricky staff to get an expected result - need to use a "field's
alias" - so, the next statement will be working as expected:

#3>select 'visittypeid=' + CAST(visittypeid AS VARCHAR) AS a, ('typename='  +
typename) as b, ('version=' + CAST(version AS VARCHAR)) AS c from
storeshop.visittypes;

Sorry, I was wrong about the result in MySql (see Description) - I'm using
there fields' aliases.

But I've also found another fanny staff - if I'm using in my java code
field-numbers (because fields' aliases are not defined in SQL statement) then
it works!!!, so the next Beanshell code shows it:
-------
import java.sql.*;

Class.forName("com...");
Connection conn = DriverManager.getConnection ("jdbc:...." );

String sql="select 'visittypeid=' + CAST(visittypeid AS VARCHAR), 'typename=' 
+ typename, 'version=' + CAST(version AS VARCHAR) from storeshop.visittypes";

Statement db_statement = conn.createStatement();
ResultSet result = db_statement.executeQuery (sql);
while (result.next() )
{
        System.out.println ("by filed's # ===>  " + result.getString(1) + "   "
+ result.getString(2) + "    " + result.getString(3));
}
-------
result:
by filed's # ===>  visittypeid=1   typename=Secret Shop    version=1
by filed's # ===>  visittypeid=2   typename=Blitz (Jun-Nov)    version=1
by filed's # ===>  visittypeid=3   typename=Training    version=1
by filed's # ===>  visittypeid=4   typename=Casual Visit    version=1
by filed's # ===>  visittypeid=5   typename=Blitz (2008 Holiday)    version=1

So, we have a case when SQL statement does not provide fields' aliases in
positions where expression are used - then we have the problem.
But using fields' numbers in Jmeter would fix the problem. ;)

I think that the "dedicated" restriction (using aliases' names in SQL
statement) should be placed in Jmeter manual if the "issue" will not be fixed
in Jmeter soon.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to