use of com.abubusoft.kripton.android.sqlite.KriptonContentValues in project kripton by xcesco.
the class EmployeeBeanDaoImpl method updateByIdJQL.
/**
* <h2>SQL update:</h2>
* <pre>UPDATE employees SET last_name=:lastName, first_name=:firstName, birth_date=:birthDate, hire_date=:hireDate, address=:address WHERE id=${bean.id}</pre>
*
* <h2>Updated columns:</h2>
* <dl>
* <dt>last_name</dt><dd>is mapped to <strong>${bean.lastName}</strong></dd>
* <dt>first_name</dt><dd>is mapped to <strong>${bean.firstName}</strong></dd>
* <dt>birth_date</dt><dd>is mapped to <strong>${bean.birthDate}</strong></dd>
* <dt>hire_date</dt><dd>is mapped to <strong>${bean.hireDate}</strong></dd>
* <dt>address</dt><dd>is mapped to <strong>${bean.address}</strong></dd>
* </dl>
*
* <h2>Parameters used in where conditions:</h2>
* <dl>
* <dt>${bean.id}</dt><dd>is mapped to method's parameter <strong>bean.id</strong></dd>
* </dl>
*
* @param bean
* is used as ${bean}
*
* @return number of updated records
*/
@Override
public long updateByIdJQL(Employee bean) {
if (updateByIdJQLPreparedStatement5 == null) {
// generate static SQL for statement
String _sql = "UPDATE employees SET last_name=?, first_name=?, birth_date=?, hire_date=?, address=? WHERE id=?";
updateByIdJQLPreparedStatement5 = KriptonDatabaseWrapper.compile(_context, _sql);
}
KriptonContentValues _contentValues = contentValuesForUpdate(updateByIdJQLPreparedStatement5);
_contentValues.put("last_name", bean.lastName);
_contentValues.put("first_name", bean.firstName);
_contentValues.put("birth_date", SQLDateUtils.write(bean.birthDate));
_contentValues.put("hire_date", SQLDateUtils.write(bean.hireDate));
_contentValues.put("address", SQLTypeAdapterUtils.toData(TypeAdapterAddress.class, bean.address));
_contentValues.addWhereArgs(String.valueOf(bean.id));
// log section BEGIN
if (_context.isLogEnabled()) {
// display log
Logger.info("UPDATE employees SET last_name=:last_name, first_name=:first_name, birth_date=:birth_date, hire_date=:hire_date, address=:address WHERE id=?");
// log for content values -- BEGIN
Triple<String, Object, KriptonContentValues.ParamType> _contentValue;
for (int i = 0; i < _contentValues.size(); i++) {
_contentValue = _contentValues.get(i);
if (_contentValue.value1 == null) {
Logger.info("==> :%s = <null>", _contentValue.value0);
} else {
Logger.info("==> :%s = '%s' (%s)", _contentValue.value0, StringUtils.checkSize(_contentValue.value1), _contentValue.value1.getClass().getCanonicalName());
}
}
// log for content values -- END
// log for where parameters -- BEGIN
int _whereParamCounter = 0;
for (String _whereParamItem : _contentValues.whereArgs()) {
Logger.info("==> param%s: '%s'", (_whereParamCounter++), StringUtils.checkSize(_whereParamItem));
}
// log for where parameters -- END
}
// log section END
int result = KriptonDatabaseWrapper.updateDelete(updateByIdJQLPreparedStatement5, _contentValues);
return result;
}
use of com.abubusoft.kripton.android.sqlite.KriptonContentValues in project kripton by xcesco.
the class EmployeeBeanDaoImpl method insert.
/**
* <p>SQL insert:</p>
* <pre>INSERT INTO employees (last_name, first_name, birth_date, hire_date, address, field_boolean, field_byte, field_character, field_short, field_integer, field_long, field_float, field_double, field_string, field_byte_array) VALUES (${bean.lastName}, ${bean.firstName}, ${bean.birthDate}, ${bean.hireDate}, ${bean.address}, ${bean.fieldBoolean}, ${bean.fieldByte}, ${bean.fieldCharacter}, ${bean.fieldShort}, ${bean.fieldInteger}, ${bean.fieldLong}, ${bean.fieldFloat}, ${bean.fieldDouble}, ${bean.fieldString}, ${bean.fieldByteArray})</pre>
*
* <p><code>bean.id</code> is automatically updated because it is the primary key</p>
*
* <p><strong>Inserted columns:</strong></p>
* <dl>
* <dt>last_name</dt><dd>is mapped to <strong>${bean.lastName}</strong></dd>
* <dt>first_name</dt><dd>is mapped to <strong>${bean.firstName}</strong></dd>
* <dt>birth_date</dt><dd>is mapped to <strong>${bean.birthDate}</strong></dd>
* <dt>hire_date</dt><dd>is mapped to <strong>${bean.hireDate}</strong></dd>
* <dt>address</dt><dd>is mapped to <strong>${bean.address}</strong></dd>
* <dt>field_boolean</dt><dd>is mapped to <strong>${bean.fieldBoolean}</strong></dd>
* <dt>field_byte</dt><dd>is mapped to <strong>${bean.fieldByte}</strong></dd>
* <dt>field_character</dt><dd>is mapped to <strong>${bean.fieldCharacter}</strong></dd>
* <dt>field_short</dt><dd>is mapped to <strong>${bean.fieldShort}</strong></dd>
* <dt>field_integer</dt><dd>is mapped to <strong>${bean.fieldInteger}</strong></dd>
* <dt>field_long</dt><dd>is mapped to <strong>${bean.fieldLong}</strong></dd>
* <dt>field_float</dt><dd>is mapped to <strong>${bean.fieldFloat}</strong></dd>
* <dt>field_double</dt><dd>is mapped to <strong>${bean.fieldDouble}</strong></dd>
* <dt>field_string</dt><dd>is mapped to <strong>${bean.fieldString}</strong></dd>
* <dt>field_byte_array</dt><dd>is mapped to <strong>${bean.fieldByteArray}</strong></dd>
* </dl>
*
* @param bean
* is mapped to parameter <strong>bean</strong>
*
* @return <strong>id</strong> of inserted record
*/
@Override
public long insert(Employee bean) {
if (insertPreparedStatement0 == null) {
// generate static SQL for statement
String _sql = "INSERT INTO employees (last_name, first_name, birth_date, hire_date, address, field_boolean, field_byte, field_character, field_short, field_integer, field_long, field_float, field_double, field_string, field_byte_array) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
insertPreparedStatement0 = KriptonDatabaseWrapper.compile(_context, _sql);
}
KriptonContentValues _contentValues = contentValuesForUpdate(insertPreparedStatement0);
_contentValues.put("last_name", bean.lastName);
_contentValues.put("first_name", bean.firstName);
_contentValues.put("birth_date", SQLDateUtils.write(bean.birthDate));
_contentValues.put("hire_date", SQLDateUtils.write(bean.hireDate));
_contentValues.put("address", SQLTypeAdapterUtils.toData(TypeAdapterAddress.class, bean.address));
_contentValues.put("field_boolean", SQLTypeAdapterUtils.toData(TypeAdapterBoolean.class, bean.fieldBoolean));
_contentValues.put("field_byte", SQLTypeAdapterUtils.toData(TypeAdapterByte.class, bean.fieldByte));
_contentValues.put("field_character", SQLTypeAdapterUtils.toData(TypeAdapterChar.class, bean.fieldCharacter));
_contentValues.put("field_short", SQLTypeAdapterUtils.toData(TypeAdapterShort.class, bean.fieldShort));
_contentValues.put("field_integer", SQLTypeAdapterUtils.toData(TypeAdapterInteger.class, bean.fieldInteger));
_contentValues.put("field_long", SQLTypeAdapterUtils.toData(TypeAdapterLong.class, bean.fieldLong));
_contentValues.put("field_float", SQLTypeAdapterUtils.toData(TypeAdapterFloat.class, bean.fieldFloat));
_contentValues.put("field_double", SQLTypeAdapterUtils.toData(TypeAdapterDouble.class, bean.fieldDouble));
_contentValues.put("field_string", SQLTypeAdapterUtils.toData(TypeAdapterString.class, bean.fieldString));
_contentValues.put("field_byte_array", SQLTypeAdapterUtils.toData(TypeAdapterByteArray.class, bean.fieldByteArray));
// log section BEGIN
if (_context.isLogEnabled()) {
// log for insert -- BEGIN
StringBuffer _columnNameBuffer = new StringBuffer();
StringBuffer _columnValueBuffer = new StringBuffer();
String _columnSeparator = "";
for (String columnName : _contentValues.keys()) {
_columnNameBuffer.append(_columnSeparator + columnName);
_columnValueBuffer.append(_columnSeparator + ":" + columnName);
_columnSeparator = ", ";
}
Logger.info("INSERT INTO employees (%s) VALUES (%s)", _columnNameBuffer.toString(), _columnValueBuffer.toString());
// log for content values -- BEGIN
Triple<String, Object, KriptonContentValues.ParamType> _contentValue;
for (int i = 0; i < _contentValues.size(); i++) {
_contentValue = _contentValues.get(i);
if (_contentValue.value1 == null) {
Logger.info("==> :%s = <null>", _contentValue.value0);
} else {
Logger.info("==> :%s = '%s' (%s)", _contentValue.value0, StringUtils.checkSize(_contentValue.value1), _contentValue.value1.getClass().getCanonicalName());
}
}
// log for content values -- END
// log for insert -- END
// log for where parameters -- BEGIN
int _whereParamCounter = 0;
for (String _whereParamItem : _contentValues.whereArgs()) {
Logger.info("==> param%s: '%s'", (_whereParamCounter++), StringUtils.checkSize(_whereParamItem));
}
// log for where parameters -- END
}
// log section END
// insert operation
long result = KriptonDatabaseWrapper.insert(insertPreparedStatement0, _contentValues);
bean.id = result;
return result;
}
use of com.abubusoft.kripton.android.sqlite.KriptonContentValues in project kripton by xcesco.
the class EmployeeBeanDaoImpl method delete.
/**
* <h2>SQL delete:</h2>
* <pre>DELETE FROM employees WHERE id=${bean.id} and field_byte=${bean.fieldByte} and field_character=${bean.fieldCharacter} and field_short=${bean.fieldShort} and field_integer=${bean.fieldInteger} and field_long=${bean.fieldLong} and field_float=${bean.fieldFloat} and field_double=${bean.fieldDouble} and field_string=${bean.fieldString} and field_byte_array=${bean.fieldByteArray}</pre>
*
* <h2>Parameters used in where conditions:</h2>
* <dl>
* <dt>${bean.id}</dt><dd>is mapped to method's parameter <strong>bean.id</strong></dd>
* <dt>${bean.fieldByte}</dt><dd>is mapped to method's parameter <strong>bean.fieldByte</strong></dd>
* <dt>${bean.fieldCharacter}</dt><dd>is mapped to method's parameter <strong>bean.fieldCharacter</strong></dd>
* <dt>${bean.fieldShort}</dt><dd>is mapped to method's parameter <strong>bean.fieldShort</strong></dd>
* <dt>${bean.fieldInteger}</dt><dd>is mapped to method's parameter <strong>bean.fieldInteger</strong></dd>
* <dt>${bean.fieldLong}</dt><dd>is mapped to method's parameter <strong>bean.fieldLong</strong></dd>
* <dt>${bean.fieldFloat}</dt><dd>is mapped to method's parameter <strong>bean.fieldFloat</strong></dd>
* <dt>${bean.fieldDouble}</dt><dd>is mapped to method's parameter <strong>bean.fieldDouble</strong></dd>
* <dt>${bean.fieldString}</dt><dd>is mapped to method's parameter <strong>bean.fieldString</strong></dd>
* <dt>${bean.fieldByteArray}</dt><dd>is mapped to method's parameter <strong>bean.fieldByteArray</strong></dd>
* </dl>
*
* @param bean
* is used as ${bean}
*
* @return number of deleted records
*/
@Override
public long delete(Employee bean) {
if (deletePreparedStatement6 == null) {
// generate static SQL for statement
String _sql = "DELETE FROM employees WHERE id=? and field_byte=? and field_character=? and field_short=? and field_integer=? and field_long=? and field_float=? and field_double=? and field_string=? and field_byte_array=?";
deletePreparedStatement6 = KriptonDatabaseWrapper.compile(_context, _sql);
}
KriptonContentValues _contentValues = contentValuesForUpdate(deletePreparedStatement6);
_contentValues.addWhereArgs(String.valueOf(bean.id));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterByte.class, bean.fieldByte));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterChar.class, bean.fieldCharacter));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterShort.class, bean.fieldShort));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterInteger.class, bean.fieldInteger));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterLong.class, bean.fieldLong));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterFloat.class, bean.fieldFloat));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterDouble.class, bean.fieldDouble));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterString.class, bean.fieldString));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterByteArray.class, bean.fieldByteArray));
// log section BEGIN
if (_context.isLogEnabled()) {
// display log
Logger.info("DELETE FROM employees WHERE id=? and field_byte=? and field_character=? and field_short=? and field_integer=? and field_long=? and field_float=? and field_double=? and field_string=? and field_byte_array=?");
// log for where parameters -- BEGIN
int _whereParamCounter = 0;
for (String _whereParamItem : _contentValues.whereArgs()) {
Logger.info("==> param%s: '%s'", (_whereParamCounter++), StringUtils.checkSize(_whereParamItem));
}
// log for where parameters -- END
}
// log section END
int result = KriptonDatabaseWrapper.updateDelete(deletePreparedStatement6, _contentValues);
return result;
}
use of com.abubusoft.kripton.android.sqlite.KriptonContentValues in project kripton by xcesco.
the class EmployeeBeanDaoImpl method deleteJQL.
/**
* <h2>SQL delete:</h2>
* <pre>DELETE FROM employees WHERE id=${bean.id} and field_byte=${bean.fieldByte} and field_character=${bean.fieldCharacter} and field_short=${bean.fieldShort} and field_integer=${bean.fieldInteger} and field_long=${bean.fieldLong} and field_float=${bean.fieldFloat} and field_double=${bean.fieldDouble} and field_string=${bean.fieldString} and field_byte_array=${bean.fieldByteArray}</pre>
*
* <h2>Parameters used in where conditions:</h2>
* <dl>
* <dt>${bean.id}</dt><dd>is mapped to method's parameter <strong>bean.id</strong></dd>
* <dt>${bean.fieldByte}</dt><dd>is mapped to method's parameter <strong>bean.fieldByte</strong></dd>
* <dt>${bean.fieldCharacter}</dt><dd>is mapped to method's parameter <strong>bean.fieldCharacter</strong></dd>
* <dt>${bean.fieldShort}</dt><dd>is mapped to method's parameter <strong>bean.fieldShort</strong></dd>
* <dt>${bean.fieldInteger}</dt><dd>is mapped to method's parameter <strong>bean.fieldInteger</strong></dd>
* <dt>${bean.fieldLong}</dt><dd>is mapped to method's parameter <strong>bean.fieldLong</strong></dd>
* <dt>${bean.fieldFloat}</dt><dd>is mapped to method's parameter <strong>bean.fieldFloat</strong></dd>
* <dt>${bean.fieldDouble}</dt><dd>is mapped to method's parameter <strong>bean.fieldDouble</strong></dd>
* <dt>${bean.fieldString}</dt><dd>is mapped to method's parameter <strong>bean.fieldString</strong></dd>
* <dt>${bean.fieldByteArray}</dt><dd>is mapped to method's parameter <strong>bean.fieldByteArray</strong></dd>
* </dl>
*
* @param bean
* is used as ${bean}
*
* @return number of deleted records
*/
@Override
public long deleteJQL(Employee bean) {
if (deleteJQLPreparedStatement7 == null) {
// generate static SQL for statement
String _sql = "DELETE FROM employees WHERE id=? and field_byte=? and field_character=? and field_short=? and field_integer=? and field_long=? and field_float=? and field_double=? and field_string=? and field_byte_array=?";
deleteJQLPreparedStatement7 = KriptonDatabaseWrapper.compile(_context, _sql);
}
KriptonContentValues _contentValues = contentValuesForUpdate(deleteJQLPreparedStatement7);
_contentValues.addWhereArgs(String.valueOf(bean.id));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterByte.class, bean.fieldByte));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterChar.class, bean.fieldCharacter));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterShort.class, bean.fieldShort));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterInteger.class, bean.fieldInteger));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterLong.class, bean.fieldLong));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterFloat.class, bean.fieldFloat));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterDouble.class, bean.fieldDouble));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterString.class, bean.fieldString));
_contentValues.addWhereArgs(SQLTypeAdapterUtils.toString(TypeAdapterByteArray.class, bean.fieldByteArray));
// log section BEGIN
if (_context.isLogEnabled()) {
// display log
Logger.info("DELETE FROM employees WHERE id=? and field_byte=? and field_character=? and field_short=? and field_integer=? and field_long=? and field_float=? and field_double=? and field_string=? and field_byte_array=?");
// log for where parameters -- BEGIN
int _whereParamCounter = 0;
for (String _whereParamItem : _contentValues.whereArgs()) {
Logger.info("==> param%s: '%s'", (_whereParamCounter++), StringUtils.checkSize(_whereParamItem));
}
// log for where parameters -- END
}
// log section END
int result = KriptonDatabaseWrapper.updateDelete(deleteJQLPreparedStatement7, _contentValues);
return result;
}
use of com.abubusoft.kripton.android.sqlite.KriptonContentValues in project kripton by xcesco.
the class EmployeeBeanDaoImpl method deleteById.
/**
* <h2>SQL delete:</h2>
* <pre>DELETE FROM employees WHERE id=${bean.id}</pre>
*
* <h2>Parameters used in where conditions:</h2>
* <dl>
* <dt>${bean.id}</dt><dd>is mapped to method's parameter <strong>bean.id</strong></dd>
* </dl>
*
* @param bean
* is used as ${bean}
*
* @return number of deleted records
*/
@Override
public long deleteById(Employee bean) {
if (deleteByIdPreparedStatement8 == null) {
// generate static SQL for statement
String _sql = "DELETE FROM employees WHERE id=?";
deleteByIdPreparedStatement8 = KriptonDatabaseWrapper.compile(_context, _sql);
}
KriptonContentValues _contentValues = contentValuesForUpdate(deleteByIdPreparedStatement8);
_contentValues.addWhereArgs(String.valueOf(bean.id));
// log section BEGIN
if (_context.isLogEnabled()) {
// display log
Logger.info("DELETE FROM employees WHERE id=?");
// log for where parameters -- BEGIN
int _whereParamCounter = 0;
for (String _whereParamItem : _contentValues.whereArgs()) {
Logger.info("==> param%s: '%s'", (_whereParamCounter++), StringUtils.checkSize(_whereParamItem));
}
// log for where parameters -- END
}
// log section END
int result = KriptonDatabaseWrapper.updateDelete(deleteByIdPreparedStatement8, _contentValues);
return result;
}
Aggregations