-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(bug) Running Balances do not work in Production #1273
Labels
Comments
jniles
pushed a commit
to jniles/bhima
that referenced
this issue
Mar 2, 2017
This commit implements the correct cumulative balance summation for the accounts report that initializes and updates variables in the same SQL statement. By maintaining all variables in the same statement, the variables are ensured to be zeroes out prior to usage and do not spread over multiple MySQL connections. This solution, while complex, allows total control over filtering via our standard filtering solutions. Placing the query in a Stored Procedure (another solution to localize the variable to a single MySQL connection/context) would require that any further filters write a new interface to the stored procedure. Closes IMA-WorldHealth#1273.
jniles
pushed a commit
to jniles/bhima
that referenced
this issue
Mar 2, 2017
This commit implements the correct cumulative balance summation for the accounts report that initializes and updates variables in the same SQL statement. By maintaining all variables in the same statement, the variables are ensured to be zeroes out prior to usage and do not spread over multiple MySQL connections. This solution, while complex, allows total control over filtering via our standard filtering solutions. Placing the query in a Stored Procedure (another solution to localize the variable to a single MySQL connection/context) would require that any further filters write a new interface to the stored procedure. Closes IMA-WorldHealth#1273.
sfount
pushed a commit
that referenced
this issue
Mar 3, 2017
This commit implements the correct cumulative balance summation for the accounts report that initializes and updates variables in the same SQL statement. By maintaining all variables in the same statement, the variables are ensured to be zeroes out prior to usage and do not spread over multiple MySQL connections. This solution, while complex, allows total control over filtering via our standard filtering solutions. Placing the query in a Stored Procedure (another solution to localize the variable to a single MySQL connection/context) would require that any further filters write a new interface to the stored procedure. Closes #1273.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The running totals on the accounts report does not work in a multi-connection environment. The
SET balance := 0
syntax only applies to individual MySQL connections which are taken randomly from a pool. Therefore, chainingdb.exec()
calls via.then()
promise chains does not guarantee that you will receive the same connection with the initialized variable.The running total should be redesigned with this consideration in mind - a transaction may yield the correct result, but a stored procedure or MySQL function would be the best solution to this problem.
The text was updated successfully, but these errors were encountered: