All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.j256.ormlite.stmt.query.SetValue Maven / Gradle / Ivy

Go to download

Lightweight Object Relational Model (ORM) for persisting objects to SQL databases.

There is a newer version: 6.1
Show newest version
package com.j256.ormlite.stmt.query;

import java.sql.SQLException;

import com.j256.ormlite.field.FieldType;
import com.j256.ormlite.stmt.ArgumentHolder;
import com.j256.ormlite.stmt.NullArgHolder;
import com.j256.ormlite.stmt.StatementBuilder;

/**
 * Internal class handling the SQL SET part used by UPDATE statements. Used by
 * {@link StatementBuilder#updateColumnValue(String, Object)}.
 * 
 * 

* It's not a comparison per se but does have a columnName = value form so it works. *

* * @author graywatson */ public class SetValue extends BaseComparison { /** * Special value in case we are trying to set a field to null. We can't just use the null value because it looks * like the argument has not been set in the base class. */ private static final ArgumentHolder nullValue = new NullArgHolder(); public SetValue(String columnName, FieldType fieldType, Object value) throws SQLException { super(columnName, fieldType, (value == null ? nullValue : value), false); } @Override public void appendOperation(StringBuilder sb) { sb.append("= "); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy