Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
есть хранимый класс хочу сделать новую запись и скопировать в нее все свойства одной из предыдущих записей вопрос как возможно это сделать? может что то типа merge есть? Код: plaintext 1. 2. 3. 4. 5. 6. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2010, 15:10 |
|
||
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
Посмотрите метод %ConstructClone у класса %Library.RegisteredObject ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2010, 15:13 |
|
||
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
Ymka2007 , %Library.Persistent наследуется от %SwizzleObject... А тот в свою очередь от %RegisteredObject... Так вот у этого самого %RegisteredObject есть метод %ConstructClone. Я в аглицком не очень... Но возможно это то, что нужно. автор• method %ConstructClone(deep As %Boolean = 0, ByRef cloned As %String, location As %String) as %RegisteredObject Clone the current object to a new object. If deep is 1 then this does a deep copy which will also copy any subobjects and if deep is 0 then it will create another reference to any subobjects and increment the reference count appropriately. It returns the new cloned object. Note that even if deep=0 when you clone a parent object in a parent child relationship or a one object of a one to many relationship then it will construct clones of all the child/many objects. This is because a child/many object can only point at a single parent and so if we did not create a clone of these then you would have a relationship with zero items in it. If you really just want to clone the object without these child/many objects then pass deep=-1 to this method. After the clone is constructed it will call %OnConstructClone(deep,.cloned) if it is defined so that you can perform any additional steps e.g. taking out a lock. This works just the same way as %OnNew() does. The cloned array is just used internally when doing a deep clone to prevent recursive loops, do not pass anything in at all for this parameter on the initial call. If you write a %OnConstructClone and from here you wish to call %ConstructClone on another object pass in the cloned array, e.g. 'Do oref.%ConstructClone(1,.cloned)' so that it can prevent recursive loops. The location is used internally to pass the new location for stream objects. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2010, 15:18 |
|
||
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
Ymka2007, s o2=o1 это не копирование объекта, это копирование ссылки таким образом ты получаешь 2 ссылки на один объект для копирования необходимо пользоваться %ConstructClone() получается вот так Код: plaintext 1. 2. 3. 4. 5. 6. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2010, 15:24 |
|
||
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
всем спасибо сработало дальше %Persistent не удосужился копать ))) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2010, 15:40 |
|
||
|
вопрос по копированию объекта
|
|||
|---|---|---|---|
|
#18+
Нужно только отметить что %ConstructClone на базах 2008 и выше может странно ввести себя с объектами в схеме parent-child. Я не буду 100% давать гарантию что это именно баг/фича %ConstructClone, но результат такой. При копировании child-а, очищается ссылка на parent-а. И Нужно вручную его еще раз записать ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.08.2010, 12:19 |
|
||
|
|

start [/forum/topic.php?fid=39&fpage=48&tid=1557999]: |
0ms |
get settings: |
9ms |
get forum list: |
20ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
36ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
51ms |
get tp. blocked users: |
1ms |
| others: | 252ms |
| total: | 388ms |

| 0 / 0 |
