public String getPrimaryKey(int databaseId, String table) {
        // 1. get the struct of table
        DatabaseResult info = getTableInfo(databaseId, table);
        int columnSize = info.columnNames.size();
        int pkIndex = -1;
        int nameIndex = -1;
        // 2. find the position of name and pk
        for (int i = 0; i < columnSize; i++) {
            if (TextUtils.equals(info.columnNames.get(i), Column.PK)) {
                pkIndex = i;
            } else if (TextUtils.equals(info.columnNames.get(i), Column.NAME)) {
                nameIndex = i;
            }
            if (pkIndex >= 0 && nameIndex >= 0) {
                break;
            }
        }
        // 3. determine the primary key based on the value of pk
        String primaryKeyName = null;
        for (int i = 0; i < info.values.size(); i++) {
            String pkValue = info.values.get(i).get(pkIndex);
            if (!TextUtils.isEmpty(pkValue) && "1".equals(pkValue)) {
                primaryKeyName = info.values.get(i).get(nameIndex);
                break;
            }
        }
        // 4. if no primary key defined, use ROW_ID as default
        if (TextUtils.isEmpty(primaryKeyName)) {
            primaryKeyName = Column.ROW_ID;
        }
        return primaryKeyName;
    }
primaryKey first, and then is ROW_ID
@param databaseId
@param table
@return
pandora-core/src/main/java/tech/linjiang/pandora/database/Databases.java