modularise the insert statement creation. add support for discrim,
version, datastore id in insert. add code for statement execution