The error log was indeed an effect of the "strict mode etc". Actually
the strict mode is not enabled (commented out in initialize_mysqli() )
but instead of simply returning false when something wrong happen the
databse class now logs what went wrong before returning false.
The basic problem was that lots of pieces of code are not checking
return values from the function of databse class. The log file at least
enables us to have a look a posteriori.
And I can confirm that query() is supposed to be used only for queries
that returns a resultset and exec for anything that has an effect in the
database (INSERT, UPDATE, DELETE, but also SET, CREATE, DROP, ...
Systho
Le 16/06/2011 9:25, Sven Vanpoucke a écrit :
Hello developers
Last days we had a few issues with the creation of new platform
groups. We have noticed that there was a logfile mdb2.log created
(from which we believe that this is due to the changes of the strict
mode etc). In this logfile we found the following error:
[12:49:41] [Message: MDB2 Error: insufficient data supplied]
[Information: tableInfo: [Error message: Could not generate result
resource]
[Last executed query: UPDATE `group_group` SET
`left_value`=`left_value` + 2 WHERE `left_value` > 1]
[Native code: 0]]
[12:49:41] [Message: MDB2 Error: insufficient data supplied]
[Information: tableInfo: [Error message: Could not generate result
resource]
[Last executed query: UPDATE `group_group` SET
`right_value`=`right_value` + 2 WHERE `right_value` > 1]
[Native code: 0]]
After a search together with hans we traced the error back to how mdb2
handles the different queries. It seems that when you use the function
query, the system expects a real resultset from the database.
Unfortunately the query we were trying to execute was an update query
which has true or false as a result. Initially we thought this was due
to a fault in how mdb2 handles results. After some additional
searching hans found out that there is yet another method to be used
called exec which handles results differently.
So in short:
Using queries that return a resultset like /SELECT, SHOW, DESCRIBE/ or
/EXPLAIN /should be executed using query()
Other queries like INSERT, UPDATE, DELETE, ... should be executed
using exec()
Best regards
Sven
--
Met vriendelijke groeten
Sven Vanpoucke
Digitaal Leren
Directie Onderwijs
Hogeschool Gent
http://digitaal-leren.hogent.be/
_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev
_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev