jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: SQL and javascript replace
Date Mon, 31 Dec 2007 00:05:29 GMT
Check that there is no extraneous whitespace after the function call.

On 30/12/2007, Shane Petroff <shane@mayet.ca> wrote:
> Hello,
>
> I'm having trouble doing a simple text substitution. I am currently
> pulling query type and query data for use in a JDBC Sampler out of a CSV
> file. I wanted to do some simple text substitution on the query strings
> before execution, and the __javaScript function seemed to be the answer.
> The query string I am using is:
>
> ${__javaScript('${query_value}'.replace('randomText'\,'testing 123'))}
>
> Where the 'query_value' variable holds the sql command string. I've
> interspersed the CSV file with instances of 'randomText' and was hoping
> to replace them with a block of randomly generated characters. The idea
> being that if one loops through the CSV file multiple times, then every
> update gets executed multiple times and the db figures out that there is
> nothing to update. I was hoping to push test values through to disk
> every time by updating with random text. E.g. "update table_1 set
> a_string = 'randomText' where a_key = 1" would be executed as something
> like "update table_1 set a_string = 'qd8v4Bg' where a_key = 1" and each
> loop would push through a new value because a_string would always be
> different. I was hoping to handle inserts in a similar manner,
> generating new keys each time. However, there are a large percentage of
> queries in which this strategy fails. I'm not exactly sure why it fails,
> but I end up with scads of exceptions in the log file (and a good number
> of queries which succeed).
>
> 2007/12/29 23:18:10 ERROR - jmeter.threads.JMeterThread:
> org.mozilla.javascript.EvaluatorException: missing ; before statement
> (<cmd>#1)
>    at
> org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:98)
>    at
> org.mozilla.javascript.DefaultErrorReporter.error(DefaultErrorReporter.java:85)
>    at org.mozilla.javascript.Parser.addError(Parser.java:126)
>    at org.mozilla.javascript.Parser.reportError(Parser.java:132)
>    at org.mozilla.javascript.Parser.statementHelper(Parser.java:1175)
>    at org.mozilla.javascript.Parser.statement(Parser.java:623)
>    at org.mozilla.javascript.Parser.parse(Parser.java:355)
>    at org.mozilla.javascript.Parser.parse(Parser.java:293)
>    at org.mozilla.javascript.Context.compileImpl(Context.java:2238)
>    at org.mozilla.javascript.Context.compileString(Context.java:1284)
>    at org.mozilla.javascript.Context.compileString(Context.java:1273)
>    at org.mozilla.javascript.Context.evaluateString(Context.java:1129)
>    at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:91)
>    at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:128)
>    at
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:97)
>    at
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:85)
>    at
> org.apache.jmeter.testbeans.TestBeanHelper.prepare(TestBeanHelper.java:70)
>    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:297)
>    at java.lang.Thread.run(Unknown Source)
>
> It's as though the sql text itself is being interpreted and not
> surprisingly bombs. Any idea what is going wrong? Is there any way to
> avoid simply recycling values on each loop of a jdbc test? Thanks.
>
> --
> Shane
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message