X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FSharding%2FSQLAzure%2FAbstractTestCase.php;fp=vendor%2Fdoctrine%2Fdbal%2Ftests%2FDoctrine%2FTests%2FDBAL%2FSharding%2FSQLAzure%2FAbstractTestCase.php;h=ccf185c509b66e5c3d41894a9fde77d7920cb919;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php new file mode 100644 index 0000000..ccf185c --- /dev/null +++ b/vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php @@ -0,0 +1,82 @@ +markTestSkipped('No driver or sqlserver driver specified.'); + } + + $params = array( + 'driver' => $GLOBALS['db_type'], + 'dbname' => $GLOBALS['db_name'], + 'user' => $GLOBALS['db_username'], + 'password' => $GLOBALS['db_password'], + 'host' => $GLOBALS['db_host'], + 'sharding' => array( + 'federationName' => 'Orders_Federation', + 'distributionKey' => 'CustID', + 'distributionType' => 'integer', + 'filteringEnabled' => false, + ), + 'driverOptions' => array('MultipleActiveResultSets' => false) + ); + $this->conn = DriverManager::getConnection($params); + // assume database is created and schema is: + // Global products table + // Customers, Orders, OrderItems federation tables. + // See http://cloud.dzone.com/articles/using-sql-azure-federations + $this->sm = new SQLAzureShardManager($this->conn); + } + + public function createShopSchema() + { + $schema = new Schema(); + + $products = $schema->createTable('Products'); + $products->addColumn('ProductID', 'integer'); + $products->addColumn('SupplierID', 'integer'); + $products->addColumn('ProductName', 'string'); + $products->addColumn('Price', 'decimal', array('scale' => 2, 'precision' => 12)); + $products->setPrimaryKey(array('ProductID')); + $products->addOption('azure.federated', true); + + $customers = $schema->createTable('Customers'); + $customers->addColumn('CustomerID', 'integer'); + $customers->addColumn('CompanyName', 'string'); + $customers->addColumn('FirstName', 'string'); + $customers->addColumn('LastName', 'string'); + $customers->setPrimaryKey(array('CustomerID')); + $customers->addOption('azure.federated', true); + $customers->addOption('azure.federatedOnColumnName', 'CustomerID'); + + $orders = $schema->createTable('Orders'); + $orders->addColumn('CustomerID', 'integer'); + $orders->addColumn('OrderID', 'integer'); + $orders->addColumn('OrderDate', 'datetime'); + $orders->setPrimaryKey(array('CustomerID', 'OrderID')); + $orders->addOption('azure.federated', true); + $orders->addOption('azure.federatedOnColumnName', 'CustomerID'); + + $orderItems = $schema->createTable('OrderItems'); + $orderItems->addColumn('CustomerID', 'integer'); + $orderItems->addColumn('OrderID', 'integer'); + $orderItems->addColumn('ProductID', 'integer'); + $orderItems->addColumn('Quantity', 'integer'); + $orderItems->setPrimaryKey(array('CustomerID', 'OrderID', 'ProductID')); + $orderItems->addOption('azure.federated', true); + $orderItems->addOption('azure.federatedOnColumnName', 'CustomerID'); + + return $schema; + } +}