TROIKA.ASP - the MVC framework

Ado.js

Summary

Contains Ado class.

This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0. Please visit www.troika-asp.com for more details.



Version: $Revision: 1.3 $

Author: Pavel Chuchev pav@troika-asp.com


Class Summary
Ado This is Ado class - the base class for all DAO objects.

/**
* @fileoverview Contains <tt>Ado</tt> class.
*
* <p>
* This is part of Troika.ASP Framework - web development MVC framework for ASP 3.0.
* Please visit {@link http://www.troika-asp.com www.troika-asp.com} for more details.
* </p>
*
* @author Pavel Chuchev pav@troika-asp.com
* @version $Revision: 1.3 $
*/
/**
* Constructs a new instance of Ado class.
*
* @class This is <tt>Ado</tt> class - the base class for all DAO objects.
*
* @constructor
* @param {String} connectionString The database connection string.
*/
function Ado(connectionString) {

    if (arguments.length) {

        this.init(connectionString);
    }
}
/**
* Initializes <tt>Ado</tt>.
*
* @param {String} connectionString The database connection string.
* @return <tt>Ado</tt> object instance itself.
* @type Ado
*/
Ado.prototype.init = function (connectionString) {

    this.connectionString = connectionString;
    return this;
};

/**
* Opens and returns <tt>ADODB.Connection</tt> connection object.
*
* @return <tt>ADODB.Connection</tt> object.
* @type ADODB.Connection
*/
Ado.prototype.getConnection = function () {

    var result =  new ActiveXObject("ADODB.Connection");

    result.Mode = adModeReadWrite;
    result.Open(this.connectionString);

    return result;
};

/**
* Returns the name of the class represented by <tt>obj</tt> instance.
*
* @param {Object} obj The JavaScript object instance.
* @return The name of the class represented by <tt>obj</tt> instance.
* @type String
*/
Ado.prototype.getObjectName = function (obj) {

    if (obj && obj.constructor) {

        var matches = obj.constructor.toString().match(/function (\w*)/);
        return matches && matches.length > 0 ? matches[1] : undefined;
    }
};

TROIKA.ASP - the MVC framework

www.troika-asp.com
Documentation generated on Sun Jun 15 17:59:32 2008