//----------------------------------------------------------------------------//
// This unit was automatically generated by the RemObjects SDK after reading  //
// the RODL file associated with this project .                               //
//                                                                            //
// Do not modify this unit manually, or your changes will be lost when this   //
// unit is regenerated the next time you compile the project.                 //
//----------------------------------------------------------------------------//


/* This codegen depends on RemObjectsSDK.js
* Usage:
* var Channel = new RemObjects.SDK.HTTPClientChannel("http://localhost:8099/JSON");
* var Message = new RemObjects.SDK.JSONMessage();
* var Service = new NewService(Channel, Message);
* Service.Sum(1, 2,
*             function(result) {
*                 alert(result);
*             },
*             function(msg) {alert(msg.getErrorMessage())}
* );
*
*/

__namespace = this;
if ("RemObjects.DataAbstract.Server" != "") {
	var parts = "RemObjects.DataAbstract.Server".split(".");
	var current = this;
    for (var i = 0; i < parts.length; i++) {
		current[parts[i]] = current[parts[i]] || {};
		current = current[parts[i]];
    };
	__namespace = current;
};

// Enum: ColumnSortDirection
__namespace.ColumnSortDirection = function ColumnSortDirection() {
  this.value = null;
};
__namespace.ColumnSortDirection.prototype = new RemObjects.SDK.ROEnumType();
__namespace.ColumnSortDirection.prototype.enumValues = [
    "Ascending",
    "Descending"
	];
__namespace.ColumnSortDirection.prototype.constructor = __namespace.ColumnSortDirection;
RemObjects.SDK.RTTI["ColumnSortDirection"] = __namespace.ColumnSortDirection;

// Enum: ScriptExceptionType
__namespace.ScriptExceptionType = function ScriptExceptionType() {
  this.value = null;
};
__namespace.ScriptExceptionType.prototype = new RemObjects.SDK.ROEnumType();
__namespace.ScriptExceptionType.prototype.enumValues = [
    "ParserError",
    "RuntimeError",
    "Fail",
    "UnexpectedException"
	];
__namespace.ScriptExceptionType.prototype.constructor = __namespace.ScriptExceptionType;
RemObjects.SDK.RTTI["ScriptExceptionType"] = __namespace.ScriptExceptionType;


// Struct: DataParameter
__namespace.DataParameter = function DataParameter() {
    this.Name = {dataType : "Utf8String", value : null};
    this.Value = {dataType : "Variant", value : null};
};
__namespace.DataParameter.prototype = new RemObjects.SDK.ROStructType();
__namespace.DataParameter.prototype.constructor = __namespace.DataParameter;
RemObjects.SDK.RTTI["DataParameter"] = __namespace.DataParameter;

// Struct: TableRequestInfo
__namespace.TableRequestInfo = function TableRequestInfo() {
    this.IncludeSchema = {dataType : "Boolean", value : null};
    this.MaxRecords = {dataType : "Integer", value : null};
    this.Parameters = {dataType : "DataParameterArray", value : null};
    this.UserFilter = {dataType : "Utf8String", value : null};
};
__namespace.TableRequestInfo.prototype = new RemObjects.SDK.ROStructType();
__namespace.TableRequestInfo.prototype.constructor = __namespace.TableRequestInfo;
RemObjects.SDK.RTTI["TableRequestInfo"] = __namespace.TableRequestInfo;

// Struct: TableRequestInfoV6
__namespace.TableRequestInfoV6 = function TableRequestInfoV6() {
    this.IncludeSchema = {dataType : "Boolean", value : null};
    this.MaxRecords = {dataType : "Integer", value : null};
    this.Parameters = {dataType : "DataParameterArray", value : null};
    this.Sql = {dataType : "WideString", value : null};
    this.UserFilter = {dataType : "Utf8String", value : null};
};
__namespace.TableRequestInfoV6.prototype = new RemObjects.SDK.ROStructType();
__namespace.TableRequestInfoV6.prototype.constructor = __namespace.TableRequestInfoV6;
RemObjects.SDK.RTTI["TableRequestInfoV6"] = __namespace.TableRequestInfoV6;

