Browse Source

* Implemented GetTableNames, systemtables=true, bug #13893, by Ladislav Karrach

git-svn-id: trunk@15498 -
joost 15 years ago
parent
commit
c58e26e25a
1 changed files with 6 additions and 2 deletions
  1. 6 2
      packages/fcl-db/src/sqldb/odbc/odbcconn.pas

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

@@ -646,6 +646,9 @@ begin
 end;
 end;
 
 
 procedure TODBCConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
 procedure TODBCConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
+const
+  TABLE_TYPE_USER='TABLE,VIEW,GLOBAL TEMPORARY,LOCAL TEMPORARY'; //no spaces before/after comma
+  TABLE_TYPE_SYSTEM='SYSTEM TABLE';
 var
 var
   ODBCCursor:TODBCCursor;
   ODBCCursor:TODBCCursor;
   Res:SQLRETURN;
   Res:SQLRETURN;
@@ -658,7 +661,8 @@ begin
   // execute the statement
   // execute the statement
   case ODBCCursor.FSchemaType of
   case ODBCCursor.FSchemaType of
     stNoSchema  : Res:=SQLExecute(ODBCCursor.FSTMTHandle); //SQL_NO_DATA returns searched update or delete statement that does not affect any rows
     stNoSchema  : Res:=SQLExecute(ODBCCursor.FSTMTHandle); //SQL_NO_DATA returns searched update or delete statement that does not affect any rows
-    stTables    : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, nil, 0 );
+    stTables    : Res:=SQLTables (ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0, TABLE_TYPE_USER, length(TABLE_TYPE_USER) );
+    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 );
     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 );
     stProcedures: Res:=SQLProcedures(ODBCCursor.FSTMTHandle, nil, 0, nil, 0, nil, 0 );
     else          Res:=SQL_NO_DATA;
     else          Res:=SQL_NO_DATA;
@@ -1302,7 +1306,7 @@ begin
     Result := SchemaObjectName
     Result := SchemaObjectName
   else
   else
     Result := ' ';
     Result := ' ';
-  if not (SchemaType in [stNoSchema, stTables, stColumns, stProcedures]) then
+  if not (SchemaType in [stNoSchema, stTables, stSysTables, stColumns, stProcedures]) then
     DatabaseError(SMetadataUnavailable);
     DatabaseError(SMetadataUnavailable);
 end;
 end;