Use the CodeIgniter Active Record pattern in an ExpressionEngine plugin.