Browse Source

fcl-db: odbc: add support for stIndexes for database metadata retrieval SetSchemaInfo()

git-svn-id: trunk@31225 -
lacak 10 years ago
parent
commit
3d6a6512ad
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas

+ 3 - 2
packages/fcl-db/src/sqldb/odbc/odbcconn.pas

@@ -757,7 +757,7 @@ begin
 
   // prepare statement
   ODBCCursor.FQuery:=Buf;
-  if not (ODBCCursor.FSchemaType in [stTables, stSysTables, stColumns, stProcedures]) then
+  if not (ODBCCursor.FSchemaType in [stTables, stSysTables, stColumns, stProcedures, stIndexes]) then
     begin
       ODBCCheckResult(
         SQLPrepare(ODBCCursor.FSTMTHandle, PChar(buf), Length(buf)),
@@ -855,6 +855,7 @@ begin
       stSysTables : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, TABLE_TYPE_SYSTEM, length(TABLE_TYPE_SYSTEM) );
       stColumns   : Res:=SQLColumns(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, @ODBCCursor.FQuery[1], length(ODBCCursor.FQuery), nil, 0 );
       stProcedures: Res:=SQLProcedures(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0 );
+      stIndexes   : Res:=SQLStatistics(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, @ODBCCursor.FQuery[1], length(ODBCCursor.FQuery), SQL_INDEX_ALL, SQL_QUICK);
       else          Res:=SQLExecute(ODBCCursor.FSTMTHandle); //SQL_NO_DATA returns searched update or delete statement that does not affect any rows
     end; {case}
 
@@ -1531,7 +1532,7 @@ end;
 
 function TODBCConnection.GetSchemaInfoSQL(SchemaType: TSchemaType; SchemaObjectName, SchemaObjectPattern: string): string;
 begin
-  if SchemaType in [stTables, stSysTables, stColumns, stProcedures] then
+  if SchemaType in [stTables, stSysTables, stColumns, stProcedures, stIndexes] then
   begin
     if SchemaObjectName<>'' then
       Result := SchemaObjectName