All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alicloud.openservices.tablestore.model.sql.SQLUtils Maven / Gradle / Ivy

Go to download

Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com

There is a newer version: 5.17.5
Show newest version
package com.alicloud.openservices.tablestore.model.sql;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

/**
 * SQL API 的 Utils 方法
 **/
public class SQLUtils {

    private static final Logger LOG = LoggerFactory.getLogger(SQLUtils.class);

    /**
     * 解析 Show Tables SQL 返回结果
     * @param response Show Tables SQL 返回结果
     * @return 表列表
     */
    public static List parseShowTablesResponse(SQLQueryResponse response) {
        if (response.getSQLStatementType() != SQLStatementType.SQL_SHOW_TABLE) {
            throw new IllegalStateException("SQL statement is not `show tables`.");
        }
        SQLResultSet rs = response.getSQLResultSet();
        List tables = new ArrayList();
        while (rs.hasNext()) {
            tables.add(rs.next().getString(0));
        }
        return tables;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy