dg / dibi

Dibi - smart database abstraction layer
https://dibiphp.com
Other
487 stars 136 forks source link

DibiSqlite3Driver ignore flag #146

Closed klatys closed 9 years ago

klatys commented 10 years ago

Hi, during testing I came across this weird behaviour. For example code see https://github.com/klatys/dibisqlitetest Basically sqlite doesn't understand the INSERT IGNORE clause and uses INSERT OR IGNORE instead. I use the same code with mysql driver as well as sqlite so the query has to be universal.

Dumbest solution would of course be to add replace (e.g. here https://github.com/dg/dibi/blob/master/dibi/drivers/DibiSqlite3Driver.php#L109) but that seems really ugly.

Is there any other way how to approach this? As far as I looked I think there's not. If so - What approach to fix this would you consider suitable? I don't think dibi works with different clauses syntax for each driver and writing that might turn into bigger makeover... So since I'm not really sure if there's easier way around this I'm asking before I start to write anything...

dg commented 10 years ago

What about setFlag('OR IGNORE')?

klatys commented 10 years ago

Like I said - that's not useful since the same code has to work with both mysql and sqlite...

JanTvrdik commented 10 years ago

Dibi is not design to allow you to write code which will always automatically work with all drivers. That would required higher level of abstraction than dibi contains.