@@ -44,7 +44,7 @@ Feature: Schema Metadata
44
44
replicate_on_write='false';
45
45
"""
46
46
47
- Scenario : Keyspace metadata will exist for all major Cassandra versions
47
+ Scenario : Getting keyspace metadata
48
48
Given the following example:
49
49
"""php
50
50
<?php
@@ -72,7 +72,7 @@ Feature: Schema Metadata
72
72
Has Durable Writes: False
73
73
"""
74
74
75
- Scenario : Table metadata will exist for all major Cassandra versions
75
+ Scenario : Getting table metadata
76
76
Given the following example:
77
77
"""php
78
78
<?php
@@ -86,11 +86,7 @@ Feature: Schema Metadata
86
86
87
87
echo "Name: " . $table->name() . "\n";
88
88
echo "Bloom Filter: " . $table->bloomFilterFPChance() . "\n";
89
- $patterns = array();
90
- $patterns[0] = '/{/';
91
- $patterns[1] = '/"/';
92
- $patterns[2] = '/:/';
93
- $patterns[3] = '/keys/';
89
+ $patterns = array('/{/', '/"/', '/:/', '/keys/');
94
90
$table_caching = explode(",", $table->caching());
95
91
echo "Caching: " . preg_replace($patterns, "", $table_caching[0]) . "\n";
96
92
echo "Comment: " . $table->comment() . "\n";
@@ -121,8 +117,7 @@ Feature: Schema Metadata
121
117
"""
122
118
123
119
@cassandra-version-less-2.1
124
- Scenario : Additional table metadata will only exist for Cassandra versions
125
- 1.2 and v2.0
120
+ Scenario : Getting table metadata for io cache and replicate on write
126
121
Given the following example:
127
122
"""php
128
123
<?php
@@ -145,8 +140,7 @@ Feature: Schema Metadata
145
140
"""
146
141
147
142
@cassandra-version-only-2.0
148
- Scenario : Additional table metadata will only exist for Cassandra versions
149
- 2.0
143
+ Scenario : Getting table metadata for index interval
150
144
Given the following example:
151
145
"""php
152
146
<?php
@@ -168,8 +162,8 @@ Feature: Schema Metadata
168
162
"""
169
163
170
164
@cassandra-version-2.0
171
- Scenario : Additional table metadata will only exist for Cassandra versions
172
- 2.0+
165
+ Scenario : Getting table metadata for default TTL, memtable flush period and
166
+ speculative retry
173
167
Given the following example:
174
168
"""php
175
169
<?php
@@ -197,8 +191,7 @@ Feature: Schema Metadata
197
191
"""
198
192
199
193
@cassandra-version-2.1
200
- Scenario : Additional table metadata will only exist for Cassandra versions
201
- 2.1+
194
+ Scenario : Getting table metadata for max and min index intervals
202
195
Given the following example:
203
196
"""php
204
197
<?php
@@ -223,8 +216,7 @@ Feature: Schema Metadata
223
216
"""
224
217
225
218
@cassandra-version-2.0
226
- Scenario : Data types can be determined by the column metadata for Cassandra
227
- versions 2.0+
219
+ Scenario : Getting metadata for column and types
228
220
Given the following example:
229
221
"""php
230
222
<?php
@@ -234,63 +226,29 @@ Feature: Schema Metadata
234
226
$session = $cluster->connect("simplex");
235
227
$schema = $session->schema();
236
228
$table = $schema->keyspace("simplex")->table("values");
237
- $id = $table->column("id")->type();
238
- $bigint = $table->column("bigint_value")->type();
239
- $decimal = $table->column("decimal_value")->type();
240
- $double = $table->column("double_value")->type();
241
- $float = $table->column("float_value")->type();
242
- $int = $table->column("int_value")->type();
243
- $varint = $table->column("varint_value")->type();
244
- $ascii = $table->column("ascii_value")->type();
245
- $text = $table->column("text_value")->type();
246
- $varchar = $table->column("varchar_value")->type();
247
- $timestamp = $table->column("timestamp_value")->type();
248
- $blob = $table->column("blob_value")->type();
249
- $uuid = $table->column("uuid_value")->type();
250
- $timeuuid = $table->column("timeuuid_value")->type();
251
- $inet = $table->column("inet_value")->type();
252
- $list = $table->column("list_value")->type();
253
- $map = $table->column("map_value")->type();
254
- $set = $table->column("set_value")->type();
255
-
256
- echo $id . "\n";
257
- echo $bigint . "\n";
258
- echo $decimal . "\n";
259
- echo $double . "\n";
260
- echo $float . "\n";
261
- echo $int . "\n";
262
- echo $varint . "\n";
263
- echo $ascii . "\n";
264
- echo $text . "\n";
265
- echo $varchar . "\n";
266
- echo $timestamp . "\n";
267
- echo $blob . "\n";
268
- echo $uuid . "\n";
269
- echo $timeuuid . "\n";
270
- echo $inet . "\n";
271
- echo $list . "\n";
272
- echo $map . "\n";
273
- echo $set . "\n";
229
+ foreach ($table->columns() as $column) {
230
+ echo $column->name() . ': ' . $column->type();
231
+ }
274
232
"""
275
233
When it is executed
276
234
Then its output should contain:
277
235
"""
278
- int
279
- bigint
280
- decimal
281
- double
282
- float
283
- int
284
- varint
285
- ascii
286
- varchar
287
- varchar
288
- timestamp
289
- blob
290
- uuid
291
- timeuuid
292
- inet
293
- list<varchar >
294
- map<timestamp, double>
295
- set<float>
236
+ id: int
237
+ bigint_value: bigint
238
+ decimal_value: decimal
239
+ double_value: double
240
+ float_value: float
241
+ int_value: int
242
+ varint_value: varint
243
+ ascii_value: ascii
244
+ text_value: varchar
245
+ varchar_value: varchar
246
+ timestamp_value: timestamp
247
+ blob_value: blob
248
+ uuid_value: uuid
249
+ timeuuid_value: timeuuid
250
+ inet_value: inet
251
+ list_value: list<text >
252
+ map_value: map<timestamp, double>
253
+ set_value: set<float>
296
254
"""
0 commit comments