%@page import="org.openisis.*,java.io.IOException,java.util.Date"%> <%! static final String EMPTY = ""; static Db[] dbs = new Db[2]; static String dberr = EMPTY; static { try { String[] args = new String[] { "-v", "error", "-encoding", "Cp850" }; dbs[0] = Db.open( "/var/db/cds/cds", args ); args = new String[] { "-v", "error", "-format", "aligned" }; dbs[1] = Db.open( "/var/db/unesb/unesb", args ); } catch (IOException e) { e.printStackTrace(); dberr = e.toString(); } }; static String NV ( String x ) { return null==x ? EMPTY : x; } static int ROWS = 5; // number of rows to show at once %> <% String search = NV( request.getParameter( "search" ) ); int off = 0; int rows = ROWS; int dbnum = -1; try { off = Integer.parseInt( request.getParameter( "off" ) ); } catch ( Exception e ) {} try { dbnum = Integer.parseInt( request.getParameter( "db" ) ); if ( dbs.length <= dbnum ) dbnum = -1; } catch ( Exception e ) { } if ( 0 > dbnum ) try { dbnum = Integer.parseInt( (String)session.getAttribute( "db" ) ); } catch ( Exception e ) { dbnum = 0; } else session.setAttribute( "db", ""+dbnum ); Db db = dbs[dbnum]; try { rows = Integer.parseInt( request.getParameter( "rows" ) ); } catch ( Exception e ) {} int[] set = (int[])session.getAttribute( "set" ); %>
<%
if ( EMPTY != search ) {
long then = (new Date()).getTime();
int[] nset = db.search( search, Db.QRY_SIMPLE );
long now = (new Date()).getTime();
if ( null == nset ) {
%>
sorry, no results for <%=search%>
<%
session.removeAttribute( "set" );
return;
} else {
%>
got <%=nset.length%> rows for <%=search%>
in <%=(now - then)/1000.%> seconds.
<%
if ( null == set || null == request.getParameter("narrow") )
set = nset;
else { // and sets
set = Db.AND( set, nset );
%>
<%=set.length%> rows remaining after combine with previous search
<%
}
session.setAttribute( "set", set );
}
} // EMPTY != search
if ( null == set )
return;
if ( 0 < off ) {
int boff = off-rows;
if ( boff < 0 ) boff = 0;
%>
<<rows <%=boff+1%> to <%=boff+rows%>
<%
}
int end = off + rows;
if ( end >= set.length )
end = set.length;
else {
%>
rows <%=end+1%> to <%=end+rows%>>>
<%
}
%>
MFN : <%= r.getRowId() %>
<%= r.v("CONFERENCE : ",null,12,m,0,0,r13,s) %>
<%= r.v("TITLE : ",null,24,m,0,0,r13,s) %>
<%= r.v("AUTHOR(S) : ",null,14,m,0,0,"; "+r13+" ",s) %>
<%= r.v("EDITION : ",null,25,m,0,0,r13,s) %>
<%= r.v("IMPRINT : ",null,26,m,0,0,r13,s) %>
<%= r.v("COLLATION : ",null,30,m,0,0,r13,s) %>
<%= r.v("SERIES : ",null,44,m,0,0,r13,s) %>
<%= r.v("NOTES : ",null,50,m,0,0,r13,s) %>
<%= r.v("CORP. BODY : ",null,71,m,0,0,r13,s) %>
<%= r.v("ADDED CONF : ",null,72,m,0,0,r13,s) %>
<%= r.v("OTHER TITLE: ",null,74,m,0,0,r13,s) %>
<%= r.v("OTHER LANG : ",null,76,m|'*',0,0,r13,s) %>
<%= r.v("KEYWORDS : ",null,69,m,0,0,r13,s) %>
<%
}
} else {
%>
skip bad row <%=set[i]%> as <%=i+1%> of <%=set.length%> | |||
row <%=id%> with <%=l%> fields as <%=i+1%> of <%=set.length%> | |||
<%=id%> | <%=f.tag%> | <%=f.html()%> | |
<%=id%> | <%=f.tag%> | <%=(char)s[k].tag%> | <%=s[k].html()%> |