Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / docs / examples / sharding / insert_data.php
1 <?php
2 // insert_data.php
3 require_once "bootstrap.php";
4
5 $shardManager->selectShard(0);
6
7 $conn->insert("Products", array(
8     "ProductID" => 386,
9     "SupplierID" => 1001,
10     "ProductName" => 'Titanium Extension Bracket Left Hand',
11     "Price" => 5.25,
12 ));
13 $conn->insert("Products", array(
14     "ProductID" => 387,
15     "SupplierID" => 1001,
16     "ProductName" => 'Titanium Extension Bracket Right Hand',
17     "Price" => 5.25,
18 ));
19 $conn->insert("Products", array(
20     "ProductID" => 388,
21     "SupplierID" => 1001,
22     "ProductName" => 'Fusion Generator Module 5 kV',
23     "Price" => 10.50,
24 ));
25 $conn->insert("Products", array(
26     "ProductID" => 389,
27     "SupplierID" => 1001,
28     "ProductName" => 'Bypass Filter 400 MHz Low Pass',
29     "Price" => 10.50,
30 ));
31
32 $conn->insert("Customers", array(
33     'CustomerID' => 10,
34     'CompanyName' => 'Van Nuys',
35     'FirstName' => 'Catherine',
36     'LastName' => 'Abel',
37 ));
38 $conn->insert("Customers", array(
39     'CustomerID' => 20,
40     'CompanyName' => 'Abercrombie',
41     'FirstName' => 'Kim',
42     'LastName' => 'Branch',
43 ));
44 $conn->insert("Customers", array(
45     'CustomerID' => 30,
46     'CompanyName' => 'Contoso',
47     'FirstName' => 'Frances',
48     'LastName' => 'Adams',
49 ));
50 $conn->insert("Customers", array(
51     'CustomerID' => 40,
52     'CompanyName' => 'A. Datum Corporation',
53     'FirstName' => 'Mark',
54     'LastName' => 'Harrington',
55 ));
56 $conn->insert("Customers", array(
57     'CustomerID' => 50,
58     'CompanyName' => 'Adventure Works',
59     'FirstName' => 'Keith',
60     'LastName' => 'Harris',
61 ));
62 $conn->insert("Customers", array(
63     'CustomerID' => 60,
64     'CompanyName' => 'Alpine Ski House',
65     'FirstName' => 'Wilson',
66     'LastName' => 'Pais',
67 ));
68 $conn->insert("Customers", array(
69     'CustomerID' => 70,
70     'CompanyName' => 'Baldwin Museum of Science',
71     'FirstName' => 'Roger',
72     'LastName' => 'Harui',
73 ));
74 $conn->insert("Customers", array(
75     'CustomerID' => 80,
76     'CompanyName' => 'Blue Yonder Airlines',
77     'FirstName' => 'Pilar',
78     'LastName' => 'Pinilla',
79 ));
80 $conn->insert("Customers", array(
81     'CustomerID' => 90,
82     'CompanyName' => 'City Power & Light',
83     'FirstName' => 'Kari',
84     'LastName' => 'Hensien',
85 ));
86 $conn->insert("Customers", array(
87     'CustomerID' => 100,
88     'CompanyName' => 'Coho Winery',
89     'FirstName' => 'Peter',
90     'LastName' => 'Brehm',
91 ));
92
93 $conn->executeUpdate("
94     DECLARE @orderId INT
95
96     DECLARE @customerId INT
97
98     SET @orderId = 10
99     SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Hensien' and FirstName = 'Kari'
100
101     INSERT INTO Orders (CustomerId, OrderId, OrderDate)
102     VALUES (@customerId, @orderId, GetDate())
103
104     INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
105     VALUES (@customerId, @orderId, 388, 4)
106
107     SET @orderId = 20
108     SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Harui' and FirstName = 'Roger'
109
110     INSERT INTO Orders (CustomerId, OrderId, OrderDate)
111     VALUES (@customerId, @orderId, GetDate())
112
113     INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
114     VALUES (@customerId, @orderId, 389, 2)
115
116     SET @orderId = 30
117     SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Brehm' and FirstName = 'Peter'
118
119     INSERT INTO Orders (CustomerId, OrderId, OrderDate)
120     VALUES (@customerId, @orderId, GetDate())
121
122     INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
123     VALUES (@customerId, @orderId, 387, 3)
124
125     SET @orderId = 40
126     SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Pais' and FirstName = 'Wilson'
127
128     INSERT INTO Orders (CustomerId, OrderId, OrderDate)
129     VALUES (@customerId, @orderId, GetDate())
130
131     INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
132     VALUES (@customerId, @orderId, 388, 1)");