| Новости | FAQ | Авторы | Документация | В действии | Библиотека |
| Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
Misha v.3 26.05.2013 02:38 / 26.05.2013 06:07
вот пример:$room[^node.select[rooms/room]]
^for[f](0;$room-1){
$node[$room.$f]
^void:sql{INSERT INTO `$db`.`room` (`roomId`, `name`, `code`, `total_text`, `type`, `full_payment`, `foto_1`, `foto_2`, `foto_3`, `foto_1_big`, `foto_2_big`, `foto_3_big`, `ipix`, `ground_plan`, `accounting_code`, `max_pax`, `roomTimestamp`, `accommodationId`) VALUES (^node.selectString[string(ID)], '^taint[sql][^node.selectString[string(name)]]', '^taint[sql][^node.selectString[string(code)]]', '^taint[sql][^node.selectString[string(total_text)]]', '^taint[sql][^node.selectString[string(type)]]', '^taint[sql][^node.selectString[string(full_payment)]]', '^taint[sql][^node.selectString[string(foto_1)]]', '^taint[sql][^node.selectString[string(foto_2)]]', '^taint[sql][^node.selectString[string(foto_3)]]', '^taint[sql][^node.selectString[string(foto_1_big)]]', '^taint[sql][^node.selectString[string(foto_2_big)]]', '^taint[sql][^node.selectString[string(foto_3_big)]]', '^taint[sql][^node.selectString[string(ipix)]]', '^taint[sql][^node.selectString[string(ground_plan)]]', '^taint[sql][^node.selectString[string(accounting_code)]]', '^taint[sql][^node.selectString[string(max_pax)]]', CURRENT_TIMESTAMP, '$last_accommodation_id')}
}=> ^Node:foreachChild[$node;$.rooms(true);xRoomsNode;]{
^Node:foreachChild[$xRoomsNode;$.room(true);xRoomNode;]{
^self.insertRoom[^Node:foreachChild[$xRoomNode;;x;]{$.[$x.nodeName][$x.firstChild.nodeValue]}]
}
}
@insertRoom[h][result]
^if($h){
^void:sql{INSERT INTO `$db`.`room` (
`roomId`,
`name`,
`code`,
`total_text`,
`type`,
`full_payment`,
`foto_1`,
`foto_2`,
`foto_3`,
`foto_1_big`,
`foto_2_big`,
`foto_3_big`,
`ipix`,
`ground_plan`,
`accounting_code`,
`max_pax`,
`roomTimestamp`,
`accommodationId`
) VALUES (
^h.ID.int(0),
'$h.name',
'$h.code',
'$h.total_text',
'$h.type',
'$h.full_payment',
'$h.foto_1',
'$h.foto_2',
'$h.foto_3',
'$h.foto_1_big',
'$h.foto_2_big',
'$h.foto_3_big',
'$h.ipix',
'$h.ground_plan',
'$h.accounting_code',
'$h.max_pax',
CURRENT_TIMESTAMP,
'$last_accommodation_id'
)}
}лучше избавиться и от вызовов ^Node:foreachChild[] (это из моего Node.p), т.к. внутри него делаются лишние call-ы и ненужные в данном случае проверки.