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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
- new `tooltip` property in the button component.
7
7
- New `search_value` property in the shell component.
8
8
- Fixed a display issue in the hero component when the button text is long and the viewport is narrow.
9
+
- reuse the existing opened database connection for the current query in `sqlpage.run_sql` instead of opening a new one. This makes it possible to create a temporary table in a file, and reuse it in an included script, create a SQL transaction that spans over multiple run_sql calls, and should generally make run_sql more performant.
9
10
10
11
## 0.22.0 (2024-05-29)
11
12
-**Important Security Fix:** The behavior of `SET $x` has been modified to match `SELECT $x`.
let query = bind_parameters(statement, request).await?;
129
-
let connection = take_connection(db,connection_opt).await?;
137
+
let query = bind_parameters(statement, request, db_connection).await?;
138
+
let connection = take_connection(&request.app_state.db,db_connection).await?;
130
139
log::debug!(
131
140
"Executing query to set the {variable:?} variable: {:?}",
132
141
query.sql
@@ -169,21 +178,21 @@ fn vars_and_name<'a, 'b>(
169
178
170
179
asyncfntake_connection<'a,'b>(
171
180
db:&'aDatabase,
172
-
conn:&'bmutOption<PoolConnection<sqlx::Any>>,
173
-
) -> anyhow::Result<&'bmutAnyConnection>{
174
-
match conn {
175
-
Some(c) => Ok(c),
176
-
None => match db.connection.acquire().await{
177
-
Ok(c) =>{
178
-
log::debug!("Acquired a database connection");
179
-
*conn = Some(c);
180
-
Ok(conn.as_mut().unwrap())
181
-
}
182
-
Err(e) => {
183
-
let err_msg = format!("Unable to acquire a database connection to execute the SQL file. All of the {} {:?} connections are busy.", db.connection.size(), db.connection.any_kind());
let err_msg = format!("Unable to acquire a database connection to execute the SQL file. All of the {} {:?} connections are busy.", db.connection.size(), db.connection.any_kind());
0 commit comments