Re: [sqlite] Fast data duplication

2009-05-27 Thread John Machin
On 27/05/2009 9:47 PM, Igor Tandetnik wrote:
> "Vasil Boshnyakov" 
> wrote in message news:000c01c9de8b$16510a40$42f31e...@bg
>> The short description is: we need to copy many records of a table in
>> the same table but changing the "Name" value. So we have added a new
>> function which process the names:
>>
>> Insert into users ItemID, Name
>> Select ItemID, newName(Name) from users where itemActive = 1;
>>
>> That works great but we need one more step: how to much the pairs
>> "item comes from the Select <-> new item result of the Insert". We
>> need to track the copy history: itemID -> newItemID.
> 
> What is this newItemID you speak of? As far as I can tell from your 
> (syntactically invalid) statement, new records are inserted with the 
> same ItemId as the old ones.

Vasil, please tell us the schema, otherwise we can't help you. Some 
explanation of what you are really trying to do might also aid us. There 
are other concerns beside Igor's, like "itemActive" would seem from its 
name to belong to an "items" table, not to a "users" table.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Fast data duplication

2009-05-27 Thread Vasil Boshnyakov
Thank you for the help, I already got the solution of the problem. Thanks!

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik
Sent: Wednesday, May 27, 2009 2:47 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Fast data duplication

"Vasil Boshnyakov" <vas...@voicecom.bg>
wrote in message news:000c01c9de8b$16510a40$42f31e...@bg
> The short description is: we need to copy many records of a table in
> the same table but changing the "Name" value. So we have added a new
> function which process the names:
>
> Insert into users ItemID, Name
> Select ItemID, newName(Name) from users where itemActive = 1;
>
> That works great but we need one more step: how to much the pairs
> "item comes from the Select <-> new item result of the Insert". We
> need to track the copy history: itemID -> newItemID.

What is this newItemID you speak of? As far as I can tell from your 
(syntactically invalid) statement, new records are inserted with the 
same ItemId as the old ones.

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Fast data duplication

2009-05-27 Thread Igor Tandetnik
"Vasil Boshnyakov" 
wrote in message news:000c01c9de8b$16510a40$42f31e...@bg
> The short description is: we need to copy many records of a table in
> the same table but changing the "Name" value. So we have added a new
> function which process the names:
>
> Insert into users ItemID, Name
> Select ItemID, newName(Name) from users where itemActive = 1;
>
> That works great but we need one more step: how to much the pairs
> "item comes from the Select <-> new item result of the Insert". We
> need to track the copy history: itemID -> newItemID.

What is this newItemID you speak of? As far as I can tell from your 
(syntactically invalid) statement, new records are inserted with the 
same ItemId as the old ones.

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Fast data duplication

2009-05-26 Thread Vasil Boshnyakov
Hello,

 

We need to implement fast

 

Insert into users ItemID, Name

Select ItemID, Name from users where itemActive = 1;

 

 

The short description is: we need to copy many records of a table in the
same table but changing the "Name" value. So we have added a new function
which process the names:

 

Insert into users ItemID, Name

Select ItemID, newName(Name) from users where itemActive = 1;

 

That works great but we need one more step: how to much the pairs "item
comes from the Select <-> new item result of the Insert". We need to track
the copy history: itemID -> newItemID.

 

One way is to select and insert the old ItemIDs (ordered by.) and then use
the same "order by" in the "Select". So every item in the select will much
the exact item in the already stored "itemIDs". I am not sure if that is a
correct logic.

 

Any help is very welcome!

 

 

Thanks.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users