Modified:
trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.h
Log:
more work on SQLSpecialColumns
Modified: trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp 2006-06-27 16:21:52 UTC (rev 405)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MConnection.cpp 2006-06-27 21:52:40 UTC (rev 406)
@@ -3413,7 +3413,7 @@
MYODBCDbgEnter();
if ( getMySQL() )
- MYODBCDbgReturn1( ((MYSQL*)getMySQL())->server_version );
+ MYODBCDbgReturn1( mysql_get_server_info( (MYSQL*)getMySQL() ) );
MYODBCDbgReturn1( "" );
}
@@ -4187,7 +4187,7 @@
MYODBCDbgEnter();
if ( getMySQL() )
- MYODBCDbgReturn1( ((MYSQL*)getMySQL())->host_info );
+ MYODBCDbgReturn1( mysql_get_host_info( (MYSQL*)getMySQL() ) );
MYODBCDbgReturn1( "" );
}
@@ -4524,17 +4524,12 @@
/*!
\internal ODBC RULE
- \todo
A string that indicates the name of the connection that the diagnostic record
relates to. This field is
driver-defined. For diagnostic data structures associated with the environment
handle and for diagnostics
that do not relate to any connection, this field is a zero-length string.
-
- \note
-
- We query the server for its name and use it here.
*/
- // getDiagnostic()->setConnectionName( zzzzzzzz );
+ getDiagnostic()->setConnectionName( mysql_get_host_info( pMySQL ) ) );
/*!
\internal ODBC RULE
@@ -4589,17 +4584,12 @@
/*!
\internal ODBC RULE
- \todo
A string that indicates the name of the connection that the diagnostic record
relates to. This field is
driver-defined. For diagnostic data structures associated with the environment
handle and for diagnostics
that do not relate to any connection, this field is a zero-length string.
-
- \note
-
- We query the server for its name and use it here.
*/
- // getDiagnostic()->setConnectionName( zzzzzzzz );
+ getDiagnostic()->setConnectionName( mysql_get_host_info( pMySQL ) ) );
/*!
\internal ODBC RULE
Modified: trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-06-27 16:21:52 UTC (rev 405)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.cpp 2006-06-27 21:52:40 UTC (rev 406)
@@ -687,7 +687,7 @@
MYODBCDbgReturn( nReturn );
}
-SQLRETURN MResultPlus::doSpecialColumns( SQLSMALLINT nIdentifierType, const QString
&stringCatalog, const QString &stringSchema, const QString &stringTable,
SQLSMALLINT nScope, SQLSMALLINT nNullable )
+SQLRETURN MResultPlus::doSpecialColumns( SQLSMALLINT nIdentifierType, const QString
&stringCatalogFilter, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable )
{
MYODBCDbgEnter();
@@ -710,7 +710,7 @@
pDescriptor->doAppend( SQL_SMALLINT, "PSEUDO_COLUMN", SQL_NULLABLE );
/* do it */
-// nReturn = doAppendSpecialColumnsCatalogs( stringCatalog, stringSchema, stringTable,
stringColumn );
+ nReturn = doAppendSpecialColumnsCatalogs( nIdentifierType, stringCatalogFilter,
stringSchemaFilter, stringTableFilter, nScope, nNullable );
/*!
\internal ODBC RULE
@@ -1768,4 +1768,154 @@
MYODBCDbgReturn( SQL_SUCCESS );
}
+SQLRETURN MResultPlus::doAppendSpecialColumnsCatalogs( SQLSMALLINT nIdentifierType, const
QString &stringCatalogFilter, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable )
+{
+ MYODBCDbgEnter();
+ SQLRETURN nReturn = SQL_SUCCESS;
+
+ /*!
+ \internal MYODBC Rule
+
+ If we have a % we will get all catalogs but if we have a NULL we will only return
the
+ current catalog. This will make things consistent with some other drivers.
+ */
+ if ( stringCatalogFilter.isNull() )
+ {
+ QString stringCatalog = getConnection()->getCurrentCatalog();
+ if ( stringCatalog.isNull() )
+ stringCatalog = "";
+
+ MYODBCDbgReturn( doAppendSpecialColumnsSchemas( nIdentifierType, stringCatalog,
stringSchemaFilter, stringTableFilter, nScope, nNullable ) );
+ }
+
+ QStringList stringlistCatalogs = getCatalogs( "%" );
+
+ BOOLEAN bWildCard = ( getEnvironment()->getODBCVersion() != SQL_OV_ODBC2
&& getStatement()->getMetadataID() == SQL_FALSE );
+ QString stringWildCard = stringCatalogFilter;
+ QRegExp regexWildCard;
+ regexWildCard.setPatternSyntax( QRegExp::Wildcard );
+
+ if ( bWildCard )
+ regexWildCard.setPattern( stringWildCard.replace( '%', '*' ) );
+
+ for ( int n = 0; n < stringlistCatalogs.count(); n++ )
+ {
+ BOOLEAN bMatch;
+
+ if ( stringCatalogFilter.isNull() )
+ bMatch = true;
+ else if ( bWildCard )
+ bMatch = regexWildCard.exactMatch( stringlistCatalogs[n] );
+ else
+ bMatch = stringlistCatalogs[n] == stringCatalogFilter;
+
+ if ( bMatch )
+ {
+ nReturn = doAppendSpecialColumnsSchemas( nIdentifierType,
stringlistCatalogs[n], stringSchemaFilter, stringTableFilter, nScope, nNullable );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ break;
+ }
+ }
+
+ MYODBCDbgReturn( nReturn );
+}
+
+SQLRETURN MResultPlus::doAppendSpecialColumnsSchemas( SQLSMALLINT nIdentifierType, const
QString &stringCatalog, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable )
+{
+ MYODBCDbgEnter();
+
+ SQLRETURN nReturn = SQL_SUCCESS;
+
+ /*!
+ \internal ODBC Rule
+
+ However, a zero-length search pattern+ zero + */
+ QStringList stringlistSchemas = getSchemas( stringCatalog, "%" );
+
+ BOOLEAN bWildCard = ( getStatement()->getMetadataID() == SQL_FALSE );
+ QString stringWildCard = stringSchemaFilter;
+ QRegExp regexWildCard;
+ regexWildCard.setPatternSyntax( QRegExp::Wildcard );
+
+ if ( bWildCard )
+ regexWildCard.setPattern( stringWildCard.replace( '%', '*' ) );
+
+ for ( int n = 0; n < stringlistSchemas.count(); n++ )
+ {
+ BOOLEAN bMatch;
+
+ if ( stringSchemaFilter.isNull() )
+ bMatch = true;
+ else if ( bWildCard )
+ bMatch = regexWildCard.exactMatch( stringlistSchemas[n] );
+ else
+ bMatch = stringlistSchemas[n] == stringSchemaFilter;
+
+ if ( bMatch )
+ {
+ nReturn = doAppendSpecialColumnsTables( nIdentifierType, stringCatalog,
stringlistSchemas[n], stringTableFilter, nScope, nNullable );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ break;
+ }
+ }
+
+ MYODBCDbgReturn( nReturn );
+}
+
+SQLRETURN MResultPlus::doAppendSpecialColumnsTables( SQLSMALLINT nIdentifierType, const
QString &stringCatalog, const QString &stringSchema, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable )
+{
+ MYODBCDbgEnter();
+
+ SQLRETURN nReturn = SQL_SUCCESS;
+
+ /*!
+ \internal ODBC Rule
+
+ However, a zero-length search pattern+ zero + */
+ QStringList stringlistTables = getTables( stringCatalog, stringSchema, "%" );
+
+ /* setup regex as needed */
+ BOOLEAN bWildCard = ( getStatement()->getMetadataID() == SQL_FALSE );
+ QString stringWildCard = stringTableFilter;
+ QRegExp regexWildCard;
+ regexWildCard.setPatternSyntax( QRegExp::Wildcard );
+
+ if ( bWildCard )
+ regexWildCard.setPattern( stringWildCard.replace( '%', '*' ) );
+
+ for ( int n = 0; n < stringlistTables.count(); n++ )
+ {
+ BOOLEAN bMatch;
+
+ if ( stringTableFilter.isNull() )
+ bMatch = true;
+ else if ( bWildCard )
+ bMatch = regexWildCard.exactMatch( stringlistTables[n] );
+ else
+ bMatch = stringlistTables[n] == stringTableFilter;
+
+ if ( bMatch )
+ {
+ nReturn = doAppendSpecialColumnsColumns( nIdentifierType, stringCatalog,
stringSchema, stringlistTables[n], nScope, nNullable );
+ if ( !SQL_SUCCEEDED( nReturn ) )
+ break;
+ }
+ }
+
+ MYODBCDbgReturn( nReturn );
+}
+
+SQLRETURN MResultPlus::doAppendSpecialColumnsColumns( SQLSMALLINT nIdentifierType, const
QString &stringCatalog, const QString &stringSchema, const QString
&stringTable, SQLSMALLINT nScope, SQLSMALLINT nNullable )
+{
+ MYODBCDbgEnter();
+
+ SQLRETURN nReturn = SQL_SUCCESS;
+
+ MYODBCDbgReturn( nReturn );
+}
+
Modified: trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.h
===================================================================
--- trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.h 2006-06-27 16:21:52 UTC (rev 405)
+++ trunk/MYSQLPlus/MYSQLPlusLib/MResultPlus.h 2006-06-27 21:52:40 UTC (rev 406)
@@ -70,9 +70,9 @@
SQLRETURN doSkip( qlonglong nRows );
SQLRETURN doCommit();
- SQLRETURN doTables( const QString &stringCatalog, const QString
&stringSchema, const QString &stringTable, const QString &stringTableType );
- SQLRETURN doColumns( const QString &stringCatalog, const QString
&stringSchema, const QString &stringTable, const QString &stringColumn );
- SQLRETURN doSpecialColumns( SQLSMALLINT nIdentifierType, const QString
&stringCatalog, const QString &stringSchema, const QString &stringTable,
SQLSMALLINT nScope, SQLSMALLINT nNullable );
+ SQLRETURN doTables( const QString &stringCatalogFilter, const QString
&stringSchemaFilter, const QString &stringTableFilter, const QString
&stringTableTypeFilter );
+ SQLRETURN doColumns( const QString &stringCatalogFilter, const QString
&stringSchemaFilter, const QString &stringTableFilter, const QString
&stringColumnFilter );
+ SQLRETURN doSpecialColumns( SQLSMALLINT nIdentifierType, const QString
&stringCatalogFilter, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable );
/* isers */
BOOLEAN isValidRow();
@@ -180,6 +180,11 @@
SQLINTEGER nCharOctetLength,
SQLINTEGER nOrdinalPosition,
const QString &stringIsNullable );
+
+ SQLRETURN doAppendSpecialColumnsCatalogs( SQLSMALLINT nIdentifierType, const QString
&stringCatalogFilter, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable );
+ SQLRETURN doAppendSpecialColumnsSchemas( SQLSMALLINT nIdentifierType, const QString
&stringCatalog, const QString &stringSchemaFilter, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable );
+ SQLRETURN doAppendSpecialColumnsTables( SQLSMALLINT nIdentifierType, const QString
&stringCatalog, const QString &stringSchema, const QString
&stringTableFilter, SQLSMALLINT nScope, SQLSMALLINT nNullable );
+ SQLRETURN doAppendSpecialColumnsColumns( SQLSMALLINT nIdentifierType, const QString
&stringCatalog, const QString &stringSchema, const QString &stringTable,
SQLSMALLINT nScope, SQLSMALLINT nNullable );
};
#endif
| Thread |
|---|
| • Connector/ODBC 5 commit: r406 - trunk/MYSQLPlus/MYSQLPlusLib | pharvey | 27 Jun |