AppRecord GetSchemaColumns() Method

Returns a Vector of SchemaColumn objects. Will not include fields for VarRecord or ProjectBasedRecord objects.

Function Signature

 Vector GetSchemaColumns()

Parameters

Parameter Type Description

None

Return

Type Description

Vector

Each entry will be a SchemaColumn object representing a column in the database that this item can interact with.

For details, see SchemaColumn.

Technical Details

SBM ModScript version: 11.3.

Example

def getDBTypeNameText( type ) {
	switch( type ) {
		case(DBTypeConstants.BIGINT) {
			return "BigInteger";
		}
		case(DBTypeConstants.INTEGER) {
			return "Integer";
		}
		case(DBTypeConstants.SMALLINT) {
			return "SmallInteger";
		}
		case(DBTypeConstants.TINYINT) {
			return "TinyInteger";
		}
		case(DBTypeConstants.DOUBLE) {
			return "Double";
		}
		case(DBTypeConstants.FLOAT) {
			return "Float";
		}
		case(DBTypeConstants.DATETIME) {
			return "Datetime";
		}
		case(DBTypeConstants.DECIMAL) {
			return "Decimal";
		}
		case(DBTypeConstants.NUMERIC) {
			return "Numeric";
		}
		case(DBTypeConstants.CHAR) {
			return "Char";
		}
		case(DBTypeConstants.VARCHAR) {
			return "Varchar";
		}
		case(DBTypeConstants.LONGVARCHAR) {
			return "LongVarchar";
		}
		default {
			return "Unknown type: ${schema.type}";
		}
	}
}

var record = Ext.CreateAppRecord( Ext.TableId( "TS_USERS" ) );
for( schema : record.GetSchemaColumns() ){
	Ext.WriteStream( schema.name + " | " + 
    getDBTypeNameText( schema.type ) + " | " + 
    schema.length + "<br />");
}

Result:

TS_ID | Integer | 4
TS_LOGINID | Varchar | 64
TS_PASSWORD | Varchar | 258
TS_NAME | Varchar | 64
TS_TELEPHONE | Varchar | 64
...

Notes

None.

Related Topics

AppRecord

SchemaColumn