#include "TestLib.h"
int dpiTest_1500_releaseEnqOptionsTwice(dpiTestCase *testCase,
dpiTestParams *params)
{
dpiEnqOptions *enqOptions;
dpiConn *conn;
if (dpiTestCase_getConnection(testCase, &conn) < 0)
return DPI_FAILURE;
if (dpiConn_newEnqOptions(conn, &enqOptions) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiEnqOptions_release(enqOptions) < 0)
return dpiTestCase_setFailedFromError(testCase);
dpiEnqOptions_release(enqOptions);
return dpiTestCase_expectError(testCase, "DPI-1002:");
}
int dpiTest_1501_verifyPubFuncsOfEnqOptWithNULL(dpiTestCase *testCase,
dpiTestParams *params)
{
const char *expectedError = "DPI-1002:";
dpiVisibility visibility;
uint32_t valueLength;
const char *value;
dpiConn *conn;
if (dpiTestCase_getConnection(testCase, &conn) < 0)
return DPI_FAILURE;
dpiEnqOptions_addRef(NULL);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_getTransformation(NULL, &value, &valueLength);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_getVisibility(NULL, &visibility);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_release(NULL);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_setDeliveryMode(NULL, DPI_MODE_MSG_PERSISTENT);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_setTransformation(NULL, NULL, 0);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiEnqOptions_setVisibility(NULL, DPI_VISIBILITY_IMMEDIATE);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
return DPI_SUCCESS;
}
int dpiTest_1502_verifyVisIsSetAsExp(dpiTestCase *testCase,
dpiTestParams *params)
{
dpiVisibility visModes[] = {DPI_VISIBILITY_ON_COMMIT,
DPI_VISIBILITY_IMMEDIATE, -1}, getValue;
dpiEnqOptions *enqOptions;
dpiConn *conn;
int i;
if (dpiTestCase_getConnection(testCase, &conn) < 0)
return DPI_FAILURE;
if (dpiConn_newEnqOptions(conn, &enqOptions) < 0)
return dpiTestCase_setFailedFromError(testCase);
for (i = 0; visModes[i] != -1; i++) {
if (dpiEnqOptions_setVisibility(enqOptions, visModes[i]) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiEnqOptions_getVisibility(enqOptions, &getValue) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiTestCase_expectIntEqual(testCase, getValue, visModes[i]) < 0)
return DPI_FAILURE;
}
if (dpiEnqOptions_release(enqOptions) < 0)
return dpiTestCase_setFailedFromError(testCase);
return DPI_SUCCESS;
}
int main(int argc, char **argv)
{
dpiTestSuite_initialize(1500);
dpiTestSuite_addCase(dpiTest_1500_releaseEnqOptionsTwice,
"call dpiEnqOptions_release() twice");
dpiTestSuite_addCase(dpiTest_1501_verifyPubFuncsOfEnqOptWithNULL,
"call all dpiEnqOptions functions with options param as NULL");
dpiTestSuite_addCase(dpiTest_1502_verifyVisIsSetAsExp,
"verify visibility is set as expected");
return dpiTestSuite_run();
}