qds = new QueryDataSet (con, qstr);
qds = new QueryDataSet (con, q);
    public int countNodes (Node home, Relation rel) throws Exception {	Transactor tx = (Transactor) Thread.currentThread ();	// tx.timer.beginEvent ("countNodes "+home);	if (rel == null || rel.otherType == null || !rel.otherType.isRelational ()) {	    // this should never be called for embedded nodes	    throw new RuntimeException ("NodeMgr.countNodes called for non-relational node "+home);	} else {	    int retval = 0;	    Connection con = rel.otherType.getConnection ();	    String table = rel.otherType.getTableName ();	    QueryDataSet qds = null;	    try {	        String qstr = "SELECT count(*) FROM "+table+rel.buildQuery (home, home.getNonVirtualParent (), null);		        if (logSql)	            app.logEvent ("### countNodes: "+qstr);		        qds = new QueryDataSet (con, qstr);	        qds.fetchRecords ();	        if (qds.size () == 0)	            retval = 0;	        else	            retval = qds.getRecord (0).getValue (1).asInt ();	    } finally {	        // tx.timer.endEvent ("countNodes "+home);	        if (qds != null) {	            qds.close ();	        }	    }	    return retval;	}    }