#1 2016-08-29 12:03:26

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

How to copy a row

Hi Arnaud and mORMot community,

I'd like to make a copy of an entry in my db, is there a way to do it in the "mORMot way" without having to first create the object and then re-post it with a new ID?

Thanks in advance!

Offline

#2 2016-08-29 12:21:09

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: How to copy a row

@StxLog,

I don't think so, reading the original object, cloning it and then saving it back to the DB with a new ID would be the way to go.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2016-08-30 07:23:12

StxLog
Member
From: France
Registered: 2015-09-14
Posts: 58

Re: How to copy a row

OK thanks for your time

Offline

#4 2016-08-30 08:33:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,706
Website

Re: How to copy a row

In addition, consider two things:
- Use a TSQLRestBatch for faster writing process;
- Reuse the same TSQLRecord instance during the addition loop to avoid memory re-allocation.

Offline

Board footer

Powered by FluxBB