tbrugz avatar tbrugz committed cda2803

dbms: MSAccess: changes in getTables(), added methods returning 'EmptyResultSet'

Comments (0)

Files changed (1)

src/tbrugz/sqldump/dbmsfeatures/MSAccessDatabaseMetaData.java

 import org.apache.commons.logging.LogFactory;
 
 import tbrugz.sqldump.def.AbstractDatabaseMetaDataDecorator;
+import tbrugz.sqldump.resultset.EmptyResultSet;
 
 public class MSAccessDatabaseMetaData extends AbstractDatabaseMetaDataDecorator {
 
 		return null;
 	}
 	
+	/*
+	
+	MSysObjects: type:
+	1 - Table / System Table
+	3? - system tables?
+	5 - Query (View...)
+	8 - Relationship
+	-32768 - Form
+	-32766 - Macro
+	-32764 - Report
+	-32761 - Module
+	-32756 - Pages
+	
+	*/
+	
 	@Override
 	public ResultSet getTables(String catalog, String schemaPattern,
 			String tableNamePattern, String[] types) throws SQLException {
 		Connection conn = metadata.getConnection();
 		
 		String sql = "select null as TABLE_CAT, null as TABLE_SCHEM, name as TABLE_NAME, '' as REMARKS, "
-				+"iif([Flags] = 0, 'TABLE', 'SYSTEM TABLE') as TABLE_TYPE\n"
-				//+"[Type] as TABLE_TYPE\n"
+				+"iif([Type] = 5, 'VIEW', iif([Flags] = 0, 'TABLE', 'SYSTEM TABLE')) as TABLE_TYPE\n"
+				//+"iif([Flags] = 0, 'TABLE', 'SYSTEM TABLE') as TABLE_TYPE\n"
 				+"from [MSysObjects] "
-				+"where [Type] = 1 "
+				+"where [Type] in ( 1 , 5 ) "
 				+"order by [Type], [Name]";
 		PreparedStatement st = conn.prepareStatement(sql);
 		log.debug("sql:\n"+sql);
 		return st.executeQuery();
 	}
 	
-	@Override
+	/*@Override
 	public ResultSet getColumns(String catalog, String schemaPattern,
 			String tableNamePattern, String columnNamePattern)
 			throws SQLException {
-		log.info("getColumns() from: "+tableNamePattern); 
+		//log.info("getColumns() from: "+tableNamePattern); 
 		//return null;
 		return super.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern);
-	}
+	}*/
 	
+	//TODO: add getPrimaryKeys()
 	@Override
 	public ResultSet getPrimaryKeys(String catalog, String schema, String table)
 			throws SQLException {
+		return new EmptyResultSet();
 		//return null;
-		return super.getPrimaryKeys(catalog, schema, table);
+		//return super.getPrimaryKeys(catalog, schema, table);
+	}
+
+	//TODO: getImportedKeys() (& getExportedKeys()?)
+	@Override
+	public ResultSet getImportedKeys(String catalog, String schema, String table)
+			throws SQLException {
+		return new EmptyResultSet();
+	}
+	
+	//TODO: getTablePrivileges()
+	@Override
+	public ResultSet getTablePrivileges(String catalog, String schemaPattern,
+			String tableNamePattern) throws SQLException {
+		return new EmptyResultSet();
 	}
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.