You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To get a query's affected row count, it is currently necessary to retrieve the metadata from the database handle and unwrap the optional, adding considerable boilerplate logic, typically of this form:
extensionSQLQueryBuilderwhere Connection ==MySQLConnection{publicfunc runReturningAffectedRows()->Future<UInt64>{return connection.query(query){ _ in}.map{
guard let metadata =(self.connection asMySQLConnection).lastMetadata else{throwMySQLError(identifier:"metadata", reason:"Connection did not return metadata after successful query.")}return metadata.affectedRows
}}}
This also smacks of thread-safety issues; while it does not actually exhibit any, it feels iffy for the metadata of a given query to be associated with the database itself. There should be a more consistent and query-bound way to receive the row count. As well, it should be possible to retrieve said count from other databases than just MySQL - both SQLite and PostgreSQL are known to have such values available.
The text was updated successfully, but these errors were encountered:
To get a query's affected row count, it is currently necessary to retrieve the metadata from the database handle and unwrap the optional, adding considerable boilerplate logic, typically of this form:
This also smacks of thread-safety issues; while it does not actually exhibit any, it feels iffy for the metadata of a given query to be associated with the database itself. There should be a more consistent and query-bound way to receive the row count. As well, it should be possible to retrieve said count from other databases than just MySQL - both SQLite and PostgreSQL are known to have such values available.
The text was updated successfully, but these errors were encountered: