src/dbfs/core.c
changeset 30 d8fabd347a8e
parent 29 5de62ca9a5aa
child 31 7804cd7b5cd5
equal deleted inserted replaced
29:5de62ca9a5aa 30:d8fabd347a8e
    55     INFO("[dbfs.lookup] parent=%lu name=%s", parent, name);
    55     INFO("[dbfs.lookup] parent=%lu name=%s", parent, name);
    56     
    56     
    57     // query and params
    57     // query and params
    58     const char *sql = 
    58     const char *sql = 
    59         "SELECT"
    59         "SELECT"
    60         " inodes.ino, inodes.type, inodes.mode, inodes.size, count(*)"
    60         " inodes.ino, inodes.type, inodes.mode, dbfs_lo_size(data), count(*)"
    61         " FROM file_tree INNER JOIN inodes ON (file_tree.inode = inodes.ino)"
    61         " FROM file_tree INNER JOIN inodes ON (file_tree.inode = inodes.ino)"
    62         " WHERE file_tree.parent = $1::int4 AND file_tree.name = $2::varchar"
    62         " WHERE file_tree.parent = $1::int4 AND file_tree.name = $2::varchar"
    63         " GROUP BY inodes.ino, inodes.type, inodes.mode, inodes.size";
    63         " GROUP BY inodes.ino, inodes.type, inodes.mode, data";
    64     
    64     
    65     static struct evsql_query_params params = EVSQL_PARAMS(EVSQL_FMT_BINARY) {
    65     static struct evsql_query_params params = EVSQL_PARAMS(EVSQL_FMT_BINARY) {
    66         EVSQL_PARAM ( UINT32 ),
    66         EVSQL_PARAM ( UINT32 ),
    67         EVSQL_PARAM ( STRING ),
    67         EVSQL_PARAM ( STRING ),
    68 
    68 
   128 
   128 
   129     INFO("[dbfs.getattr %p] ino=%lu", req, ino);
   129     INFO("[dbfs.getattr %p] ino=%lu", req, ino);
   130 
   130 
   131     const char *sql =
   131     const char *sql =
   132         "SELECT"
   132         "SELECT"
   133         " inodes.type, inodes.mode, inodes.size, count(*)"
   133         " inodes.type, inodes.mode, dbfs_lo_size(data), count(*)"
   134         " FROM inodes"
   134         " FROM inodes"
   135         " WHERE inodes.ino = $1::int4"
   135         " WHERE inodes.ino = $1::int4"
   136         " GROUP BY inodes.type, inodes.mode, inodes.size";
   136         " GROUP BY inodes.type, inodes.mode, data";
   137 
   137 
   138     static struct evsql_query_params params = EVSQL_PARAMS(EVSQL_FMT_BINARY) {
   138     static struct evsql_query_params params = EVSQL_PARAMS(EVSQL_FMT_BINARY) {
   139         EVSQL_PARAM ( UINT32 ),
   139         EVSQL_PARAM ( UINT32 ),
   140 
   140 
   141         EVSQL_PARAMS_END
   141         EVSQL_PARAMS_END