[odb-users] question: persist operation for sqlite binding
iyatomi at gmail.com
Tue Apr 11 22:47:35 EDT 2017
Hi, Boris, sorry for late reply, I understand persist semantics. thanks!
before 2.5.0 is out, I will use own insertion code to mix auto id
assignment and providing manually.
2017年4月11日(火) 1:35 Boris Kolpackov <boris at codesynthesis.com>:
> Hi Takehiro,
> takehiro iyatomi <iyatomi at gmail.com> writes:
> > hi, thank you for creating odb. that saves my life a lot :D
> Thanks, glad to hear that!
> > suppose I define object that have id_ column as #pragma db id auto
> > and set id_ to non-zero value before persist it into sqlite database.
> > whatever value is set to id_ , sqlite silently ignored that value and
> > returns auto-incremented id_ value as a result.
> > [...]
> > this is expected behavior? if so, should I expect same behavior for other
> > database binding like mysql?
> Yes, the semantics of automatically assigned object id is that the
> database, not you, assigns it (and guarantees that it will not
> conflict with any existing object id). This consistent across
> all the supported databases.
> Having said that, for SQLite and MySQL we have added this extra
> functionality (will be available in 2.5.0):
More information about the odb-users