@@ -1627,4 +1627,57 @@ public function testPutObjectAclByBodyToAnyone()
16271627 }
16281628 }
16291629
1630+ /*
1631+ * selectobject,select检索数据
1632+ * 200
1633+ */
1634+ public function testSelectObjectContent ()
1635+ {
1636+ $ key = '你好.txt ' ;
1637+ try {
1638+ $ body = "appid,bucket,region
1639+ 12500001,22weqwe,sh
1640+ 12500002,we2qwe,sh
1641+ 12500003,weq3we,sh
1642+ 12500004,weqw4e,sh
1643+ 3278522,azxc,gz
1644+ 4343,ewqew,tj " ;
1645+ $ this ->cosClient ->putObject (array ('Bucket ' => $ this ->bucket ,'Key ' => $ key , 'Body ' => $ body ));
1646+ $ result = $ this ->cosClient ->selectObjectContent (array (
1647+ 'Bucket ' => $ this ->bucket , //格式:BucketName-APPID
1648+ 'Key ' => $ key ,
1649+ 'Expression ' => 'Select * from COSObject s ' ,
1650+ 'ExpressionType ' => 'SQL ' ,
1651+ 'InputSerialization ' => array (
1652+ 'CompressionType ' => 'None ' ,
1653+ 'CSV ' => array (
1654+ 'FileHeaderInfo ' => 'USE ' ,
1655+ 'RecordDelimiter ' => '\n ' ,
1656+ 'FieldDelimiter ' => ', ' ,
1657+ 'QuoteEscapeCharacter ' => '" ' ,
1658+ 'Comments ' => '# ' ,
1659+ 'AllowQuotedRecordDelimiter ' => 'FALSE '
1660+ )
1661+ ),
1662+ 'OutputSerialization ' => array (
1663+ 'CSV ' => array (
1664+ 'QuoteField ' => 'ASNEEDED ' ,
1665+ 'RecordDelimiter ' => '\n ' ,
1666+ 'FieldDelimiter ' => ', ' ,
1667+ 'QuoteCharacter ' => '" ' ,
1668+ 'QuoteEscapeCharacter ' => '" '
1669+ )
1670+ ),
1671+ 'RequestProgress ' => array (
1672+ 'Enabled ' => 'FALSE '
1673+ )
1674+ ));
1675+ foreach ($ result ['Data ' ] as $ data ) {
1676+ }
1677+ } catch (\Exception $ e ) {
1678+ print ($ e );
1679+ $ this ->assertFalse (TRUE );
1680+ }
1681+ }
1682+
16301683}
0 commit comments