1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-27 05:41:41 +03:00

Commit changes pulled from ob-10.0

This commit is contained in:
Olivier Bertrand
2015-06-02 10:34:51 +02:00
parent 893631a8c1
commit e8ea671c25
66 changed files with 862 additions and 733 deletions

View File

@@ -11,7 +11,7 @@
/***********************************************************************/
#include <my_global.h>
#include <m_string.h>
#if defined(WIN32)
#if defined(__WIN__)
//nclude <io.h>
//nclude <fcntl.h>
#include <direct.h> // for getcwd
@@ -45,13 +45,13 @@
#include "osutil.h"
#if defined(WIN32)
#if defined(__WIN__)
/***********************************************************************/
/* For dynamic load of ODBC32.DLL */
/***********************************************************************/
#pragma comment(lib, "odbc32.lib")
extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // WIN32
#endif // __WIN__
int GetConvSize();
@@ -116,16 +116,24 @@ static int GetSQLCType(int type)
/***********************************************************************/
/* TranslateSQLType: translate a SQL Type to a PLG type. */
/***********************************************************************/
int TranslateSQLType(int stp, int prec, int& len, char& v)
int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w)
{
int type;
switch (stp) {
case SQL_WVARCHAR: // (-9)
w = true;
case SQL_VARCHAR: // 12
v = 'V';
type = TYPE_STRING;
break;
case SQL_WCHAR: // (-8)
w = true;
case SQL_CHAR: // 1
type = TYPE_STRING;
break;
case SQL_WLONGVARCHAR: // (-10)
w = true;
case SQL_LONGVARCHAR: // (-1)
v = 'V';
type = TYPE_STRING;
@@ -180,7 +188,6 @@ int TranslateSQLType(int stp, int prec, int& len, char& v)
case SQL_BINARY: // (-2)
case SQL_VARBINARY: // (-3)
case SQL_LONGVARBINARY: // (-4)
// case SQL_BIT: // (-7)
case SQL_GUID: // (-11)
default:
type = TYPE_ERROR;
@@ -410,6 +417,7 @@ PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, POPARM sop)
PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info)
{
// int i, type, len, prec;
bool w = false;
// PCOLRES crp, crpt, crpl, crpp;
PQRYRES qrp;
ODBConn *ocp;
@@ -455,7 +463,7 @@ PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info)
type = crpt->Kdata->GetIntValue(i);
len = crpl->Kdata->GetIntValue(i);
prec = crpp->Kdata->GetIntValue(i);
type = TranslateSQLType(type, prec, len);
type = TranslateSQLType(type, prec, len, w);
crpt->Kdata->SetValue(type, i);
// Some data sources do not count prec in length
@@ -1201,15 +1209,15 @@ bool ODBConn::DriverConnect(DWORD Options)
SWORD nResult;
PUCHAR ConnOut = (PUCHAR)PlugSubAlloc(m_G, NULL, MAX_CONNECT_LEN);
UWORD wConnectOption = SQL_DRIVER_COMPLETE;
#if defined(WIN32)
#if defined(__WIN__)
HWND hWndTop = GetForegroundWindow();
HWND hWnd = GetParent(hWndTop);
if (hWnd == NULL)
hWnd = GetDesktopWindow();
#else // !WIN32
#else // !__WIN__
HWND hWnd = (HWND)1;
#endif // !WIN32
#endif // !__WIN__
PGLOBAL& g = m_G;
PDBUSER dup = PlgGetUser(g);
@@ -1222,10 +1230,10 @@ bool ODBConn::DriverConnect(DWORD Options)
SQL_NTS, ConnOut, MAX_CONNECT_LEN,
&nResult, wConnectOption);
#if defined(WIN32)
#if defined(__WIN__)
if (hWndTop)
EnableWindow(hWndTop, true);
#endif // WIN32
#endif // __WIN__
// If user hit 'Cancel'
if (rc == SQL_NO_DATA_FOUND) {