Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass in describe only #258

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/authentication/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ exports.authenticationTypes = authenticationTypes;
* @param {String} username
* @param {String} clientName
* @param {String} clientVersion
* @param clientApplication
* @param {Object} clientEnv
*
* @returns {JSON}
Expand Down Expand Up @@ -54,7 +55,8 @@ exports.formAuthJSON = function formAuthJSON(
{
OS: clientEnv.OS,
OS_VERSION: clientEnv.OS_VERSION,
OCSP_MODE: clientEnv.OCSP_MODE
OCSP_MODE: clientEnv.OCSP_MODE,
APPLICATION: clientApplication,
}
}
};
Expand Down
19 changes: 19 additions & 0 deletions lib/connection/statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ function createContextPreExec(
ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_INTERNAL);
}

// if a describeOnly option is specified, make sure it's boolean
if (Util.exists(statementOptions.describeOnly))
{
Errors.checkArgumentValid(Util.isBoolean(statementOptions.describeOnly),
ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_OPTIONS);
}

// create a statement context
var statementContext = createStatementContext();

Expand All @@ -325,6 +332,12 @@ function createContextPreExec(
statementContext.internal = statementOptions.internal;
}

// if the describeOnly flag is specified, add it to the statement context
if(Util.exists(statementOptions.describeOnly))
{
statementContext.describeOnly = statementOptions.describeOnly;
}

// validate non-user-specified arguments
Errors.assertInternal(Util.isObject(services));
Errors.assertInternal(Util.isObject(connectionConfig));
Expand Down Expand Up @@ -1121,6 +1134,12 @@ function sendRequestPreExec(statementContext, onResultAvailable)
json.isInternal = statementContext.internal;
}

// include statement parameters if a value was specified
if (Util.exists(statementContext.describeOnly))
{
json.describeOnly = statementContext.describeOnly;
}

// use the snowflake service to issue the request
sendSfRequest(statementContext,
{
Expand Down
2 changes: 1 addition & 1 deletion lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function Core(options)
{
// check that the specified value is a valid tag
Errors.checkArgumentValid(LoggerCore.isValidLogTag(logTag),
ErrorCodes.ERR_GLOGAL_CONFIGURE_INVALID_LOG_LEVEL);
ErrorCodes.ERR_GLOBAL_CONFIGURE_INVALID_LOG_LEVEL);

Logger.getInstance().configure(
{
Expand Down
16 changes: 8 additions & 8 deletions lib/services/sf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1082,17 +1082,17 @@ StateConnecting.prototype.continue = function ()
CLIENT_APP_NAME: this.connectionConfig.getClientApplication()
};

// if we have some information about the client environment, add it as well
var clientEnvironment = this.connectionConfig.getClientEnvironment();
if (Util.isObject(clientEnvironment))
{
// If we have some information about the client environment, add it as well
var clientEnvironment = this.connectionConfig.getClientEnvironment() || {};
var clientApplication = this.connectionConfig.getClientApplication();
if (Util.isString(clientApplication)) {
clientEnvironment["APPLICATION"] = clientApplication;
}
if (Object.keys(clientEnvironment).length > 0) {
clientInfo.CLIENT_ENVIRONMENT = clientEnvironment;
}

var sessionParameters =
{
SESSION_PARAMETERS: {}
};
var sessionParameters = { SESSION_PARAMETERS: {} };

if (Util.exists(this.connectionConfig.getClientSessionKeepAlive()))
{
Expand Down