p; = 0;
m_nScale = 0;
m_nRadix = 0;
m_fNullable = 0;
m_strRemarks = _T("");
m_nFields = 12;
}
CTable::CTable(CDatabase* pDatabase): CRecordset(pDatabase)
{
m_strTableQualifier = _T("");
m_strTableOwner = _T("");
m_strTableName = _T("");
m_strTableType = _T("");
m_strRemarks = _T("");
m_nFields = 5;
}
BOOL CTable::Open(LPCSTR pszTableQualifier,
LPCSTR pszTableOwner,LPCSTR pszTableName,LPCSTR pszTableType,
UINT nOpenType)
{
RETCODE nRetCode;
UWORD bFunctionExists;
//检验是否支持SQLTables 函数
AFX_SQL_SYNC(::SQLGetFunctions(m_pDatabase->m_hdbc,
SQL_API_SQLTABLES,&bFunctionExists));
if (!Check(nRetCode) || !bFunctionExists)
{
if (!bFunctionExists)
TRACE(_T("SQLTables 不支持\n"));
return FALSE;
}
//设置缓冲区状态,分配语句句柄
SetState(nOpenType,NULL,readOnly);
if (!AllocHstmt())
return FALSE;
TRY
{
OnSetOptions(m_hstmt);
AllocStatusArrays();
//调用 ODBC的SQLTables函数
AFX_ODBC_CALL(::SQLTables(m_hstmt,
(UCHAR FAR*)pszTableQualifier,SQL_NTS,
(UCHAR FAR*)pszTableOwner,SQL_NTS,
(UCHAR FAR*)pszTableName,SQL_NTS,
(UCHAR FAR*)pszTableT