IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 26, 2007, 10:27:33 AM (19 years ago)
Author:
jhoblitt
Message:

add getmountedvol() stored procedure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/bin/neb-df

    r13023 r13041  
    33# Copyright (C) 2005  Joshua Hoblitt
    44#
    5 # $Id: neb-df,v 1.1 2007-04-25 19:52:49 jhoblitt Exp $
     5# $Id: neb-df,v 1.2 2007-04-26 20:27:33 jhoblitt Exp $
    66
    77use strict;
     
    4747my $sql = Nebulous::Server::SQL->new();
    4848
    49 # get a list of Nebulous volume names
    50 my $query = $dbh->prepare("SELECT * FROM volume");
     49# ask the db to generate the table of mounted Nebulous volume
     50$dbh->do("call getmountedvol()");
     51
     52# suck that table into an AoH
     53my $query = $dbh->prepare("SELECT * FROM mountedvol");
    5154$query->execute();
    5255
    53 my $mount_query = $dbh->prepare("SELECT *, INSTR(?, mountpoint) = 1 as substring FROM mount ORDER BY substring DESC, LENGTH(mountpoint) DESC LIMIT 1");
    54 
    5556my @stats;
    56 
    57 # use the list of Nebulous volume names to look for the corresponding
    58 # mountpoint
    59 while (my $volume_row = $query->fetchrow_hashref) {
    60     $mount_query->execute($volume_row->{path});
    61     my $mount_row = $mount_query->fetchrow_hashref;
    62 
    63     # assemble a hash that combines the neb volume info with the filesystem
    64     # info
    65     my $vol = {%{$volume_row}, %{$mount_row}};
    66     push @stats, $vol;
     57while (my $mountedvol = $query->fetchrow_hashref) {
     58    push @stats, $mountedvol;
    6759}
    6860
Note: See TracChangeset for help on using the changeset viewer.