Changeset 24461
- Timestamp:
- Jun 17, 2009, 12:25:54 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/scripts/dirize.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/scripts/dirize.pl
r24404 r24461 37 37 38 38 # initial directory fill in 39 my $ query = $db->prepare_cached("SELECT so_id, ext_id, dir_id FROM storage_object AS so WHERE so.dir_id = 0 LIMIT 100000");39 my $work_query = $db->prepare_cached("SELECT so_id, ext_id, dir_id FROM storage_object AS so WHERE so.dir_id = 0 LIMIT 10000"); 40 40 41 my $update_query = $db->prepare_cached("UPDATE storage_object SET ext_id_basename = ?, dir_id = ? WHERE so_id = ?"); 42 43 # turn of fkeys, otherwise we can change storage_object.dir_id to a 44 # non-existant value 41 45 $db->do("SET FOREIGN_KEY_CHECKS=0"); 42 #$db->do("UPDATE storage_object SET dir_id = 0"); 43 #$db->do("DELETE FROM directory"); 46 $db->do("UPDATE storage_object SET dir_id = 0"); 47 48 # completely reset the directory table 49 $db->do("DELETE FROM directory"); 50 $db->do("ALTER TABLE directiry AUTO_INCREMENT = 1"); 51 # seed the root ('/') directory 52 $db->do("INSERT INTO directory VALUES(1, '/', 1"); 44 53 45 54 my $i = 0; 46 while ($ query->execute and $query->rows) {47 while (my $row = $ query->fetchrow_hashref) {55 while ($work_query->execute and $work_query->rows) { 56 while (my $row = $work_query->fetchrow_hashref) { 48 57 $i++; 49 58 my $key = parse_neb_key($row->{'ext_id'}); … … 53 62 # printf("$i dirizing %s\n", $key->path); 54 63 55 my $q = $db->prepare_cached("UPDATE storage_object SET ext_id_basename = ?, dir_id = ? WHERE so_id = ?"); 56 $q->execute(basename($row->{'ext_id'}), $parent_id, $row->{'so_id'}); 64 $update_query->execute(basename($row->{'ext_id'}), $parent_id, $row->{'so_id'}); 57 65 } 58 66 $db->commit; … … 63 71 64 72 $db->do("SET FOREIGN_KEY_CHECKS=1"); 65 66 # remove unused dirs 67 #$db-do(""); 68 #$db->commit; 73 $db->commit;
Note:
See TracChangeset
for help on using the changeset viewer.
