ayushjain17 commented on code in PR #107:
URL:
https://github.com/apache/casbin-rust-diesel-adapter/pull/107#discussion_r4184652809
##########
src/actions.rs:
##########
@@ -23,9 +26,36 @@ pub type Connection = diesel::SqliteConnection;
type Pool = PooledConnection<ConnectionManager<Connection>>;
+/// Reports whether the policy table already exists.
+///
+/// This is a read-only query, so it also succeeds on connections that cannot
+/// execute DDL at all — a streaming replica, or an application role
+/// deliberately granted no `CREATE` privilege.
+fn table_exists(conn: &mut Connection) -> Result<bool> {
+ #[cfg(feature = "postgres")]
+ let check = format!("to_regclass('{TABLE_NAME}') IS NOT NULL");
Review Comment:
Dont use format, use bind instead
Bind protects against sql injections
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]