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

110 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-05-30 01:30:33 +00:00
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
2022-11-16 01:46:44 +00:00
,set(x) {
2022-05-30 01:30:33 +00:00
this.model.conn = x;
}
2022-11-16 01:46:44 +00:00
,get() {
2022-05-30 01:30:33 +00:00
return this.model.conn;
}
},
/**
* The model query.
*/
query: {
type: String
2022-11-16 01:46:44 +00:00
,set(x) {
2022-05-30 01:30:33 +00:00
this.model.query = x;
}
2022-11-16 01:46:44 +00:00
,get() {
2022-05-30 01:30:33 +00:00
return this.model.query;
}
},
/**
* The model select statement.
*/
stmt: {
type: Sql.Stmt
2022-11-16 01:46:44 +00:00
,set(x) {
2022-05-30 01:30:33 +00:00
this.model.stmt = x;
}
2022-11-16 01:46:44 +00:00
,get() {
2022-05-30 01:30:33 +00:00
return this.model.stmt;
}
},
/**
* The lot used to execute the statement.
*/
lot: {
type: Vn.Lot
2022-11-16 01:46:44 +00:00
,set(x) {
2022-05-30 01:30:33 +00:00
this.model.lot = x;
}
2022-11-16 01:46:44 +00:00
,get() {
2022-05-30 01:30:33 +00:00
return this.model.lot;
}
}
}
2022-11-16 01:46:44 +00:00
,initialize(props) {
2022-05-30 01:30:33 +00:00
this.model = new Model();
2022-06-06 16:02:17 +00:00
Vn.Form.prototype.initialize.call(this, props);
2022-05-30 01:30:33 +00:00
}
2022-11-16 01:46:44 +00:00
,appendChild(child) {
2022-05-30 01:30:33 +00:00
if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent;
}
2022-11-16 01:46:44 +00:00
,refresh() {
2022-05-30 01:30:33 +00:00
if (this._model)
this._model.refresh();
}
2022-11-16 01:46:44 +00:00
,performOperations() {
2022-05-30 01:30:33 +00:00
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
*/
2022-11-16 01:46:44 +00:00
,getColumnIndex(columnName) {
2022-05-30 01:30:33 +00:00
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
*/
2022-11-16 01:46:44 +00:00
,getByIndex(column) {
2022-05-30 01:30:33 +00:00
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
*/
2022-11-16 01:46:44 +00:00
,setByIndex(column, value) {
2022-05-30 01:30:33 +00:00
return this._model.setByIndex(this._row, column, value);
}
});