|
@@ -1,7 +1,8 @@
|
|
package com.abi.qms.platform;
|
|
package com.abi.qms.platform;
|
|
|
|
|
|
import com.alicloud.openservices.tablestore.SyncClient;
|
|
import com.alicloud.openservices.tablestore.SyncClient;
|
|
-import com.alicloud.openservices.tablestore.model.ColumnValue;
|
|
|
|
|
|
+import com.alicloud.openservices.tablestore.TableStoreException;
|
|
|
|
+import com.alicloud.openservices.tablestore.model.*;
|
|
import com.alicloud.openservices.tablestore.model.search.*;
|
|
import com.alicloud.openservices.tablestore.model.search.*;
|
|
import com.alicloud.openservices.tablestore.model.search.query.BoolQuery;
|
|
import com.alicloud.openservices.tablestore.model.search.query.BoolQuery;
|
|
import com.alicloud.openservices.tablestore.model.search.query.MatchQuery;
|
|
import com.alicloud.openservices.tablestore.model.search.query.MatchQuery;
|
|
@@ -131,4 +132,36 @@ public class TableStoreXTest {
|
|
//System.out.println("TotalCount: " + resp.getTotalCount());
|
|
//System.out.println("TotalCount: " + resp.getTotalCount());
|
|
System.out.println("Row: " + resp.getRows());
|
|
System.out.println("Row: " + resp.getRows());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询表的状态情况
|
|
|
|
+ */
|
|
|
|
+ @Test
|
|
|
|
+ public void describeTable() {
|
|
|
|
+ try{
|
|
|
|
+ DescribeTableRequest request = new DescribeTableRequest("luaywen");
|
|
|
|
+ DescribeTableResponse response = client().describeTable(request);
|
|
|
|
+ TableMeta tableMeta = response.getTableMeta();
|
|
|
|
+ System.out.println("表的名称:" + tableMeta.getTableName());
|
|
|
|
+ System.out.println("表的主键:");
|
|
|
|
+ for (PrimaryKeySchema primaryKeySchema : tableMeta.getPrimaryKeyList()) {
|
|
|
|
+ System.out.println(primaryKeySchema);
|
|
|
|
+ }
|
|
|
|
+ TableOptions tableOptions = response.getTableOptions();
|
|
|
|
+ System.out.println("表的TTL:" + tableOptions.getTimeToLive());
|
|
|
|
+ System.out.println("表的MaxVersions:" + tableOptions.getMaxVersions());
|
|
|
|
+ ReservedThroughputDetails reservedThroughputDetails = response.getReservedThroughputDetails();
|
|
|
|
+ System.out.println("表的预留读吞吐量:"
|
|
|
|
+ + reservedThroughputDetails.getCapacityUnit().getReadCapacityUnit());
|
|
|
|
+ System.out.println("表的预留写吞吐量:"
|
|
|
|
+ + reservedThroughputDetails.getCapacityUnit().getWriteCapacityUnit());
|
|
|
|
+ } catch (TableStoreException e){
|
|
|
|
+ if("OTSObjectNotExist".equals(e.getErrorCode())){
|
|
|
|
+ System.out.println("表不存在");
|
|
|
|
+ }
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|