Modified:
MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
MYSQLPlus/MYSQLPlusLib/MResultPlus.h
Log:
Modified: MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-06-01 00:56:46 UTC (rev 297)
+++ MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-06-01 03:30:09 UTC (rev 298)
@@ -165,14 +165,13 @@
{
MYODBCDbgEnter();
+ /* create empty resultset */
MDescriptor *pDescriptor;
doClear();
getDiagnostic()->setRowCount( 0 );
pDescriptor = getImpRowDesc();
-
- /* columns */
pDescriptor->doAppend( SQL_VARCHAR, "TYPE_NAME", SQL_NO_NULLS );
pDescriptor->doAppend( SQL_SMALLINT, "DATA_TYPE", SQL_NO_NULLS );
pDescriptor->doAppend( SQL_INTEGER, "COLUMN_SIZE" );
@@ -525,7 +524,114 @@
{
MYODBCDbgEnter();
- MYODBCDbgReturn( SQL_ERROR );
+ /* create empty resultset */
+ MDescriptor *pDescriptor;
+
+ doClear();
+ getDiagnostic()->setRowCount( 0 );
+
+ pDescriptor = getImpRowDesc();
+ pDescriptor->doAppend( SQL_VARCHAR, "TABLE_CAT", SQL_NULLABLE );
+ pDescriptor->doAppend( SQL_VARCHAR, "TABLE_SCHEM", SQL_NULLABLE );
+ pDescriptor->doAppend( SQL_VARCHAR, "TABLE_NAME", SQL_NULLABLE );
+ pDescriptor->doAppend( SQL_VARCHAR, "TABLE_TYPE", SQL_NULLABLE );
+ pDescriptor->doAppend( SQL_VARCHAR, "REMARKS", SQL_NULLABLE );
+
+ /* populate resultset */
+ /*!
+ \internal ODBC Rule
+
+ If TableType is SQL_ALL_TABLE_TYPES and CatalogName, SchemaName, and TableName
are
+ empty strings, the result set contains a list of valid table types for the data
source.
+ (All columns except the TABLE_TYPE column contain NULLs.)
+ */
+ if ( stringCatalogName == "" &&
+ stringSchemaName == "" &&
+ stringTableName == "" &&
+ stringTableType == SQL_ALL_TABLE_TYPES )
+ {
+ doAppendTablesTableTypes();
+/* MYODBCDrvTablesGetTableTypes( pStm, NULL, 0, hTableTypes ); */
+/* MYODBCDrvAppendTable( pStm->hRes, NULL, NULL, NULL, pszTableType ); */
+ }
+ /*!
+ \internal ODBC Rule
+
+ If SchemaName is SQL_ALL_SCHEMAS and CatalogName and TableName are empty strings,
the result
+ set contains a list of valid schemas for the data source. (All columns except the
TABLE_SCHEM
+ column contain NULLs.)
+ */
+ else if ( stringCatalogName == "" &&
+ stringSchemaName == SQL_ALL_SCHEMAS &&
+ stringTableName == "" )
+ {
+ doAppendTablesSchemas();
+/*
+ MYODBCDrvGetSchemas( pStm->pDbc, "%", "%", hSchemas );
+ MYODBCDrvAppendTable( pStm->hRes, NULL, pszSchema, NULL, NULL );
+*/
+ }
+ /*!
+ \internal ODBC Rule
+
+ If CatalogName is SQL_ALL_CATALOGS and SchemaName and TableName are empty
strings, the result set
+ contains a list of valid catalogs for the data source. (All columns except the
TABLE_CAT column
+ contain NULLs.)
+ */
+ else if ( stringCatalogName == SQL_ALL_CATALOGS &&
+ stringSchemaName == "" &&
+ stringTableName == "" )
+ {
+ doAppendTablesCatalogs();
+/*
+ MYODBCDrvGetCatalogs( pStm->pDbc, "%", hCatalogs );
+ MYODBCDrvAppendTable( pStm->hRes, pszCatalog, NULL, NULL, NULL );
+*/
+ }
+ /*!
+ \internal ODBC Rule
+
+ SQLTables returns the results as a standard result set, ordered by TABLE_TYPE,
TABLE_CAT, TABLE_SCHEM,
+ and TABLE_NAME.
+ */
+ else
+ {
+ doAppendTablesTableTypes( stringCatalogName, stringSchemaName, stringTableName,
stringTableType );
+/*
+ nReturn = MYODBCDrvTablesTableTypes( pStm,
+ pszCatalogName, nNameLength1,
+ pszSchemaName, nNameLength2,
+ pszTableName, nNameLength3,
+ pszTableType, nNameLength4 );
+*/
+ }
+
+ /*!
+ \internal ODBC RULE
+
+ When SQLExecute, SQLExecDirect, SQLBulkOperations, SQLSetPos, or SQLMoreResults
is called, the SQL_DIAG_ROW_COUNT
+ field of the diagnostic data structure is set to the row count, and the row count
is cached in an implementation-dependent
+ way. SQLRowCount returns the cached row count value. The cached row count value
is valid until the statement handle is set
+ back to the prepared or allocated state, the statement is reexecuted, or
SQLCloseCursor is called. Note that if a function
+ has been called since the SQL_DIAG_ROW_COUNT field was set, the value returned by
SQLRowCount might be different from the
+ value in the SQL_DIAG_ROW_COUNT field because the SQL_DIAG_ROW_COUNT field is
reset to 0 by any function call.
+
+ \internal MYODBC RULE
+
+ Wet set SQL_DIAG_ROW_COUNT when any result set is requested - for example we also
set SQL_DIAG_ROW_COUNT for catalog
+ functions.
+ */
+ qulonglong nRows = -1;
+ if ( !SQL_SUCCEEDED( getRows( &nRows ) ) )
+ getDiagnostic()->setRowCount( -1 );
+ else
+ getDiagnostic()->setRowCount( nRows );
+
+ /* we should be at last record so next will make us eof and a subsequent next will be
first record */
+ setState( STATE_EXECUTED );
+ doNext();
+
+ MYODBCDbgReturn( SQL_SUCCESS );
}
BOOLEAN MResultPlus::isValidRow()
@@ -893,3 +999,28 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
+SQLRETURN MResultPlus::doAppendTablesTableTypes()
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MResultPlus::doAppendTablesSchemas()
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MResultPlus::doAppendTablesCatalogs()
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+SQLRETURN MResultPlus::doAppendTablesTableTypes( const QString &stringCatalogName,
const QString &stringSchemaName, const QString &stringTableName, const QString
&stringTableType )
+{
+ MYODBCDbgEnter();
+ MYODBCDbgReturn( SQL_SUCCESS );
+}
+
+
Modified: MYSQLPlus/MYSQLPlusLib/MResultPlus.h
===================================================================
--- MYSQLPlus/MYSQLPlusLib/MResultPlus.h 2006-06-01 00:56:46 UTC (rev 297)
+++ MYSQLPlus/MYSQLPlusLib/MResultPlus.h 2006-06-01 03:30:09 UTC (rev 298)
@@ -91,8 +91,11 @@
qulonglong nRow; /* 1 -based (0 as BOS/EOS) */
- /*
- These, doAppendTypeInfo*(), methods are not terribly efficient but are unlikely
to
+ /*!
+ \internal
+ \note
+
+ These, doAppend*(), methods are not terribly efficient but are unlikely to
be a source of performance issues. Hopefully they are easy to
understand/maintain.
*/
SQLRETURN doAppendTypeInfo( const QVariant &stringTypeName,
@@ -134,6 +137,12 @@
SQLRETURN doAppendTypeInfoTime();
SQLRETURN doAppendTypeInfoTimeStamp();
SQLRETURN doAppendTypeInfoVarChar();
+
+ SQLRETURN doAppendTablesTableTypes();
+ SQLRETURN doAppendTablesSchemas();
+ SQLRETURN doAppendTablesCatalogs();
+ SQLRETURN doAppendTablesTableTypes( const QString &stringCatalogName, const
QString &stringSchemaName, const QString &stringTableName, const QString
&stringTableType );
+
};
#endif
| Thread |
|---|
| • Connector/ODBC 5 commit: r298 - MYSQLPlus/MYSQLPlusLib | pharvey | 1 Jun |