Methods
addBindVariable(bindVar) → {Select2Object}
- Description:
If bind variables are used in SELECT statement, this are added here. Ordering is important. The first one added will be '?1' in the select, second is '?2' in select...
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
bindVar |
any |
Returns:
- Type
- Select2Object
addTableData(tableName, data) → {Select2Object}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
tableName |
String | table name referenced in SELECT statement. |
data |
* | double array or string. If string it must reference A1 notation, named range or sheet name. |
Returns:
- Type
- Select2Object
execute(statement) → {Array.<Object>}
- Description:
Query any sheet range using standard SQL SELECT syntax and return array of table info with column names as properties.
- Source:
Example
gsSQL("select * from expenses where type = ?1")
Parameters:
| Name | Type | Description |
|---|---|---|
statement |
String | SQL string |
Returns:
- array of object data.
- Type
- Array.<Object>
selectToClass(className) → {Select2Object}
- Description:
When creating the object to be returned, rather than assign from an empty object '{}', a new instance of this class is created instead.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
className |
Object |
Returns:
- Type
- Select2Object
(static) cleanupColumnNames(cols) → {Array.<String>}
- Description:
Return column names in lower case and remove table name when only one table.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cols |
Array.<String> |
Returns:
- Type
- Array.<String>
(static) convertColumnTitleToPropertyName(columnTitles) → {Array.<String>}
- Description:
Convert a sheet column name into format used for property name (spaces to underscore && lowercase)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
columnTitles |
Array.<String> |
Returns:
- Type
- Array.<String>
(static) convertObjectArrayToTableArray(objectArray, columnTitles, outputTitleRow) → {Array.<Array.<any>>}
- Source:
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
objectArray |
Array.<Object> | ||
columnTitles |
Array.<String> | ||
outputTitleRow |
Boolean |
true
|
Returns:
- Type
- Array.<Array.<any>>
(static) convertObjectToArray(object, columnTitles) → {Array.<String>}
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
object |
Object | |
columnTitles |
Array.<String> |
Returns:
- Type
- Array.<String>
(static) convertTableArrayToObjectArray(tableDataArray) → {Array.<Object>}
- Description:
First row MUST be column names.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
tableDataArray |
Array.<Array.<any>> |
Returns:
- Type
- Array.<Object>
(static) createEmptyRecordObject(columnNames) → {Object}
- Description:
Creates an empty object where each column name is a property in the object.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
columnNames |
Array.<String> |
Returns:
- Type
- Object
(static) createTableObjectArray(columnNames, tableDataArray, SelectClass) → {Array.<Object>}
- Source:
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
columnNames |
Array.<String> | ||
tableDataArray |
Array.<any> | ||
SelectClass |
Object |
null
|
Returns:
- Type
- Array.<Object>
(static) getColumnNumber(object, columnTitle) → {Number}
- Description:
Get column number - starting at 1 in object.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
object |
Object | |
columnTitle |
String |
Returns:
- Type
- Number