+" domain=? AND login=? ORDER BY time DESC";
+" (domain=? OR (?=1 AND domain IS NULL)) " + "AND (login=? OR (?=1 AND login IS NULL)) ORDER BY time DESC";
	protected error read_by_func( short rbf, int start, int cnt, 			log_entry_listHolder les ) 			throws null_error, db_error, except { try {		les.value = new log_entry[0];		ArrayList ales = new ArrayList();		PreparedStatement st = null;		ResultSet res = null;		try {			String qr = null;			if( rbf == rbf_all )				qr = "SELECT id_log,time,ip,service,result,msg,domain,login "					+ "FROM vq_view_log_read ORDER BY time DESC";			if( rbf == rbf_by_dom )				qr = "SELECT id_log,time,ip,service,result,msg,login "					+ "FROM vq_view_log_read WHERE domain=? ORDER BY time DESC";			if( rbf == rbf_by_user )				qr = "SELECT id_log,time,ip,service,result,msg FROM vq_view_log_read WHERE "					+" domain=? AND login=? ORDER BY time DESC";			st = con.prepareStatement(qr);			if( rbf == rbf_by_dom || rbf == rbf_by_user )				st.setString(1, dom);			if( rbf == rbf_by_user )				st.setString(2, log);			res = st.executeQuery();			if( ! res.absolute(start+1) ) {				try { if( res != null ) res.close(); } catch(Exception e) {}				try { if( st != null ) st.close(); } catch(Exception e) {}				return lr(err_code.err_noent, "");			}			if( cnt == 0 ) --cnt; // if it's zero means that we want to read all entries			for( int idx=1; cnt-- != 0; idx = 1 ) {				log_entry le = new log_entry();								le.id_log = res.getString(idx);				if( res.wasNull() ) le.id_log = "";				++idx;				le.time = res.getTime(idx).toString();				if( res.wasNull() ) le.time = "";				++idx;				le.ip = res.getString(idx);				if( res.wasNull() ) le.ip = "";				++idx;				le.ser = res.getShort(idx);				if( res.wasNull() ) le.ser = ilogger.ser_unknown;				++idx;				le.res = res.getShort(idx);				if( res.wasNull() ) le.res = ilogger.re_unknown;				++idx;				le.msg = res.getString(idx);				if( res.wasNull() ) le.msg = "";				++idx;				if( rbf != rbf_by_user && rbf != rbf_by_dom ) { 					le.domain = res.getString(idx);					if( res.wasNull() ) le.domain = "";					++idx;				} else					le.domain = "";				if( rbf != rbf_by_user ) {					le.login = res.getString(idx);					if( res.wasNull() ) le.login = "";					++idx;				} else					le.login = "";				ales.add(le);				if(!res.next()) break;			}			les.value = new log_entry[ ales.size() ];			for( int i=0, s=ales.size(); i<s; ++i )				les.value[i] = (log_entry) ales.get(i);		} finally {			try { if( res != null ) res.close(); } catch(Exception e) {}			try { if( st != null ) st.close(); } catch(Exception e) {}		}		return lr(err_code.err_no, "");	} catch( SQLException e ) {		throw new db_error(e.getMessage(), getClass().getName(), 0);	} catch( NullPointerException e ) {		throw new null_error(e.getMessage(), getClass().getName(), 0);	} catch( Exception e ) {		throw new except(e.getMessage(), getClass().getName(), 0);	} }