// Struct: TableRequestInfoV5
__namespace.TableRequestInfoV5 = function TableRequestInfoV5() {
    this.DynamicSelectFieldNames = {dataType : "StringArray", value : null};
    this.IncludeSchema = {dataType : "Boolean", value : null};
    this.MaxRecords = {dataType : "Integer", value : null};
    this.Parameters = {dataType : "DataParameterArray", value : null};
    this.Sorting = {dataType : "ColumnSorting", value : null};
    this.UserFilter = {dataType : "Utf8String", value : null};
    this.WhereClause = {dataType : "Xml", value : null};
};
__namespace.TableRequestInfoV5.prototype = new RemObjects.SDK.ROStructType();
__namespace.TableRequestInfoV5.prototype.constructor = __namespace.TableRequestInfoV5;
RemObjects.SDK.RTTI["TableRequestInfoV5"] = __namespace.TableRequestInfoV5;

// Struct: UserInfo
__namespace.UserInfo = function UserInfo() {
    this.Attributes = {dataType : "VariantArray", value : null};
    this.Privileges = {dataType : "StringArray", value : null};
    this.SessionID = {dataType : "Utf8String", value : null};
    this.UserData = {dataType : "Binary", value : null};
    this.UserID = {dataType : "Utf8String", value : null};
};
__namespace.UserInfo.prototype = new RemObjects.SDK.ROStructType();
__namespace.UserInfo.prototype.constructor = __namespace.UserInfo;
RemObjects.SDK.RTTI["UserInfo"] = __namespace.UserInfo;

// Struct: ColumnSorting
__namespace.ColumnSorting = function ColumnSorting() {
    this.FieldName = {dataType : "Utf8String", value : null};
    this.SortDirection = {dataType : "ColumnSortDirection", value : null};
};
__namespace.ColumnSorting.prototype = new RemObjects.SDK.ROStructType();
__namespace.ColumnSorting.prototype.constructor = __namespace.ColumnSorting;
RemObjects.SDK.RTTI["ColumnSorting"] = __namespace.ColumnSorting;


// Array: ColumnSortingArray
__namespace.ColumnSortingArray = function ColumnSortingArray() {
  RemObjects.SDK.ROArrayType.call(this);
  this.elementType = "ColumnSorting";
};
__namespace.ColumnSortingArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.ColumnSortingArray.prototype.constructor = __namespace.ColumnSortingArray;
RemObjects.SDK.RTTI["ColumnSortingArray"] = __namespace.ColumnSortingArray;

// Array: DataParameterArray
__namespace.DataParameterArray = function DataParameterArray() {
  RemObjects.SDK.ROArrayType.call(this);
  this.elementType = "DataParameter";
};
__namespace.DataParameterArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.DataParameterArray.prototype.constructor = __namespace.DataParameterArray;
RemObjects.SDK.RTTI["DataParameterArray"] = __namespace.DataParameterArray;

// Array: StringArray
__namespace.StringArray = function StringArray() {
  RemObjects.SDK.ROArrayType.call(this);
  this.elementType = "Utf8String";
};
__namespace.StringArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.StringArray.prototype.constructor = __namespace.StringArray;
RemObjects.SDK.RTTI["StringArray"] = __namespace.StringArray;

// Array: TableRequestInfoArray
__namespace.TableRequestInfoArray = function TableRequestInfoArray() {
  RemObjects.SDK.ROArrayType.call(this);
  this.elementType = "TableRequestInfo";
};
__namespace.TableRequestInfoArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.TableRequestInfoArray.prototype.constructor = __namespace.TableRequestInfoArray;
RemObjects.SDK.RTTI["TableRequestInfoArray"] = __namespace.TableRequestInfoArray;

// Array: VariantArray
__namespace.VariantArray = function VariantArray() {
  RemObjects.SDK.ROArrayType.call(this);
  this.elementType = "Variant";
};
__namespace.VariantArray.prototype = new RemObjects.SDK.ROArrayType();
__namespace.VariantArray.prototype.constructor = __namespace.VariantArray;
RemObjects.SDK.RTTI["VariantArray"] = __namespace.VariantArray;


