User Tools

Site Tools


mantisbt:executing_db_queries

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mantisbt:executing_db_queries [2016/05/15 07:01]
dregad created
mantisbt:executing_db_queries [2020/05/13 12:28] (current)
dregad [References] replace old ~~Mantis:xxx~~ reference with Interwiki syntax
Line 2: Line 2:
  
 MantisBT relies on [[http://adodb.org|ADOdb library]] for database abstraction. MantisBT relies on [[http://adodb.org|ADOdb library]] for database abstraction.
 +
 +Whenever coding new APIs or modifying existing ones **Developers must be careful to always call '' db_param_push()'' before any use of ''db_query()''**.
 +
  
 ===== Design flaw ===== ===== Design flaw =====
Line 49: Line 52:
   - ''db_query_pop() '': new API to pop the previous parameter count from the stack. \\ It is only necessary to call this when a query is built but not executed, e.g. after an error.   - ''db_query_pop() '': new API to pop the previous parameter count from the stack. \\ It is only necessary to call this when a query is built but not executed, e.g. after an error.
  
-All MantisBT core APIs have been modified to use the new functions, making them safe to be called from anywhere. Whenever coding new APIs or modifying existing ones **Developers must be careful to always call '' db_param_push()'' before any use of ''db_query()''**.+All MantisBT core APIs have been modified to use the new functions, making them safe to be called from anywhere.
  
 Fixing the above example: Fixing the above example:
Line 80: Line 83:
 SELECT * FROM {project} WHERE id = $1 SELECT * FROM {project} WHERE id = $1
 </code> </code>
 +
 +===== References =====
 +
 +  * Issue [[Mantis>20479]]
 +  * https://github.com/mantisbt/mantisbt/pull/705
 +  * https://github.com/mantisbt/mantisbt/pull/143
  
mantisbt/executing_db_queries.1463310092.txt.gz ยท Last modified: 2016/05/15 07:01 by dregad