Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
df1dfcff
Commit
df1dfcff
authored
Feb 15, 2013
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put trace in ODBC source files
modified: storage/connect/odbconn.cpp storage/connect/tabodbc.cpp
parent
b8746ba9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
120 deletions
+105
-120
storage/connect/odbconn.cpp
storage/connect/odbconn.cpp
+92
-106
storage/connect/tabodbc.cpp
storage/connect/tabodbc.cpp
+13
-14
No files found.
storage/connect/odbconn.cpp
View file @
df1dfcff
...
@@ -62,6 +62,8 @@ extern "C" int GetRcString(int id, char *buf, int bufsize);
...
@@ -62,6 +62,8 @@ extern "C" int GetRcString(int id, char *buf, int bufsize);
#define DEBUG_ONLY(f) ((void)0)
#define DEBUG_ONLY(f) ((void)0)
#endif // !_DEBUG
#endif // !_DEBUG
extern
"C"
int
trace
;
/***********************************************************************/
/***********************************************************************/
/* GetSQLType: returns the SQL_TYPE corresponding to a PLG type. */
/* GetSQLType: returns the SQL_TYPE corresponding to a PLG type. */
/***********************************************************************/
/***********************************************************************/
...
@@ -274,10 +276,9 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
...
@@ -274,10 +276,9 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
length
[
3
]
=
128
;
length
[
3
]
=
128
;
}
// endif ocp
}
// endif ocp
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"ODBCColumns: max=%d len=%d,%d,%d
\n
"
,
htrc
(
"ODBCColumns: max=%d len=%d,%d,%d
\n
"
,
maxres
,
length
[
0
],
length
[
1
],
length
[
2
],
length
[
3
]);
maxres
,
length
[
0
],
length
[
1
],
length
[
2
],
length
[
3
]);
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structures used to refer to the result set. */
/* Allocate the structures used to refer to the result set. */
...
@@ -288,9 +289,8 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
...
@@ -288,9 +289,8 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
if
(
info
)
// Info table
if
(
info
)
// Info table
return
qrp
;
return
qrp
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Getting col results ncol=%d
\n
"
,
qrp
->
Nbcol
);
htrc
(
"Getting col results ncol=%d
\n
"
,
qrp
->
Nbcol
);
#endif
cap
=
AllocCatInfo
(
g
,
CAT_COL
,
table
,
qrp
);
cap
=
AllocCatInfo
(
g
,
CAT_COL
,
table
,
qrp
);
cap
->
Pat
=
(
PUCHAR
)
colpat
;
cap
->
Pat
=
(
PUCHAR
)
colpat
;
...
@@ -302,9 +302,9 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
...
@@ -302,9 +302,9 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *table,
qrp
->
Nblin
=
n
;
qrp
->
Nblin
=
n
;
ResetNullValues
(
cap
);
ResetNullValues
(
cap
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Columns: NBCOL=%d NBLIN=%d
\n
"
,
qrp
->
Nbcol
,
qrp
->
Nblin
);
htrc
(
"Columns: NBCOL=%d NBLIN=%d
\n
"
,
qrp
->
Nbcol
,
qrp
->
Nblin
);
#endif
}
else
}
else
qrp
=
NULL
;
qrp
=
NULL
;
...
@@ -416,9 +416,8 @@ PQRYRES ODBCDataSources(PGLOBAL g, bool info)
...
@@ -416,9 +416,8 @@ PQRYRES ODBCDataSources(PGLOBAL g, bool info)
maxres
=
0
;
maxres
=
0
;
}
// endif info
}
// endif info
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"ODBCDataSources: max=%d len=%d
\n
"
,
maxres
,
length
[
0
]);
htrc
(
"ODBCDataSources: max=%d len=%d
\n
"
,
maxres
,
length
[
0
]);
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structures used to refer to the result set. */
/* Allocate the structures used to refer to the result set. */
...
@@ -462,9 +461,8 @@ PQRYRES ODBCDrivers(PGLOBAL g, bool info)
...
@@ -462,9 +461,8 @@ PQRYRES ODBCDrivers(PGLOBAL g, bool info)
}
else
}
else
maxres
=
0
;
maxres
=
0
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"ODBCDrivers: max=%d len=%d
\n
"
,
maxres
,
length
[
0
]);
htrc
(
"ODBCDrivers: max=%d len=%d
\n
"
,
maxres
,
length
[
0
]);
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structures used to refer to the result set. */
/* Allocate the structures used to refer to the result set. */
...
@@ -527,10 +525,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
...
@@ -527,10 +525,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
length
[
2
]
=
128
;
length
[
2
]
=
128
;
}
// endif info
}
// endif info
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"ODBCTables: max=%d len=%d,%d
\n
"
,
htrc
(
"ODBCTables: max=%d len=%d,%d
\n
"
,
maxres
,
length
[
0
],
length
[
1
]);
maxres
,
length
[
0
],
length
[
1
]);
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structures used to refer to the result set. */
/* Allocate the structures used to refer to the result set. */
...
@@ -544,9 +540,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
...
@@ -544,9 +540,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
cap
=
AllocCatInfo
(
g
,
CAT_TAB
,
tabpat
,
qrp
);
cap
=
AllocCatInfo
(
g
,
CAT_TAB
,
tabpat
,
qrp
);
//cap->Pat = (PUCHAR)tabtyp;
//cap->Pat = (PUCHAR)tabtyp;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Getting table results ncol=%d
\n
"
,
cap
->
Qrp
->
Nbcol
);
htrc
(
"Getting table results ncol=%d
\n
"
,
cap
->
Qrp
->
Nbcol
);
#endif
/************************************************************************/
/************************************************************************/
/* Now get the results into blocks. */
/* Now get the results into blocks. */
...
@@ -555,9 +550,9 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
...
@@ -555,9 +550,9 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info)
qrp
->
Nblin
=
n
;
qrp
->
Nblin
=
n
;
ResetNullValues
(
cap
);
ResetNullValues
(
cap
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Tables: NBCOL=%d NBLIN=%d
\n
"
,
qrp
->
Nbcol
,
qrp
->
Nblin
);
htrc
(
"Tables: NBCOL=%d NBLIN=%d
\n
"
,
qrp
->
Nbcol
,
qrp
->
Nblin
);
#endif
}
else
}
else
qrp
=
NULL
;
qrp
=
NULL
;
...
@@ -615,10 +610,9 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
...
@@ -615,10 +610,9 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN);
n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN);
length[3] = (n) ? (n + 1) : 128;
length[3] = (n) ? (n + 1) : 128;
#ifdef DEBTRACE
if (trace)
htrc("ODBCPrimaryKeys: max=%d len=%d,%d,%d\n",
htrc("ODBCPrimaryKeys: max=%d len=%d,%d,%d\n",
maxres, length[0], length[1], length[2]);
maxres, length[0], length[1], length[2]);
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structure used to refer to the result set. */
/* Allocate the structure used to refer to the result set. */
...
@@ -626,9 +620,8 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
...
@@ -626,9 +620,8 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
qrp = PlgAllocResult(g, ncol, maxres, IDS_PKEY,
qrp = PlgAllocResult(g, ncol, maxres, IDS_PKEY,
dbtype, buftyp, NULL, length, true, true);
dbtype, buftyp, NULL, length, true, true);
#ifdef DEBTRACE
if (trace)
htrc("Getting pkey results ncol=%d\n", qrp->Nbcol);
htrc("Getting pkey results ncol=%d\n", qrp->Nbcol);
#endif
cap = AllocCatInfo(g, CAT_KEY, table, qrp);
cap = AllocCatInfo(g, CAT_KEY, table, qrp);
...
@@ -639,10 +632,9 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
...
@@ -639,10 +632,9 @@ PQRYRES ODBCPrimaryKeys(PGLOBAL g, ODBConn *op, char *dsn, char *table)
qrp->Nblin = n;
qrp->Nblin = n;
ResetNullValues(cap);
ResetNullValues(cap);
#ifdef DEBTRACE
if (trace)
htrc("PrimaryKeys: NBCOL=%d NBLIN=%d\n",
htrc("PrimaryKeys: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
qrp->Nbcol, qrp->Nblin);
#endif
} else
} else
qrp = NULL;
qrp = NULL;
...
@@ -704,9 +696,8 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
...
@@ -704,9 +696,8 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN);
n = ocp->GetMaxValue(SQL_MAX_COLUMN_NAME_LEN);
length[7] = (n) ? (n + 1) : 128;
length[7] = (n) ? (n + 1) : 128;
#ifdef DEBTRACE
if (trace)
htrc("SemStatistics: max=%d pat=%s\n", maxres, SVP(pat));
htrc("SemStatistics: max=%d pat=%s\n", maxres, SVP(pat));
#endif
/************************************************************************/
/************************************************************************/
/* Allocate the structure used to refer to the result set. */
/* Allocate the structure used to refer to the result set. */
...
@@ -714,9 +705,8 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
...
@@ -714,9 +705,8 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
qrp = PlgAllocResult(g, ncol, maxres, IDS_STAT,
qrp = PlgAllocResult(g, ncol, maxres, IDS_STAT,
dbtype, buftyp, NULL, length, true, true);
dbtype, buftyp, NULL, length, true, true);
#ifdef DEBTRACE
if (trace)
htrc("Getting stat results ncol=%d\n", qrp->Nbcol);
htrc("Getting stat results ncol=%d\n", qrp->Nbcol);
#endif
cap = AllocCatInfo(g, CAT_STAT, pat, qrp);
cap = AllocCatInfo(g, CAT_STAT, pat, qrp);
cap->Unique = (un < 0) ? SQL_INDEX_UNIQUE : (UWORD)un;
cap->Unique = (un < 0) ? SQL_INDEX_UNIQUE : (UWORD)un;
...
@@ -729,10 +719,9 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
...
@@ -729,10 +719,9 @@ PQRYRES ODBCStatistics(PGLOBAL g, ODBConn *op, char *dsn, char *pat,
qrp->Nblin = n;
qrp->Nblin = n;
ResetNullValues(cap);
ResetNullValues(cap);
#ifdef DEBTRACE
if (trace)
htrc("Statistics: NBCOL=%d NBLIN=%d\n",
htrc("Statistics: NBCOL=%d NBLIN=%d\n", qrp->Nbcol, qrp->Nblin);
qrp->Nbcol, qrp->Nblin);
#endif
} else
} else
qrp = NULL;
qrp = NULL;
...
@@ -785,9 +774,8 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
...
@@ -785,9 +774,8 @@ void DBX::BuildErrorMessage(ODBConn* pdb, HSTMT hstmt)
m_ErrMsg
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
((
char
*
)
msg
)
+
1
);
m_ErrMsg
[
i
]
=
(
PSZ
)
PlugSubAlloc
(
g
,
NULL
,
strlen
((
char
*
)
msg
)
+
1
);
strcpy
(
m_ErrMsg
[
i
],
(
char
*
)
msg
);
strcpy
(
m_ErrMsg
[
i
],
(
char
*
)
msg
);
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"%s, Native=%d
\n
"
,
msg
,
native
);
htrc
(
"%s, Native=%d
\n
"
,
msg
,
native
);
#endif
rc
=
SQLError
(
pdb
->
m_henv
,
pdb
->
m_hdbc
,
hstmt
,
state
,
rc
=
SQLError
(
pdb
->
m_henv
,
pdb
->
m_hdbc
,
hstmt
,
state
,
&
native
,
msg
,
SQL_MAX_MESSAGE_LENGTH
-
1
,
&
len
);
&
native
,
msg
,
SQL_MAX_MESSAGE_LENGTH
-
1
,
&
len
);
...
@@ -1025,18 +1013,15 @@ void ODBConn::AllocConnect(DWORD Options)
...
@@ -1025,18 +1013,15 @@ void ODBConn::AllocConnect(DWORD Options)
rc
=
SQLSetConnectOption
(
m_hdbc
,
SQL_LOGIN_TIMEOUT
,
m_LoginTimeout
);
rc
=
SQLSetConnectOption
(
m_hdbc
,
SQL_LOGIN_TIMEOUT
,
m_LoginTimeout
);
#ifdef DEBTRACE
if
(
trace
&&
rc
!=
SQL_SUCCESS
&&
rc
!=
SQL_SUCCESS_WITH_INFO
)
if
(
rc
!=
SQL_SUCCESS
&&
rc
!=
SQL_SUCCESS_WITH_INFO
)
htrc
(
"Warning: Failure setting login timeout
\n
"
);
htrc
(
"Warning: Failure setting login timeout
\n
"
);
#endif
if
(
!
m_Updatable
)
{
if
(
!
m_Updatable
)
{
rc
=
SQLSetConnectOption
(
m_hdbc
,
SQL_ACCESS_MODE
,
rc
=
SQLSetConnectOption
(
m_hdbc
,
SQL_ACCESS_MODE
,
SQL_MODE_READ_ONLY
);
SQL_MODE_READ_ONLY
);
#ifdef DEBTRACE
if
(
trace
&&
rc
!=
SQL_SUCCESS
&&
rc
!=
SQL_SUCCESS_WITH_INFO
)
if
(
rc
!=
SQL_SUCCESS
&&
rc
!=
SQL_SUCCESS_WITH_INFO
)
htrc
(
"Warning: Failure setting read only access mode
\n
"
);
htrc
(
"Warning: Failure setting read only access mode
\n
"
);
#endif
}
// endif
}
// endif
// Turn on cursor lib support
// Turn on cursor lib support
...
@@ -1088,10 +1073,9 @@ bool ODBConn::Connect(DWORD Options)
...
@@ -1088,10 +1073,9 @@ bool ODBConn::Connect(DWORD Options)
}
// endif rc
}
// endif rc
if
(
!
Check
(
rc
))
{
if
(
!
Check
(
rc
))
{
#ifdef DEBTRACE
if
(
trace
&&
!
hWnd
==
NULL
)
if
(
!
hWnd
==
NULL
)
htrc
(
"Error: No default window for SQLDriverConnect
\n
"
);
htrc
(
"Error: No default window for SQLDriverConnect
\n
"
);
#endif
ThrowDBX
(
rc
);
ThrowDBX
(
rc
);
}
// endif Check
}
// endif Check
...
@@ -1175,9 +1159,9 @@ void ODBConn::GetConnectInfo()
...
@@ -1175,9 +1159,9 @@ void ODBConn::GetConnectInfo()
else
else
m_Updatable = false;
m_Updatable = false;
#ifdef DEBTRACE
if (trace)
htrc("Warning: data source is readonly\n");
htrc("Warning: data source is readonly\n");
#endif
} else // Make data source is !Updatable
} else // Make data source is !Updatable
rc = SQLSetConnectOption(m_hdbc, SQL_ACCESS_MODE,
rc = SQLSetConnectOption(m_hdbc, SQL_ACCESS_MODE,
SQL_MODE_READ_ONLY);
SQL_MODE_READ_ONLY);
...
@@ -1194,10 +1178,10 @@ void ODBConn::GetConnectInfo()
...
@@ -1194,10 +1178,10 @@ void ODBConn::GetConnectInfo()
else
else
m_IDQuoteChar
=
' '
;
m_IDQuoteChar
=
' '
;
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"DBMS: %s, Version: %s"
,
htrc
(
"DBMS: %s, Version: %s"
,
GetStringInfo
(
SQL_DBMS_NAME
),
GetStringInfo
(
SQL_DBMS_VER
));
GetStringInfo
(
SQL_DBMS_NAME
),
GetStringInfo
(
SQL_DBMS_VER
));
#endif // DEBTRACE
}
// end of GetConnectInfo
}
// end of GetConnectInfo
/***********************************************************************/
/***********************************************************************/
...
@@ -1305,10 +1289,10 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
...
@@ -1305,10 +1289,10 @@ int ODBConn::ExecDirectSQL(char *sql, ODBCCOL *tocols)
}
// endif pcol
}
// endif pcol
}
catch
(
DBX
*
x
)
{
}
catch
(
DBX
*
x
)
{
#ifdef DEBTRACE
if
(
trace
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
htrc
(
x
->
m_ErrMsg
[
i
]);
htrc
(
x
->
m_ErrMsg
[
i
]);
#endif
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
if
(
b
)
if
(
b
)
...
@@ -1351,10 +1335,11 @@ int ODBConn::GetResultSize(char *sql, ODBCCOL *colp)
...
@@ -1351,10 +1335,11 @@ int ODBConn::GetResultSize(char *sql, ODBCCOL *colp)
}
catch
(
DBX
*
x
)
{
}
catch
(
DBX
*
x
)
{
// strcpy(m_G->Message, x->m_ErrMsg[0]);
// strcpy(m_G->Message, x->m_ErrMsg[0]);
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
#ifdef DEBTRACE
if
(
trace
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
htrc
(
x
->
m_ErrMsg
[
i
]);
htrc
(
x
->
m_ErrMsg
[
i
]);
#endif
SQLCancel
(
m_hstmt
);
SQLCancel
(
m_hstmt
);
n
=
-
2
;
n
=
-
2
;
}
// end try/catch
}
// end try/catch
...
@@ -1458,10 +1443,10 @@ int ODBConn::PrepareSQL(char *sql)
...
@@ -1458,10 +1443,10 @@ int ODBConn::PrepareSQL(char *sql)
}
while
(
rc
==
SQL_STILL_EXECUTING
);
}
while
(
rc
==
SQL_STILL_EXECUTING
);
}
catch
(
DBX
*
x
)
{
}
catch
(
DBX
*
x
)
{
#ifdef DEBTRACE
if
(
trace
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
htrc
(
x
->
m_ErrMsg
[
i
]);
htrc
(
x
->
m_ErrMsg
[
i
]);
#endif
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
if
(
b
)
if
(
b
)
...
@@ -1813,10 +1798,10 @@ int ODBConn::GetCatInfo(CATPARM *cap)
...
@@ -1813,10 +1798,10 @@ int ODBConn::GetCatInfo(CATPARM *cap)
irc
=
(
int
)
crow
;
irc
=
(
int
)
crow
;
}
catch
(
DBX
*
x
)
{
}
catch
(
DBX
*
x
)
{
#ifdef DEBTRACE
if
(
trace
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
for
(
int
i
=
0
;
i
<
MAX_NUM_OF_MSG
&&
x
->
m_ErrMsg
[
i
];
i
++
)
htrc
(
x
->
m_ErrMsg
[
i
]);
htrc
(
x
->
m_ErrMsg
[
i
]);
#endif
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
strcpy
(
m_G
->
Message
,
x
->
GetErrorMessage
(
0
));
irc
=
-
1
;
irc
=
-
1
;
}
// end try/catch
}
// end try/catch
...
@@ -1887,9 +1872,9 @@ void ODBConn::Free()
...
@@ -1887,9 +1872,9 @@ void ODBConn::Free()
Close
();
Close
();
}
catch
(
DBX
*
)
{
}
catch
(
DBX
*
)
{
// Nothing we can do
// Nothing we can do
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"Error: exception by Close ignored in Free
\n
"
);
htrc
(
"Error: exception by Close ignored in Free
\n
"
);
#endif
// DELETE_EXCEPTION(x);
// DELETE_EXCEPTION(x);
}
// endcatch
}
// endcatch
...
@@ -1900,16 +1885,18 @@ void ODBConn::Free()
...
@@ -1900,16 +1885,18 @@ void ODBConn::Free()
if
(
m_nAlloc
==
0
)
{
if
(
m_nAlloc
==
0
)
{
// free last connection - release HENV
// free last connection - release HENV
#ifdef DEBTRACE
if
(
trace
)
{
RETCODE
rc
=
SQLFreeEnv
(
m_henv
);
RETCODE
rc
=
SQLFreeEnv
(
m_henv
);
if
(
rc
!=
SQL_SUCCESS
)
// Nothing we can do
if
(
rc
!=
SQL_SUCCESS
)
// Nothing we can do
htrc
(
"Error: SQLFreeEnv failure ignored in Free
\n
"
);
htrc
(
"Error: SQLFreeEnv failure ignored in Free
\n
"
);
#else
}
else
SQLFreeEnv
(
m_henv
);
SQLFreeEnv
(
m_henv
);
#endif
m_henv
=
SQL_NULL_HENV
;
m_henv
=
SQL_NULL_HENV
;
}
// endif m_nAlloc
}
// endif m_nAlloc
}
}
// endif m_henv
//AfxUnlockGlobals(CRIT_ODBC);
//AfxUnlockGlobals(CRIT_ODBC);
}
// end of Free
}
// end of Free
...
@@ -1976,13 +1963,12 @@ RECSET::~RECSET()
...
@@ -1976,13 +1963,12 @@ RECSET::~RECSET()
{
{
try {
try {
if (m_hstmt) {
if (m_hstmt) {
#ifdef DEBTRACE
if (trace && (m_dwOptions & useMultiRowFetch)) {
if (m_dwOptions & useMultiRowFetch) {
htrc("WARNING: Close called implicitly from destructor\n");
htrc("WARNING: Close called implicitly from destructor\n");
htrc("Use of multi row fetch requires explicit call\n");
htrc("Use of multi row fetch requires explicit call\n");
htrc("to Close or memory leaks will result\n");
htrc("to Close or memory leaks will result\n");
}
} // endif trace
#endif
Close();
Close();
} // endif m_hstmt
} // endif m_hstmt
...
@@ -1992,9 +1978,9 @@ RECSET::~RECSET()
...
@@ -1992,9 +1978,9 @@ RECSET::~RECSET()
m_pDB = NULL;
m_pDB = NULL;
} catch(DBX*) {
} catch(DBX*) {
// Nothing we can do
// Nothing we can do
#ifdef DEBTRACE
if (trace)
htrc("Error: Exception ignored in ~RECSET\n");
htrc("Error: Exception ignored in ~RECSET\n");
#endif
} // endtry/catch
} // endtry/catch
} // end of ~RECSET
} // end of ~RECSET
...
...
storage/connect/tabodbc.cpp
View file @
df1dfcff
...
@@ -76,6 +76,7 @@
...
@@ -76,6 +76,7 @@
#include "sql_string.h"
#include "sql_string.h"
extern
"C"
char
*
GetMsgid
(
int
id
);
extern
"C"
char
*
GetMsgid
(
int
id
);
extern
"C"
int
trace
;
/***********************************************************************/
/***********************************************************************/
/* DB static variables. */
/* DB static variables. */
...
@@ -584,10 +585,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
...
@@ -584,10 +585,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
{
{
int
rc
;
int
rc
;
#ifdef DEBTRACE
if
(
trace
>
1
)
htrc
(
"ODBC ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p
\n
"
,
htrc
(
"ODBC ReadDB: R%d Mode=%d key=%p link=%p Kindex=%p
\n
"
,
GetTdb_No
(),
Mode
,
To_Key_Col
,
To_Link
,
To_Kindex
);
GetTdb_No
(),
Mode
,
To_Key_Col
,
To_Link
,
To_Kindex
);
#endif
if
(
To_Kindex
)
{
if
(
To_Kindex
)
{
// Direct access of ODBC tables is not implemented yet
// Direct access of ODBC tables is not implemented yet
...
@@ -631,9 +631,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
...
@@ -631,9 +631,9 @@ int TDBODBC::ReadDB(PGLOBAL g)
rc
=
(
Rbuf
>
0
)
?
RC_OK
:
(
Rbuf
==
0
)
?
RC_EF
:
RC_FX
;
rc
=
(
Rbuf
>
0
)
?
RC_OK
:
(
Rbuf
==
0
)
?
RC_EF
:
RC_FX
;
Fpos
++
;
// Used for progress info
Fpos
++
;
// Used for progress info
#ifdef DEBTRACE
if
(
trace
>
1
)
htrc
(
" Read: Rbuf=%d rc=%d
\n
"
,
Rbuf
,
rc
);
htrc
(
" Read: Rbuf=%d rc=%d
\n
"
,
Rbuf
,
rc
);
#endif
return
rc
;
return
rc
;
}
// end of ReadDB
}
// end of ReadDB
...
@@ -667,9 +667,9 @@ void TDBODBC::CloseDB(PGLOBAL g)
...
@@ -667,9 +667,9 @@ void TDBODBC::CloseDB(PGLOBAL g)
Ocp
->
Close
();
Ocp
->
Close
();
#ifdef DEBTRACE
if
(
trace
)
htrc
(
"ODBC CloseDB: closing %s
\n
"
,
Name
);
htrc
(
"ODBC CloseDB: closing %s
\n
"
,
Name
);
#endif
}
// end of CloseDB
}
// end of CloseDB
/* --------------------------- ODBCCOL ------------------------------- */
/* --------------------------- ODBCCOL ------------------------------- */
...
@@ -699,10 +699,9 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
...
@@ -699,10 +699,9 @@ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
Blkp
=
NULL
;
Blkp
=
NULL
;
Rank
=
0
;
// Not known yet
Rank
=
0
;
// Not known yet
#ifdef DEBTRACE
if
(
trace
)
htrc
(
" making new %sCOL C%d %s at %p
\n
"
,
htrc
(
" making new %sCOL C%d %s at %p
\n
"
,
am
,
Index
,
Name
,
this
);
am
,
Index
,
Name
,
this
);
#endif
}
// end of ODBCCOL constructor
}
// end of ODBCCOL constructor
/***********************************************************************/
/***********************************************************************/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment