| 1 |
<?php |
<?php |
| 2 |
// $Id: type_local_nids.module,v 1.1.2.2 2008/03/30 16:06:15 jbrown Exp $ |
// $Id: type_local_nids.module,v 1.1.2.3 2009/04/25 21:21:50 jbrown Exp $ |
| 3 |
|
|
| 4 |
|
|
| 5 |
function _type_local_nids_generate_lnid(&$node) { |
function _type_local_nids_get_lnid(&$node) { |
| 6 |
|
|
| 7 |
|
$node->lnid = db_result(db_query(" |
| 8 |
|
SELECT lnid |
| 9 |
|
FROM {node_lnid} |
| 10 |
|
WHERE nid = %d |
| 11 |
|
", |
| 12 |
|
$node->nid |
| 13 |
|
)); |
| 14 |
|
|
| 15 |
|
if($node->lnid) |
| 16 |
|
return; |
| 17 |
|
|
| 18 |
$node->lnid = db_result(db_query(" |
$node->lnid = db_result(db_query(" |
| 19 |
SELECT next_lnid |
SELECT next_lnid |
| 37 |
db_query(" |
db_query(" |
| 38 |
INSERT INTO {node_lnid_next} |
INSERT INTO {node_lnid_next} |
| 39 |
SET type = '%s', |
SET type = '%s', |
| 40 |
next_lnid = 2 |
next_lnid = 2 |
| 41 |
", |
", |
| 42 |
$node->type |
$node->type |
| 43 |
); |
); |
| 60 |
|
|
| 61 |
switch ($op) { |
switch ($op) { |
| 62 |
|
|
|
case 'load': |
|
|
case 'update': |
|
|
|
|
|
$node->lnid = db_result(db_query(" |
|
|
SELECT lnid |
|
|
FROM {node_lnid} |
|
|
WHERE nid = %d |
|
|
", |
|
|
$node->nid |
|
|
)); |
|
|
|
|
| 63 |
case 'insert': |
case 'insert': |
| 64 |
|
case 'update': |
| 65 |
|
case 'load': |
| 66 |
|
|
| 67 |
if(!$node->lnid) |
_type_local_nids_get_lnid($node); |
|
_type_local_nids_generate_lnid($node); |
|
| 68 |
|
|
| 69 |
return array('lnid' => $node->lnid); |
return array('lnid' => $node->lnid); |
| 70 |
|
|