(ctx context.Context, tblName string)
| 167 | } |
| 168 | |
| 169 | func (d *Driver) descTbl(ctx context.Context, tblName string) (*tableAdditionalInfo, error) { |
| 170 | tblAddInfo := &tableAdditionalInfo{ |
| 171 | tblProps: make(map[string]string), |
| 172 | } |
| 173 | rows, _, err := d.execStatementSync(ctx, fmt.Sprintf("DESC FORMATTED %s", tblName), 0) |
| 174 | if err != nil { |
| 175 | return nil, err |
| 176 | } |
| 177 | |
| 178 | for _, row := range rows { |
| 179 | infoKey := row[0] |
| 180 | infoVal := row[1] |
| 181 | if infoKey == "Table Properties" { |
| 182 | pattern := regexp.MustCompile("([a-zA-Z0-9-.]*)=([a-zA-Z0-9-.]*)") |
| 183 | matches := pattern.FindAllStringSubmatch(infoVal, -1) |
| 184 | if matches == nil { |
| 185 | continue |
| 186 | } |
| 187 | for _, match := range matches { |
| 188 | tblAddInfo.tblProps[match[1]] = match[2] |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | return tblAddInfo, nil |
| 194 | } |
| 195 | |
| 196 | func formatTblProperties(tblAddInfo *tableAdditionalInfo) (string, error) { |
| 197 | if tblAddInfo == nil || tblAddInfo.tblProps == nil { |
no test coverage detected