Convenience class to help composing insert and update statements. More...
Public Member Functions | |
| void | clear () |
| Clear the list. | |
| void | insert (String aKey, Mixed aValue) |
| Insert a key/value pair. | |
| Number | remove (String aKey) |
| Removes the value with the given key. | |
| SqlValues () | |
| Default constructor. | |
| String | toString () const |
| Mixed | value (String aName) |
| Get the named columns value. | |
Properties | |
| String | columns |
| The column names as comma separated list. | |
| Boolean | isEmpty |
| True if there are no columns. | |
| Array | keys |
| List of the keys. | |
| Object | object |
| The internal object holding the values. | |
| String | pairs |
| Pairs of column=placeholder as comma separated list. | |
| String | tags |
| The value placeholders as comma separated list. | |
| Array | values |
| List of the values. | |
Convenience class to help composing insert and update statements.
var q = new bps.Query(ds); // insert example var key = ds.nextKey('departments'); var vals = new bps.SqlValues; vals.insert('c_key', key); vals.insert('c_id', '0003'); vals.insert('c_name', 'Fruit and vegetables'); q.prepare( String("insert into t_departments (%1) values (%2)").arg(vals.columns).arg(vals.tags) ); q.execute(vals.values); // update example rec.insert('c_id', 'F02'); rec.insert('c_name', 'Fruit, vegetables and flowers'); q.prepare( String("update t_departments set %1 where c_key=?").arg(vals.pairs) ); q.execute(vals.values.concat(key));
| void bps::SqlValues::insert | ( | String | aKey, |
| Mixed | aValue | ||
| ) |
Insert a key/value pair.
| [in] | aKey | The key to insert |
| [in] | aValue | The value to insert |
| Number bps::SqlValues::remove | ( | String | aKey | ) |
Removes the value with the given key.
| [in] | aKey | The key of the pair to remove. |
| String bps::SqlValues::toString | ( | ) | const |
| Mixed bps::SqlValues::value | ( | String | aName | ) |
Get the named columns value.
| [in] | aName | Name of the column to get the value for. |