Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Creative commons Attribution-NonCommercial license. http://creativecommons.org/licenses/by-nc/2.5/au/deed.en_GB NO WARRANTY IS GIVEN OR IMPLIED, USE AT YOUR OWN RISK.
 
 package base.jee.api.cassandra.util;
 
public class UpdateSetting {
	public static void updateSetting(Session sString nameString value) {
		PreparedStatement p = s.prepare("select value from setting where name=?");
		ResultSet r = s.execute(p.bind(value));
		Row rs = r.iterator().next();
		if(rs != null) {
			if(rs.getString(0).equals(value)) {
				return;
			}
			p = s.prepare("update setting set value=? where name=?");
			s.execute(p.bind(valuename));
else {
			p = s.prepare("insert into setting (name,value) values(?,?)");
			s.execute(p.bind(namevalue));
		}
	}
New to GrepCode? Check out our FAQ X