public static void Config(TestContext context) { // <system.data> // <DbProviderFactories> // <add // name="Firebird Data Provider" // invariant="FirebirdSql.Data.FirebirdClient" description="Firebird" // type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.5.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" // /> // </DbProviderFactories> // </system.data> ProviderChecker.Check(ProviderName, ConnectionString); }
public void SybaseUltraLiteTest() { const string providername = "iAnyWhere.Data.UltraLite"; //default sample location on Windows 7 //In .Net 4 this isn't added to machine.config, so add the DbProvider in app.config const string connectionString = @"DBF=C:\Users\Public\Documents\SQL Anywhere 12\Samples\UltraLite.NET\CustDB\custdb.udb"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void MySqlSchemasTest() { const string providername = "MySql.Data.MySqlClient"; var connectionString = ConnectionStrings.MySql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "sakila"; var schemas = dbReader.AllSchemas(); Assert.IsTrue(schemas.Count > 0, "Schemas should contain sakila"); }
public void SybaseAnyWhereTest() { const string providername = "iAnyWhere.Data.SQLAnyWhere"; const string connectionString = "Data Source=SQL Anywhere 12 Demo"; ProviderChecker.Check(providername, connectionString); DiscoverProviderFactory.Discover(connectionString, providername); var dbReader = new DatabaseReader(connectionString, providername, 0); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void MySqlTableTest() { const string providername = "MySql.Data.MySqlClient"; var connectionString = ConnectionStrings.MySql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var country = dbReader.Table("country"); Assert.AreEqual(3, country.Columns.Count); Assert.IsNotNull(country.PrimaryKeyColumn); Assert.IsTrue(country.FindColumn("country_id").IsPrimaryKey); }
public void SybaseAseTest() { //using pubs3 with default sa account with Ase Developer Edition 15 on localhost (had to use IP address to get it to connect) const string providername = "Sybase.Data.AseClient"; const string connectionString = "Server=192.168.1.100;Port=5000;Uid=sa;Pwd='';Initial Catalog=pubs3"; ProviderChecker.Check(providername, connectionString); DatabaseSchemaReader.Utilities.DiscoverProviderFactory.Discover(connectionString, providername); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void VistaDbTest() { //using VistaDb 4.2.18.4 (trial) with samples in default location const string providername = "System.Data.VistaDB"; const string connectionString = @"Data Source='C:\Users\Public\Documents\VistaDB\Databases\TicketSystemSample.vdb4'"; ProviderChecker.Check(providername, connectionString); //DatabaseSchemaReader.Utilities.DiscoverProviderFactory.Discover(connectionString, providername); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void TestNpgsql() { //using the MySql world database ported to Postgres const string providername = "Npgsql"; var connectionString = ConnectionStrings.PostgreSql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "public"; //otherwise you have "postgres" owned tables and views var schema = dbReader.ReadAll(); var country = schema.FindTableByName("country"); Assert.IsTrue(country.Columns.Count > 0); }
public void TestNpgsql() { //using the MySql world database ported to Postgres const string providername = "Npgsql"; const string connectionString = @"Server=127.0.0.1;User id=postgres;password=sql;database=world;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "public"; //otherwise you have "postgres" owned tables and views var schema = dbReader.ReadAll(); var orders = schema.FindTableByName("country"); Assert.AreEqual(15, orders.Columns.Count); }
public void TestDevartPostgreSql() { //http://www.devart.com/dotconnect/postgresql/docs/MetaData.html const string providername = "Devart.Data.PostgreSql"; var connectionString = ConnectionStrings.PostgreSql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "public"; //otherwise you have "postgres" owned tables and views var schema = dbReader.ReadAll(); var country = schema.FindTableByName("country"); Assert.IsTrue(country.Columns.Count > 0); }
public void MySqlTest() { const string providername = "MySql.Data.MySqlClient"; const string connectionString = @"Server=localhost;Uid=root;Pwd=mysql;Database=sakila;Allow User Variables=True;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); var orders = schema.FindTableByName("country"); Assert.AreEqual(3, orders.Columns.Count); var table = dbReader.Table("city"); Assert.AreEqual(4, table.Columns.Count); }
public void TestDevartPostgreSql() { //http://www.devart.com/dotconnect/postgresql/docs/MetaData.html const string providername = "Devart.Data.PostgreSql"; const string connectionString = @"Server=127.0.0.1;User id=postgres;password=sql;database=world;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "public"; //otherwise you have "postgres" owned tables and views var schema = dbReader.ReadAll(); var orders = schema.FindTableByName("country"); Assert.AreEqual(15, orders.Columns.Count); }
public void SqlServerAdventureWorks() { const string providername = "System.Data.SqlClient"; const string connectionString = @"Data Source=.\SQLEXPRESS;Integrated Security=true;Initial Catalog=AdventureWorks"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); var product = schema.FindTableByName("Product"); Assert.IsTrue(product.Columns.Count >= 17); //different versions of AdventureWorks have different # columns var table = dbReader.Table("Product"); Assert.IsTrue(table.Columns.Count >= 17); }
public void SqlServerCe4Test() { if (!File.Exists(FilePath)) { Assert.Inconclusive("SqlServerCe4 test requires database file " + FilePath); } const string connectionString = "Data Source=\"" + FilePath + "\""; ProviderChecker.Check(ProviderName, connectionString); var dbReader = new DatabaseReader(connectionString, ProviderName); var schema = dbReader.ReadAll(); var orders = schema.FindTableByName("Orders"); Assert.IsTrue(orders.Columns.Count > 2); //we don't care if it's not standard Northwind }
public void DevartSqlServer() { const string providername = "Devart.Data.SqlServer"; const string connectionString = @"Data Source=localhost\SQLEXPRESS;Integrated Security=true;Initial Catalog=AdventureWorks"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); var schema = dbReader.ReadAll(); var product = schema.FindTableByName("Product"); Assert.AreEqual(25, product.Columns.Count); var table = dbReader.Table("Product"); Assert.AreEqual(25, table.Columns.Count); }
public void DataDirectSqlServer() { //not sql express const string providername = "DDTek.SQLServer"; const string connectionString = @"Server=localhost;AuthenticationMethod=NTLM;DatabaseName=AdventureWorks"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); var schema = dbReader.ReadAll(); var product = schema.FindTableByName("Product"); Assert.AreEqual(25, product.Columns.Count); var table = dbReader.Table("Product"); Assert.AreEqual(25, table.Columns.Count); }
public void MySqlTest() { const string providername = "MySql.Data.MySqlClient"; var connectionString = ConnectionStrings.MySql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); var country = schema.FindTableByName("country"); Assert.AreEqual(3, country.Columns.Count); Assert.IsNotNull(country.PrimaryKeyColumn); var table = dbReader.Table("city"); Assert.AreEqual(4, table.Columns.Count); }
public void DevartOracle() { const string providername = "Devart.Data.Oracle"; const string connectionString = "Server=localhost;Sid=XE;Port=1521;Direct=true;User Id=hr;Password=hr;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); dbReader.Owner = "HR"; var schema = dbReader.ReadAll(); var employees = schema.FindTableByName("EMPLOYEES"); Assert.AreEqual(11, employees.Columns.Count); var table = dbReader.Table("EMPLOYEES"); Assert.AreEqual(11, table.Columns.Count); }
public void MySqlUnsignedIntegersTest() { const string providername = "MySql.Data.MySqlClient"; var connectionString = ConnectionStrings.MySql; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); var country = schema.FindTableByName("country"); var pk = country.PrimaryKeyColumn; Assert.IsNotNull(pk, "Primary key constraints should be loaded"); Assert.AreEqual(pk.DbDataType, "smallint(5) unsigned"); Assert.AreEqual(pk.DataType.TypeName, "SMALLINT"); }
public void DataDirectOracle() { const string providername = "DDTek.Oracle"; const string connectionString = "Host=localhost;Service Name=XE;User Id=HR;Password=HR;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); dbReader.Owner = "HR"; var schema = dbReader.ReadAll(); var employees = schema.FindTableByName("EMPLOYEES"); Assert.AreEqual(11, employees.Columns.Count); var table = dbReader.Table("EMPLOYEES"); Assert.AreEqual(11, table.Columns.Count); }
public void ReadNorthwindUsingOdbc() { //you'll get much more information from System.Data.SqlClient const string providername = "System.Data.Odbc"; const string connectionString = @"Driver={SQL Server};Server=.\SQLEXPRESS;Database=Northwind;Trusted_Connection=Yes;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername) { Owner = "dbo" }; //this is slow because it pulls in sp_ stored procedures and system views. dbReader.Exclusions.StoredProcedureFilter = new PrefixFilter("sp_", "fn_", "dm_", "xp_"); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void OleDb() { const string providername = "System.Data.OleDb"; const string connectionString = "Provider=msdaora;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)));User Id=hr;Password=hr;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "HR"; var schema = dbReader.ReadAll(); var employees = schema.FindTableByName("EMPLOYEES"); Assert.AreEqual(11, employees.Columns.Count); var table = dbReader.Table("EMPLOYEES"); Assert.AreEqual(11, table.Columns.Count); }
public void Oracle() { const string providername = "System.Data.OracleClient"; const string connectionString = ConnectionStrings.OracleHr; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "HR"; var schema = dbReader.ReadAll(); var employees = schema.FindTableByName("EMPLOYEES"); Assert.AreEqual(11, employees.Columns.Count); var table = dbReader.Table("EMPLOYEES"); Assert.AreEqual(11, table.Columns.Count); }
public void SqlLiteTest() { const string providername = "System.Data.SQLite"; var dir = ConnectionStrings.SqLiteFilePath; if (!File.Exists(dir)) { Assert.Inconclusive("SqlLite test requires database file " + dir); } string connectionString = @"Data Source=" + dir; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername, 0); var schema = dbReader.ReadAll(); var orders = schema.FindTableByName("Orders"); Assert.IsTrue(orders.Columns.Count > 2); //we don't care if it's not standard Northwind }
public void MySqlViaDevartTest() { const string providername = "Devart.Data.MySql"; var connectionString = ConnectionStrings.MySqlDevart; ProviderChecker.Check(providername, connectionString); DatabaseSchemaReader.Utilities.DiscoverProviderFactory.Discover(connectionString, providername); var dbReader = new DatabaseReader(connectionString, providername); dbReader.Owner = "sakila"; var schema = dbReader.ReadAll(); var country = schema.FindTableByName("country"); Assert.AreEqual(3, country.Columns.Count); Assert.IsNotNull(country.PrimaryKeyColumn); var table = dbReader.Table("city"); Assert.AreEqual(4, table.Columns.Count); }
public void CacheTest() { // <system.data> // <DbProviderFactories> //<add name="InterSystems Data Provider" // invariant="InterSystems.Data.CacheClient" // description="InterSystem .Net Data Provider" // type="InterSystems.Data.CacheClient.CacheFactory, // Intersystems.Data.CacheClient, Version=2.0.0.1, Culture=neutral, PublicKeyToken=ad350a26c4a4447c" // /> // </DbProviderFactories> // </system.data> const string providername = "InterSystems.Data.CacheClient"; const string connectionString = "Server=localhost; Port=1972; Namespace=SAMPLES;Password=SYS; User ID=_SYSTEM;"; ProviderChecker.Check(providername, connectionString); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); Assert.IsTrue(schema.Tables.Count > 0); }
public void TestAccess2007() { const string providername = "System.Data.OleDb"; const string dir = @"C:\Data\Nwind.accdb"; if (!File.Exists(dir)) { Assert.Inconclusive("Access test requires database file " + dir); } const string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dir; ProviderChecker.Check(providername, connectionString); DiscoverProviderFactory.Discover(connectionString, providername); var dbReader = new DatabaseReader(connectionString, providername); var schema = dbReader.ReadAll(); var table = schema.FindTableByName("Products"); Assert.IsTrue(table.Columns.Count > 0); }