0
1
Fork 0
hedera-web-mindshore/js/db/db-lot.js

110 lines
1.9 KiB
JavaScript

var Connection = require('./connection');
var Model = require('./model');
module.exports = new Class({
Extends: Vn.Form
,Tag: 'db-lot'
,Properties: {
/**
* The connection used to execute the statement.
*/
conn: {
type: Connection
,set(x) {
this.model.conn = x;
}
,get() {
return this.model.conn;
}
},
/**
* The model query.
*/
query: {
type: String
,set(x) {
this.model.query = x;
}
,get() {
return this.model.query;
}
},
/**
* The model select statement.
*/
stmt: {
type: Sql.Stmt
,set(x) {
this.model.stmt = x;
}
,get() {
return this.model.stmt;
}
},
/**
* The lot used to execute the statement.
*/
lot: {
type: Vn.Lot
,set(x) {
this.model.lot = x;
}
,get() {
return this.model.lot;
}
}
}
,initialize(props) {
this.model = new Model();
Vn.Form.prototype.initialize.call(this, props);
}
,appendChild(child) {
if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent;
}
,refresh() {
if (this._model)
this._model.refresh();
}
,performOperations() {
if (this._model)
this._model.performOperations();
}
/**
* Get the index of the column from its name.
*
* @param {string} columnName The column name
* @return {integer} The column index or -1 if column not exists
*/
,getColumnIndex(columnName) {
return this._model ?
this._model.getColumnIndex(columnName) : -1;
}
/**
* Gets a value from the form using the column index.
*
* @param {string} columnName The column index
* @return {Object} The value
*/
,getByIndex(column) {
return this._model.getByIndex(this._row, column);
}
/**
* Sets a value on the form using the column index.
*
* @param {string} columnName The column index
* @param {Object} value The new value
*/
,setByIndex(column, value) {
return this._model.setByIndex(this._row, column, value);
}
});