[mythtv] State of play Re. DB support (MySQL versions, Postgresql etc.)

Colin Guthrie mythtv at colin.guthr.ie
Sat May 13 09:03:38 UTC 2006


Fernando Vilas wrote:
> Yes, the INSERT...SET syntax is non-standard and will cause problems if/when other databases are supported.

OK, I may as well avoid that syntax in my patches if possible then.


>>>LAST_INSERT_ID()/MSqlQuery::lastInsertId()
>>>Is the above OK to use? I've seen various workarounds in code to get the 
>>>ID back out, but not sure if this is just older techniques or not.
>>> 
>>
>>This is always a bug bear....  I don't know of any reasonably generic 
>>way to do it short of using cursors and re-reading the data....
>>
> 
> Getting the last insert id is also not portable, however it is easier to code for than the syntax in the first question.

I guess it should just select the id out again with another query then. 
I'm sure I can change the few places I've used the lastInsertId() 
function to do a select statement for the sake of saving hassle in the 
future. :)

The mythweb side of things is a little more complex. Perhaps Chris can 
comment on using e.g. one of the Pear or Pecl wrappers for databases?


Col.
-- 

+------------------------+
|     Colin Guthrie      |
+------------------------+
| myth(at)colin.guthr.ie |
| http://colin.guthr.ie/ |
+------------------------+


More information about the mythtv-dev mailing list