@@ -46,7 +46,7 @@ To fetch records from InfluxDB you can do a query directly on a database:
46
46
47
47
``` php
48
48
49
- // fetch the selectDB
49
+ // fetch the database
50
50
$database = $client->selectDB('influx_test_db');
51
51
52
52
// executing a query will yield a resultset object
@@ -84,24 +84,25 @@ Writing data is done by providing an array of points to the writePoints method o
84
84
85
85
``` php
86
86
87
- $newPoints = $database->writePoints(
88
- array(
89
- new Point(
90
- 'test_metric',
91
- 0.64,
92
- array('host' => 'server01', 'region' => 'us-west'),
93
- array('cpucount' => 10),
94
- 1435255849
95
- ),
96
- new Point(
97
- 'test_metric',
98
- 0.84,
99
- array('host' => 'server01', 'region' => 'us-west'),
100
- array('cpucount' => 10),
101
- 1435255850
102
- )
87
+ // create an array of points
88
+ $points = array(
89
+ new Point(
90
+ 'test_metric',
91
+ 0.64,
92
+ array('host' => 'server01', 'region' => 'us-west'),
93
+ array('cpucount' => 10),
94
+ 1435255849
95
+ ),
96
+ new Point(
97
+ 'test_metric',
98
+ 0.84,
99
+ array('host' => 'server01', 'region' => 'us-west'),
100
+ array('cpucount' => 10),
101
+ 1435255850
103
102
)
104
103
);
104
+
105
+ $newPoints = $database->writePoints($points);
105
106
106
107
```
107
108
@@ -123,7 +124,7 @@ This library makes it easy to provide a retention policy when creating a databas
123
124
// create the client
124
125
$client = new \InfluxDB\Client($host, $port, '', '');
125
126
126
- // select the selectDB
127
+ // select the database
127
128
$database = $client->selectDB('influx_test_db');
128
129
129
130
// create the database with a retention policy
@@ -143,6 +144,12 @@ and list them:
143
144
$result = $database->listRetentionPolicies();
144
145
```
145
146
147
+ You can add more retention policies to a database:
148
+
149
+ ``` php
150
+ $result = $database->createRetentionPolicy(new RetentionPolicy('test2', '30d', 1, true));
151
+ ```
152
+
146
153
### Client functions
147
154
148
155
Some functions are too general for a database. So these are available in the client:
0 commit comments