@ac-moore-inc/mssql-wrapper 中文文档教程

发布于 6年前 浏览 17 项目主页 更新于 3年前

MSSQL Wrapper

一个易于使用的 MSSQL 包装器。

由 AC Moore 软件工程团队创建和维护。

Methods

prepareService

为提供的数据库创建连接池连接

prepareService(config, callback);

Parameters:

config: object

需要包含与数据库相关信息的配置对象。

config Example:
{
    databaseName: {
        'user': 'db_user_name',
        'password': 'db_pass',
        'server': 'PATH\\TOSERVER'
        'database': 'DATABASE_NAME'
        'pool': {
            'max': 10,
            'min': 4,
            'idleTimeoutMillis': 30000
        }
    },
    other db connections...
}

executePSQuery

执行准备好的语句

executePSQuery(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
qrydataobjecttrueobject containing query fields, fromobjects, and whereclause
serverstringfalsesever location of the database
inputarrayfalsearray of objects containing input name and type (as defined by mssql)
paramsobjectfalsekey value pairs defining any parameters, where key is the given input name and value is the parameter value

exeuteSP

执行存储过程

executeSP(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
procedurestringtrueprocedure name
inputarrayfalsearray of objects containing input name, type (as defined by mssql), and value (key: val)
outputarrayfalsearray of objects containing output name and type (as defined by mssql)

executeQuery

调用基本查询

executeQuery(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
qrydataarraytruearray of objects containing query: fields, fromobjects, joincondition, whereclause, groupby, order_by
serverstringfalsesever location of the database
outFormatarrayfalsearray of objects containing output name and type (as defined by mssql)

MSSQL Wrapper

An easy to use MSSQL wrapper.

Created and maintained by the A.C. Moore software engineering team.

Methods

prepareService

Create the connection pools for provided databases

prepareService(config, callback);

Parameters:

config: object

A configuration object containing information related to the database is required to connect.

config Example:
{
    databaseName: {
        'user': 'db_user_name',
        'password': 'db_pass',
        'server': 'PATH\\TOSERVER'
        'database': 'DATABASE_NAME'
        'pool': {
            'max': 10,
            'min': 4,
            'idleTimeoutMillis': 30000
        }
    },
    other db connections...
}

executePSQuery

Execute prepared statement

executePSQuery(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
qrydataobjecttrueobject containing query fields, fromobjects, and whereclause
serverstringfalsesever location of the database
inputarrayfalsearray of objects containing input name and type (as defined by mssql)
paramsobjectfalsekey value pairs defining any parameters, where key is the given input name and value is the parameter value

exeuteSP

Execute a stored procedure

executeSP(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
procedurestringtrueprocedure name
inputarrayfalsearray of objects containing input name, type (as defined by mssql), and value (key: val)
outputarrayfalsearray of objects containing output name and type (as defined by mssql)

executeQuery

call a basic query

executeQuery(options, callback);

Parameters:

options: Object
FieldTypeRequiredValue
dbstringtruedatabase name as defined in the config object used to prepare the service
qrydataarraytruearray of objects containing query: fields, fromobjects, joincondition, whereclause, groupby, order_by
serverstringfalsesever location of the database
outFormatarrayfalsearray of objects containing output name and type (as defined by mssql)

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文