** Return a list of pointers to strings which are the names of all ** columns in table zTab. The memory to hold the names is dynamically ** allocated and must be released by the caller using a subsequent call ** to freeColumnList(). ** ** The azCol[0] entry is usually NULL. However, if zTab contains a rowid ** value that needs to be preserved, then azCol[0] is filled in with the ** name of the
| 1041 | ** by an entry with azCol[i]==0. |
| 1042 | */ |
| 1043 | vector<string> ShellState::TableColumnList(const char *zTab) { |
| 1044 | vector<string> result; |
| 1045 | |
| 1046 | auto zSql = StringUtil::Format("PRAGMA table_info=%s", SQLString(zTab)); |
| 1047 | auto &con = *conn; |
| 1048 | auto query_result = con.Query(zSql); |
| 1049 | if (query_result->HasError()) { |
| 1050 | return result; |
| 1051 | } |
| 1052 | for (auto &row : *query_result) { |
| 1053 | result.push_back(row.GetValue<string>(1)); |
| 1054 | } |
| 1055 | return result; |
| 1056 | } |
| 1057 | |
| 1058 | /* |
| 1059 | ** Lookup the schema for a table using the information schema. |