// Exception: ScriptException
__namespace.ScriptException = function ScriptException(e) {
    RemObjects.SDK.ROException.call(this, e);
    this.fields.Line  = {dataType : "Integer", value : null};
    this.fields.Column  = {dataType : "Integer", value : null};
    this.fields.Event  = {dataType : "Utf8String", value : null};
    this.fields.InnerStackTrace  = {dataType : "Utf8String", value : null};
    this.fields.Type  = {dataType : "ScriptExceptionType", value : null};
};
__namespace.ScriptException.prototype = new RemObjects.SDK.ROException();
RemObjects.SDK.RTTI["ScriptException"] = __namespace.ScriptException;



// Service: DataAbstractService
__namespace.DataAbstractService = function DataAbstractService(__channel, __message, __service_name) {
  RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
  this.fServiceName = this.fServiceName || __service_name || "DataAbstractService";
};


__namespace.DataAbstractService.prototype.GetSchema = function(
	aFilter,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetSchema");
        msg.write("aFilter", "Utf8String", aFilter);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Utf8String");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.GetData = function(
	aTableNameArray,
	aTableRequestInfoArray,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetData");
        msg.write("aTableNameArray", "StringArray", aTableNameArray);
        msg.write("aTableRequestInfoArray", "TableRequestInfoArray", aTableRequestInfoArray);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Binary");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.UpdateData = function(
	aDelta,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "UpdateData");
        msg.write("aDelta", "Binary", aDelta);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Binary");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.ExecuteCommand = function(
	aCommandName,
	aParameterArray,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "ExecuteCommand");
        msg.write("aCommandName", "Utf8String", aCommandName);
        msg.write("aParameterArray", "DataParameterArray", aParameterArray);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Integer");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.ExecuteCommandEx = function(
	aCommandName,
	aInputParameters,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "ExecuteCommandEx");
        msg.write("aCommandName", "Utf8String", aCommandName);
        msg.write("aInputParameters", "DataParameterArray", aInputParameters);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Integer");
		var __aOutputParameters = __message.read("aOutputParameters", "DataParameterArray");
	        __success(
		__result
		,
		__aOutputParameters
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.GetTableSchema = function(
	aTableNameArray,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetTableSchema");
        msg.write("aTableNameArray", "StringArray", aTableNameArray);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Utf8String");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.GetCommandSchema = function(
	aCommandNameArray,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetCommandSchema");
        msg.write("aCommandNameArray", "StringArray", aCommandNameArray);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Utf8String");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.SQLGetData = function(
	aSQLText,
	aIncludeSchema,
	aMaxRecords,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "SQLGetData");
        msg.write("aSQLText", "Utf8String", aSQLText);
        msg.write("aIncludeSchema", "Boolean", aIncludeSchema);
        msg.write("aMaxRecords", "Integer", aMaxRecords);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Binary");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.SQLGetDataEx = function(
	aSQLText,
	aIncludeSchema,
	aMaxRecords,
	aDynamicWhereXML,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "SQLGetDataEx");
        msg.write("aSQLText", "Utf8String", aSQLText);
        msg.write("aIncludeSchema", "Boolean", aIncludeSchema);
        msg.write("aMaxRecords", "Integer", aMaxRecords);
        msg.write("aDynamicWhereXML", "WideString", aDynamicWhereXML);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Binary");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.SQLExecuteCommand = function(
	aSQLText,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "SQLExecuteCommand");
        msg.write("aSQLText", "Utf8String", aSQLText);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Integer");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.SQLExecuteCommandEx = function(
	aSQLText,
	aDynamicWhereXML,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "SQLExecuteCommandEx");
        msg.write("aSQLText", "Utf8String", aSQLText);
        msg.write("aDynamicWhereXML", "WideString", aDynamicWhereXML);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Integer");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.GetDatasetScripts = function(
	DatasetNames,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetDatasetScripts");
        msg.write("DatasetNames", "Utf8String", DatasetNames);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Utf8String");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.RegisterForDataChangeNotification = function(
	aTableName,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "RegisterForDataChangeNotification");
        msg.write("aTableName", "Utf8String", aTableName);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
	        __success(
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.DataAbstractService.prototype.UnregisterForDataChangeNotification = function(
	aTableName,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "UnregisterForDataChangeNotification");
        msg.write("aTableName", "Utf8String", aTableName);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
	        __success(
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};


// Service: BaseLoginService
__namespace.BaseLoginService = function BaseLoginService(__channel, __message, __service_name) {
  RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
  this.fServiceName = this.fServiceName || __service_name || "BaseLoginService";
};


__namespace.BaseLoginService.prototype.LoginEx = function(
	aLoginString,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "LoginEx");
        msg.write("aLoginString", "Utf8String", aLoginString);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Boolean");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.BaseLoginService.prototype.Logout = function(
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "Logout");
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
	        __success(
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};


