MCPcopy Create free account
hub / github.com/daniel2005d/mapXplore / _select

Method _select

database/SQliteDB.py:45–66  ·  view source on GitHub ↗
(self, sentence: str, values=None, showColumns = False)

Source from the content-addressed store, hash-verified

43 self._conn.close()
44
45 def _select(self, sentence: str, values=None, showColumns = False):
46 cursor = self._get_cursor()
47 rows=[]
48 if values is not None:
49 cursor.execute(sentence, values)
50 else:
51 cursor.execute(sentence)
52 results = cursor.fetchall()
53
54 if showColumns:
55 column_names = [desc[0] for desc in cursor.description]
56 for row in results:
57 row_with_column_names = {}
58 for idx, value in enumerate(row):
59 row_with_column_names[column_names[idx]] = value
60 rows.append(row_with_column_names)
61 else:
62 for row in results:
63 rows.append(row)
64
65 self._conn.close()
66 return rows
67
68 def _get_columns(self, tablename:str):
69 return self._get_columns_from_table(tablename)

Callers 7

_check_existsMethod · 0.95
execute_queryMethod · 0.95
check_exists_tableMethod · 0.95
get_tables_countMethod · 0.95
get_tablesMethod · 0.95
search_tablesMethod · 0.95
select_tableMethod · 0.45

Calls 3

_get_cursorMethod · 0.95
appendMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected