protected override string GetMetadataCollectionName(DataAccessMetadataType metadataType) { switch (metadataType) { case DataAccessMetadataType.Tables: return(SQLiteMetaDataCollectionNames.Tables); case DataAccessMetadataType.TableColumns: return(SQLiteMetaDataCollectionNames.Columns); case DataAccessMetadataType.Views: return(SQLiteMetaDataCollectionNames.Views); case DataAccessMetadataType.ViewColumns: return(SQLiteMetaDataCollectionNames.ViewColumns); case DataAccessMetadataType.Procedures: throw new NotSupportedException("SQLite does not natively support stored procedures."); case DataAccessMetadataType.ProcedureParameters: throw new NotSupportedException("SQLite does not natively support stored procedures."); default: throw new NotSupportedException(); } }
protected override string GetMetadataCollectionName(DataAccessMetadataType metadataType) { //NOTE: MySql.Data.MySqlClient does not provide the MetaDataCollectionNames class, so the strings are hardcoded here instead. // The supported strings are documented at http://dev.mysql.com/doc/connector-net/en/connector-net-programming-getschema-collections.html, // but for some reason the Connector/Net developers missed the boat on this class that seems to exist in every other ADO.NET provider. // Oh well, life sucks. Whatcha gonna do... switch (metadataType) { case DataAccessMetadataType.Tables: return("Tables"); case DataAccessMetadataType.TableColumns: return("Columns"); case DataAccessMetadataType.Views: return("Views"); case DataAccessMetadataType.ViewColumns: return("ViewColumns"); case DataAccessMetadataType.Procedures: return("Procedures"); case DataAccessMetadataType.ProcedureParameters: return("Procedure Parameters"); default: throw new NotSupportedException(); } }
protected override string GetMetadataCollectionName(DataAccessMetadataType metadataType) { switch (metadataType) { case DataAccessMetadataType.Tables: return(SqlClientMetaDataCollectionNames.Tables); case DataAccessMetadataType.TableColumns: return(SqlClientMetaDataCollectionNames.Columns); case DataAccessMetadataType.Views: return(SqlClientMetaDataCollectionNames.Views); case DataAccessMetadataType.ViewColumns: return(SqlClientMetaDataCollectionNames.ViewColumns); case DataAccessMetadataType.Procedures: return(SqlClientMetaDataCollectionNames.Procedures); case DataAccessMetadataType.ProcedureParameters: //return SqlClientMetaDataCollectionNames.Parameters; return("ProcedureParameters"); //Apparently, the built in value "Parameters" does not work but this does... default: throw new NotSupportedException(); } }
protected override string GetMetadataCollectionName(DataAccessMetadataType metadataType) { switch (metadataType) { case DataAccessMetadataType.Tables: return(OleDbMetaDataCollectionNames.Tables); case DataAccessMetadataType.TableColumns: return(OleDbMetaDataCollectionNames.Columns); case DataAccessMetadataType.Views: return(OleDbMetaDataCollectionNames.Views); case DataAccessMetadataType.ViewColumns: return(OleDbMetaDataCollectionNames.Columns); case DataAccessMetadataType.Procedures: return(OleDbMetaDataCollectionNames.Procedures); case DataAccessMetadataType.ProcedureParameters: return(OleDbMetaDataCollectionNames.ProcedureParameters); default: throw new NotSupportedException(); } }
private DataTable zGetMetadata(DataAccessMetadataType metadataType, string database, string schema, string schemaObject, string schemaSubObject) { string metadataCollectionName = GetMetadataCollectionName(metadataType); string[] restrictionValues = GetMetadataRestrictions(metadataType, database, schema, schemaObject, schemaSubObject); if (m_Connection.State == ConnectionState.Closed) { m_Connection.Open(); } return(m_Connection.GetSchema(metadataCollectionName, restrictionValues)); }
protected override string[] GetMetadataRestrictions(DataAccessMetadataType metadataType, string database, string schema, string schemaObject, string schemaSubObject) { switch (metadataType) { case DataAccessMetadataType.Tables: return(new string[] { database, schema, schemaObject, "BASE TABLE" }); case DataAccessMetadataType.TableColumns: return(new string[] { database, schema, schemaObject, schemaSubObject }); case DataAccessMetadataType.Views: return(new string[] { database, schema, schemaObject }); case DataAccessMetadataType.ViewColumns: return(new string[] { database, schema, schemaObject, schemaSubObject }); case DataAccessMetadataType.Procedures: return(new string[] { database, schema, schemaObject, "PROCEDURE" }); case DataAccessMetadataType.ProcedureParameters: return(new string[] { database, schema, schemaObject, "PROCEDURE", schemaSubObject }); default: throw new NotSupportedException(); } }
public DataAccessMetadata GetMetadata(DataAccessMetadataType metadataType, string database = null, string schema = null, string schemaObject = null, string schemaSubObject = null) { DataTable metadataTable = zGetMetadata(metadataType, database, schema, schemaObject, schemaSubObject); DataAccessMetadata metadata = new DataAccessMetadata(); foreach (DataRow row in metadataTable.Rows) { switch (metadataType) { case DataAccessMetadataType.Tables: metadata.Tables.Add(Table.FromRow(row)); break; case DataAccessMetadataType.TableColumns: metadata.TableColumns.Add(Column.FromRow(row)); break; case DataAccessMetadataType.Views: metadata.Views.Add(View.FromRow(row)); break; case DataAccessMetadataType.ViewColumns: metadata.ViewColumns.Add(Column.FromRow(row)); break; case DataAccessMetadataType.Procedures: metadata.Procedures.Add(Procedure.FromRow(row)); break; case DataAccessMetadataType.ProcedureParameters: metadata.ProcedureParameters.Add(ProcedureParameter.FromRow(row)); break; } } return(metadata); }
protected abstract string[] GetMetadataRestrictions(DataAccessMetadataType metadataType, string database, string schema, string schemaObject, string schemaSubObject);
protected abstract string GetMetadataCollectionName(DataAccessMetadataType metadataType);