BUG #2680: Update statement did not work with String object

From: "Ravindra" <ravi(at)computer(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2680: Update statement did not work with String object
Date: 2006-10-06 06:40:29
Message-ID: 200610060640.k966eTmS016749@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2680
Logged by: Ravindra
Email address: ravi(at)computer(dot)org
PostgreSQL version: 8.1.4
Operating system: Debian
Description: Update statement did not work with String object
Details:

when i create a string object with the SQL statement and feed to
statement.executeUpdate(),nothing happens.
but if i write the sql with in statement.executeUpdate() it works.

Following code does not work
String sql="update FieldOptions set option_description='"+newValue+"'
where field_name='country' and
option_code='"+(this.countryCode.trim())+"'";
Connection cn=context.getDBConnection();
statement=cn.createStatement();
int res=statement.executeUpdate(sql);
cn.commit();

but instead of the "sql" String object if i feed the string directly it
works. as given below

int res=statement.executeUpdate("update FieldOptions set
option_description='"+newValue+"' where field_name='country' and
option_code='"+(this.countryCode.trim())+"'");

pleaese check

thanks

ravindra

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Trout 2006-10-06 12:22:04 BUG #2678: Create or replace function with OUT args
Previous Message thanigaivel 2006-10-06 05:26:43 BUG #2679: Logon failure error 1069