Retrieves the names of the columns in the result set
(&self)
| 141 | |
| 142 | /// Retrieves the names of the columns in the result set |
| 143 | pub fn column_names(&self) -> Vec<String> { |
| 144 | #[cfg(feature = "sqlx-dep")] |
| 145 | use sqlx::Column; |
| 146 | |
| 147 | match &self.row { |
| 148 | #[cfg(feature = "sqlx-mysql")] |
| 149 | QueryResultRow::SqlxMySql(row) => { |
| 150 | row.columns().iter().map(|c| c.name().to_string()).collect() |
| 151 | } |
| 152 | #[cfg(feature = "sqlx-postgres")] |
| 153 | QueryResultRow::SqlxPostgres(row) => { |
| 154 | row.columns().iter().map(|c| c.name().to_string()).collect() |
| 155 | } |
| 156 | #[cfg(feature = "sqlx-sqlite")] |
| 157 | QueryResultRow::SqlxSqlite(row) => { |
| 158 | row.columns().iter().map(|c| c.name().to_string()).collect() |
| 159 | } |
| 160 | #[cfg(feature = "mock")] |
| 161 | QueryResultRow::Mock(row) => row |
| 162 | .clone() |
| 163 | .into_column_value_tuples() |
| 164 | .map(|(c, _)| c.to_string()) |
| 165 | .collect(), |
| 166 | #[cfg(feature = "proxy")] |
| 167 | QueryResultRow::Proxy(row) => row |
| 168 | .clone() |
| 169 | .into_column_value_tuples() |
| 170 | .map(|(c, _)| c.to_string()) |
| 171 | .collect(), |
| 172 | #[allow(unreachable_patterns)] |
| 173 | _ => unreachable!(), |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | /// Access the underlying `MySqlRow` if we use the MySQL backend. |
| 178 | #[cfg(feature = "sqlx-mysql")] |
nothing calls this directly
no test coverage detected