与Codeigniter一起使用“ON DUPLICATE KEY UPDATE”的最佳方法

So, I've seen several different examples incl. altering Codeigniter default files, extending the Active record class and using insert_string and with insert_id and manually adding to the Codeigniter model script... Every solution relates to a different, older version of Codeigniter and to be honest - my brain is fried!

What is the best, most efficient way (in 2013) of achieving this functionality?

ps. yes, I know (in 2013) the best way is to use Laravel etc. But I have to use Codeigniter...