Skip to content

Commit

Permalink
updatet to 2.1.6 (#187)
Browse files Browse the repository at this point in the history
* update feature

* update to 2.1.6

Co-authored-by: lewzylu <[email protected]>
  • Loading branch information
lewzylu and lewzylu authored May 11, 2021
1 parent ae23737 commit 376f5e7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cos-php-sdk-v5 Upgrade Guide
====================
2.1.5 to 2.1.6
----------
- Add `allow_redirects` parameter
- Fix `selectObjectContent` interface

2.1.3 to 2.1.5
----------
- The `download` interface supports breakpoint
Expand Down
1 change: 1 addition & 0 deletions sample/cosClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'proxy' => '', //代理服务器
'retry' => 10, //重试次数
'userAgent' => '', //UA
'allow_redirects' => false, //是否follow302
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey,
Expand Down
31 changes: 31 additions & 0 deletions sample/selectObjectContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,34 @@
// 请求失败
echo($e);
}

try {
$result = $cosClient->selectObjectContent(array(
'Bucket' => $bucket, //格式:BucketName-APPID
'Key' => $key,
'Expression' => 'Select * from COSObject s',
'ExpressionType' => 'SQL',
'InputSerialization' => array(
'CompressionType' => 'None',
'JSON' => array(
'Type' => 'DOCUMENT'
)
),
'OutputSerialization' => array(
'JSON' => array(
'RecordDelimiter' => '\n',
)
),
'RequestProgress' => array(
'Enabled' => 'FALSE'
)
));
// 请求成功
foreach ($result['Data'] as $data) {
// 迭代遍历select结果
print_r($data);
}
} catch (\Exception $e) {
// 请求失败
echo($e);
}
4 changes: 3 additions & 1 deletion src/Qcloud/Cos/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* @method object GetBucketIntelligentTiering (array $arg)
*/
class Client extends GuzzleClient {
const VERSION = '2.1.5';
const VERSION = '2.1.6';

public $httpClient;

Expand Down Expand Up @@ -108,6 +108,7 @@ public function __construct($cosConfig) {
$this->cosConfig['retry'] = isset($cosConfig['retry']) ? $cosConfig['retry'] : 1;
$this->cosConfig['userAgent'] = isset($cosConfig['userAgent']) ? $cosConfig['userAgent'] : 'cos-php-sdk-v5.'. Client::VERSION;
$this->cosConfig['pathStyle'] = isset($cosConfig['pathStyle']) ? $cosConfig['pathStyle'] : false;
$this->cosConfig['allow_redirects'] = isset($cosConfig['allow_redirects']) ? $cosConfig['allow_redirects'] : false;

$service = Service::getService();
$handler = HandlerStack::create();
Expand All @@ -130,6 +131,7 @@ public function __construct($cosConfig) {
'timeout' => $this->cosConfig['timeout'],
'handler' => $handler,
'proxy' => $this->cosConfig['proxy'],
'allow_redirects' => $this->cosConfig['allow_redirects']
]);
$this->desc = new Description($service);
$this->api = (array)($this->desc->getOperations());
Expand Down
8 changes: 4 additions & 4 deletions src/Qcloud/Cos/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -2718,8 +2718,8 @@ public static function getService() {
)
),
'JSON' => array(
'type' => 'string',
'location' => 'object',
'type' => 'object',
'location' => 'xml',
'properties' => array(
'Type' => array(
'type' => 'string',
Expand Down Expand Up @@ -2764,8 +2764,8 @@ public static function getService() {
)
),
'JSON' => array(
'type' => 'string',
'location' => 'object',
'type' => 'object',
'location' => 'xml',
'properties' => array(
'RecordDelimiter' => array(
'type' => 'string',
Expand Down

0 comments on commit 376f5e7

Please sign in to comment.