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

CUBRID 10.2.0.0001 ODBC Driver #40

Merged
merged 28 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e0f4d3
[#7] modification of the README.txt and license.txt files for 10.1 re…
hornetmj Jul 17, 2017
d7ae47c
[RND-269] SQLDescribeCol() function should return SQL_LONGVARBINARY a…
hornetmj Jul 18, 2017
5247d20
in the UNICODE version of cubrid_odbc.dll, SQLDescribeCol() function …
hornetmj Jul 18, 2017
4582c19
[APIS-759] To prevent application crash caused by health_checker thre…
hornetmj Aug 21, 2017
6b71be6
[APIS-773] Modify/Remove broken link in README or Wiki at github/CUBR…
hornetmj Jul 10, 2018
f47051c
[APIS-776] fix SQLGetInfoW function standard(spec) violation (#14)
hornetmj Jan 10, 2019
6625d8a
[APIS-785] Change unicode.c encoding to UTF8 (from UTF16) (#15)
kisoo-han Mar 20, 2019
f243108
[APIS-788] sub-task [APIS-789] Upgrade build environment for Visual S…
beyondykk9 Jul 8, 2019
5fb6b15
[APIS-790] Invalid BufferLength in SQLGetDiagRecW(...) for wide char …
beyondykk9 Jul 8, 2019
22f413b
[APIS-791] SQLGetDiagRecW returns SQL State to S01000 for connection …
beyondykk9 Jul 8, 2019
ed9a517
Apis 792 (#20)
beyondykk9 Jul 9, 2019
895d3bc
[APIS-793] Increasing default column length for derived column (#21)
beyondykk9 Jul 9, 2019
2318e47
[APIS-796] Correct processing SQLCancel(...) (#24)
beyondykk9 Jul 9, 2019
b3864fb
[APIS-795] Correct processing multi-bye binding in update query (#23)
beyondykk9 Jul 9, 2019
7017bbc
[APIS-797] Processing to get the query-plan for any queries. (#25)
beyondykk9 Jul 9, 2019
74a8ec9
[APIS-794] Processing multi-byte (utf-8) column name (#22)
beyondykk9 Jul 9, 2019
10b9594
[APIS-798] Correct processing multi-byte for native query (SQLNativeS…
beyondykk9 Jul 10, 2019
7f632e4
[APIS-789] Upgrad build envrionment: compatibility for Legacy standar…
beyondykk9 Jul 15, 2019
0d618df
[APIS-799] Correct processing of string length for SUCCESS_WITH_INFO …
beyondykk9 Jul 15, 2019
8c273b8
[APIS-800] Correct processing for multi-byte to wide-char and vice-ve…
beyondykk9 Jul 26, 2019
57a4a27
[APIS-802] Adding Test Case for ODBC update version (#30)
beyondykk9 Oct 11, 2019
54b1cdb
[APIS-802] Adding Test Case for ODBC update version (CPP Case) (#31)
beyondykk9 Oct 18, 2019
3af9c45
APIS-802 revised... (#32)
beyondykk9 Oct 18, 2019
0eda4e6
[APIS 802] add unit test case for C++ (#33)
beyondykk9 Oct 21, 2019
ad55373
[APIS-802] add unit test case (#34)
beyondykk9 Oct 21, 2019
15134c0
[APIS-802] add test cases for C++ (source code encoding EUC-KR) (#36)
beyondykk9 Oct 21, 2019
c192bfb
Add to test-code for under version to 9.2.x. (#37)
swi0110 Oct 22, 2019
422276b
[APIS-803] Driver Release for 10.2 (#39)
beyondykk9 Dec 12, 2019
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
49 changes: 49 additions & 0 deletions UnitTest-CPP/UnitTest-CPP.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest-CPP", "UnitTest-CPP\UnitTest-CPP.vcxproj", "{FA19B10D-59A2-42F6-AD63-06C00122E9E6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cubrid_odbc", "..\cubrid_odbc_14.vcxproj", "{37E00A2E-BBC5-4736-90D9-A1B4271759BB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cubrid_odbc_unicode", "..\cubrid_odbc_unicode_14.vcxproj", "{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Debug|Win32.ActiveCfg = Debug|Win32
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Debug|Win32.Build.0 = Debug|Win32
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Debug|Win32.Deploy.0 = Debug|Win32
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Debug|x64.ActiveCfg = Debug|x64
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Debug|x64.Build.0 = Debug|x64
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Release|Win32.ActiveCfg = Release|Win32
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Release|Win32.Build.0 = Release|Win32
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Release|x64.ActiveCfg = Release|x64
{FA19B10D-59A2-42F6-AD63-06C00122E9E6}.Release|x64.Build.0 = Release|x64
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Debug|Win32.ActiveCfg = Debug|Win32
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Debug|Win32.Build.0 = Debug|Win32
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Debug|x64.ActiveCfg = Debug|x64
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Debug|x64.Build.0 = Debug|x64
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Release|Win32.ActiveCfg = Release|Win32
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Release|Win32.Build.0 = Release|Win32
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Release|x64.ActiveCfg = Release|x64
{37E00A2E-BBC5-4736-90D9-A1B4271759BB}.Release|x64.Build.0 = Release|x64
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Debug|Win32.ActiveCfg = Debug|Win32
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Debug|Win32.Build.0 = Debug|Win32
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Debug|x64.ActiveCfg = Debug|x64
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Debug|x64.Build.0 = Debug|x64
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Release|Win32.ActiveCfg = Release|Win32
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Release|Win32.Build.0 = Release|Win32
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Release|x64.ActiveCfg = Release|x64
{0092BD82-BCE8-4E10-A9DB-D083FC5C9D67}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
170 changes: 170 additions & 0 deletions UnitTest-CPP/UnitTest-CPP/UnitTest-CPP.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{FA19B10D-59A2-42F6-AD63-06C00122E9E6}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>UnitTestCPP</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="UnitTest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\cubrid-odbc.git\cubrid_odbc_14.vcxproj">
<Project>{37e00a2e-bbc5-4736-90d9-a1b4271759bb}</Project>
</ProjectReference>
<ProjectReference Include="..\..\cubrid_odbc_unicode_14.vcxproj">
<Project>{0092bd82-bce8-4e10-a9db-d083fc5c9d67}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
173 changes: 173 additions & 0 deletions UnitTest-CPP/UnitTest-CPP/UnitTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#include "stdafx.h"

#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <odbcss.h>

#define MAXBUFLEN 640
using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace UnitTestCPP
{
TEST_CLASS(UnitTest)
{
public:
TEST_METHOD(TestClassInit)
{
}

TEST_METHOD(QueryPlan)
{
RETCODE retcode;

SQLWCHAR query_plan[32768] = { 0, };

SQLHENV env;
SQLHDBC dbc;
SQLHSTMT hStmt = SQL_NULL_HSTMT;
SWORD plm_pcbErrorMsg = 0;
SQLINTEGER diag_rec;

SQLLEN len;

/* Allocate an environment handle */
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
/* We want ODBC 3 support */
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *)SQL_OV_ODBC3, 0);
/* Allocate a connection handle */
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);

//retcode = SQLDriverConnect(dbc, NULL, L"DSN=CUBRID Driver Unicode;DB_NAME=demodb;SERVER=test-db-server;PORT=33000;USER=dba;PWD=;CHARSET=utf-8;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);
retcode = SQLConnect(dbc, L"CUBRID Driver Unicode", SQL_NTS, L"dba", SQL_NTS, NULL, SQL_NTS);

if (retcode == SQL_ERROR) {
SQLGetDiagField(SQL_HANDLE_DBC, dbc, 0, SQL_DIAG_NUMBER, &diag_rec, 0, &plm_pcbErrorMsg);
}

Assert::AreNotEqual((int)retcode, SQL_ERROR);

// Allocate statement handle and execute a query
retcode = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &hStmt);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

retcode = SQLExecDirect(hStmt, L"SELECT name as \"user\", db_user, groups FROM db_user", SQL_NTS);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

retcode = SQLFetch(hStmt);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

// Get Query Plan
retcode = SQLGetData(hStmt, 1, SQL_C_DEFAULT, (SQLPOINTER)query_plan, 0, &len);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

if (retcode == SQL_SUCCESS_WITH_INFO) {
retcode = SQLGetData(hStmt, 1, SQL_C_DEFAULT, (SQLPOINTER)query_plan, len, &len);
}

Assert::AreNotEqual((int)retcode, SQL_ERROR);

if (strlen((const char *)query_plan) > 0) {
int c = strncmp((const char *)query_plan, (const char *)L"Join graph", 10);
Assert::AreEqual(c, 0);
}
else {
Assert::Fail(L"Query Plan is null");
}
// Clean up.
SQLDisconnect(dbc);
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
}

TEST_METHOD(QueryPlanMultiByte)
{
RETCODE retcode;

SQLWCHAR query_plan[32768] = { 0, };

SQLHENV env;
SQLHDBC dbc;
SQLHSTMT hStmt = SQL_NULL_HSTMT;
SWORD plm_pcbErrorMsg = 0;
SQLINTEGER diag_rec;

SQLLEN len;

/* Allocate an environment handle */
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
/* We want ODBC 3 support */
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *)SQL_OV_ODBC3, 0);
/* Allocate a connection handle */
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);

//retcode = SQLDriverConnect(dbc, NULL, L"DSN=CUBRID Driver Unicode;DB_NAME=demodb;SERVER=test-db-server;PORT=33000;USER=dba;PWD=;CHARSET=utf-8;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);
retcode = SQLConnect(dbc, L"CUBRID Driver Unicode", SQL_NTS, L"dba", SQL_NTS, NULL, SQL_NTS);

if (retcode == SQL_ERROR) {
SQLGetDiagField(SQL_HANDLE_DBC, dbc, 0, SQL_DIAG_NUMBER, &diag_rec, 0, &plm_pcbErrorMsg);
}

Assert::AreNotEqual((int)retcode, SQL_ERROR);

// Allocate statement handle and execute a query
retcode = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &hStmt);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

retcode = SQLExecDirect(hStmt, L"DROP TABLE IF EXISTS [���̺�] ", SQL_NTS);
Assert::AreNotEqual((int)retcode, SQL_ERROR);
retcode = SQLExecDirect(hStmt, L"CREATE TABLE [���̺�] ([�̸�] varchar(16), [����] integer)", SQL_NTS);
Assert::AreNotEqual((int)retcode, SQL_ERROR);
retcode = SQLExecDirect(hStmt, L"INSERT INTO [���̺�] VALUES ('ȫ�浿', 25)", SQL_NTS);
Assert::AreNotEqual((int)retcode, SQL_ERROR);
retcode = SQLExecDirect(hStmt, L"SELECT [�̸�], [����] FROM [���̺�] WHERE [����] > 19", SQL_NTS);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

retcode = SQLFetch(hStmt);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

//MessageBox(NULL, L"Contents", L"Title", MB_OK);

// Get Query Plan
retcode = SQLGetData(hStmt, 1, SQL_C_DEFAULT, (SQLPOINTER)query_plan, 0, &len);
Assert::AreNotEqual((int)retcode, SQL_ERROR);

if (retcode == SQL_SUCCESS_WITH_INFO) {
retcode = SQLGetData(hStmt, 1, SQL_C_DEFAULT, (SQLPOINTER)query_plan, len, &len);
}

Assert::AreNotEqual((int)retcode, SQL_ERROR);

if (strlen((const char *)query_plan) > 0) {
wchar_t expected_window[198] = L"Join graph segments (f indicates final):\r\nseg[0]: [0]\r\nseg[1]: �̸�[0] (f)\r\nseg[2]: ����[0] (f)\r\nJoin graph nodes:\r\nnode[0]: ���̺� ���̺�(1/1) (sargs 0) (loc 0)\r\nJoin graph terms:\r\nterm[0]: [���̺�].[����] range";
wchar_t expected_linux[198] = L"Join graph segments (f indicates final):\nseg[0]: [0]\nseg[1]: �̸�[0] (f)\nseg[2]: ����[0] (f)\nJoin graph nodes:\nnode[0]: ���̺� ���̺�(1/1) (sargs 0) (loc 0)\nJoin graph terms:\nterm[0]: [���̺�].[����] range";

//for windows
int c = wcsncmp(query_plan, expected_window, wcslen(expected_window));
if (c != 0) {
// for linux
c = wcsncmp(query_plan, expected_linux, wcslen(expected_linux));
}
if (c != 0) {
wchar_t* wc = (wchar_t*)query_plan;
std::wstring ws(wc);

//for under version to 9.2.x
if (((int)ws.find(L"���̺�")) > 0 && ((int)ws.find(L"�̸�")) > 0 && ((int)ws.find(L"����")) > 0){
c = 0;
}
}
Assert::AreEqual(c, 0);
}
else {
Assert::Fail(L"Query Plan is null");
}
// Clean up.
SQLDisconnect(dbc);
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
}
};
}
Loading