// Service: MultiDbLoginService
__namespace.MultiDbLoginService = function MultiDbLoginService(__channel, __message, __service_name) {
  RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
  this.fServiceName = this.fServiceName || __service_name || "MultiDbLoginService";
};

__namespace.MultiDbLoginService.prototype = new __namespace.BaseLoginService();

__namespace.MultiDbLoginService.prototype.Login = function(
	aUserID,
	aPassword,
	aConnectionName,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "Login");
        msg.write("aUserID", "Utf8String", aUserID);
        msg.write("aPassword", "Utf8String", aPassword);
        msg.write("aConnectionName", "Utf8String", aConnectionName);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Boolean");
		var __aUserInfo = __message.read("aUserInfo", "UserInfo");
	        __success(
		__result
		,
		__aUserInfo
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};


// Service: MultiDbLoginServiceV5
__namespace.MultiDbLoginServiceV5 = function MultiDbLoginServiceV5(__channel, __message, __service_name) {
  RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
  this.fServiceName = this.fServiceName || __service_name || "MultiDbLoginServiceV5";
};

__namespace.MultiDbLoginServiceV5.prototype = new __namespace.MultiDbLoginService();

__namespace.MultiDbLoginServiceV5.prototype.GetConnectionNames = function(
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetConnectionNames");
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "StringArray");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};

__namespace.MultiDbLoginServiceV5.prototype.GetDefaultConnectionName = function(
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "GetDefaultConnectionName");
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Utf8String");
	        __success(
		__result
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};


// Service: SimpleLoginService
__namespace.SimpleLoginService = function SimpleLoginService(__channel, __message, __service_name) {
  RemObjects.SDK.ROService.call(this, __channel, __message, __service_name);
  this.fServiceName = this.fServiceName || __service_name || "SimpleLoginService";
};

__namespace.SimpleLoginService.prototype = new __namespace.BaseLoginService();

__namespace.SimpleLoginService.prototype.Login = function(
	aUserID,
	aPassword,
	__success, __error) {
    try {
        var msg = this.fMessage.clone();
        msg.initialize(this.fServiceName, "Login");
        msg.write("aUserID", "Utf8String", aUserID);
        msg.write("aPassword", "Utf8String", aPassword);
        msg.finalize();
        this.fChannel.dispatch(msg, function (__message) {
		var __result = __message.read("Result", "Boolean");
		var __aUserInfo = __message.read("aUserInfo", "UserInfo");
	        __success(
		__result
		,
		__aUserInfo
		);
        }, __error);

    } catch (e) {
        __error(msg, e);
    };
};



// Event sink: DataChangeNotification
__namespace.DataChangeNotification = function DataChangeNotification() {
	this.OnDataTableChanged = {
		aTableName : {dataType : "Utf8String", value : null},
		aDelta : {dataType : "Binary", value : null}
	};
};
__namespace.DataChangeNotification.prototype = new RemObjects.SDK.ROEventSink();
__namespace.DataChangeNotification.prototype.constructor = __namespace.DataChangeNotification;
RemObjects.SDK.RTTI["DataChangeNotification"] = __namespace.DataChangeNotification;

