@anonymous-piwik-user opened this issue on March 25th 2009

removing mysqlish in order to improve compatibliy with other database backend. So replace the ON DUPLICATE with : SELECT ? UPDATE : INSERT;

As it will be ok because the ON DUPLICATE clause is use only on queries wchich not used a lot. It can have faillure if it is used concurrently, the time to do a fail update, an insert can hit the database and then the next insert (from the failed update) will failled. However we can use a sql function if needed (it will be able to catch the error and make the right thing).

@anonymous-piwik-user commented on March 25th 2009

Attachment: remove ON DUPLICATE remove_duplicate.patch

@anonymous-piwik-user commented on March 25th 2009

ahem, not SELECT?UPDATE:INSERT; but UPDATE?:INSERT;

@mattab commented on March 30th 2009

did you test all the affected features after applying your patch? including the profiler? also why do you round the time in ms?

@anonymous-piwik-user commented on March 31st 2009

Replying to matt:

did you test all the affected features after applying your patch? including the profiler? also why do you round the time in ms?

I didn't test the query profiler.

In the patch there is 2 extra 'array' in the last part :/ (before both $paramsBind).

About the round : actually there is number_fomat and in the db a double precision (float). I find better to have integer on both side. (I think I had an issue on that part and just crop)

@mattab commented on March 31st 2009

please make sure you test your patch fully before submitting it for review..

@anonymous-piwik-user commented on April 2nd 2009

Replying to matt:

please make sure you test your patch fully before submitting it for review..

yes you are right, I did trust too much the unit test.

@robocoder commented on April 25th 2009

Can we create a wrapper function for this? I would prefer to keep the ON DUPLICATE query for mysql and provide the alternate UPDATE/INSERT query for other DB's.

@anonymous-piwik-user commented on April 25th 2009

adding a wrapper mean starting handle multiple database. Even if I am pro-postgresql backend, I prefer see more standard sql code than wrappers.

@mattab commented on May 18th 2009

I agree it would be better if the postgresql wrapper would special handling this type of queries. You could use the event 'Reporting.createDatabase' to create your special database object that would overload the default ones to special handle this type of queries. Please let us know if this works as expected.

This issue was closed on May 18th 2009
Powered by GitHub Issue Mirror