MCPcopy Create free account
hub / github.com/duckdb/duckdb / TableColumnList

Method TableColumnList

tools/shell/shell.cpp:1043–1056  ·  view source on GitHub ↗

** 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

Source from the content-addressed store, hash-verified

1041** by an entry with azCol[i]==0.
1042*/
1043vector<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.

Callers

nothing calls this directly

Calls 4

SQLStringClass · 0.85
QueryMethod · 0.45
HasErrorMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected