Ñò ŽM×Jc @sžddkZddkZeid d joddkZn3yddkZWnej oedƒ‚nXdefd„ƒYZde fd„ƒYZ dS( iÿÿÿÿNiis=Unable to determine sqlite, please make sure it is installed.tCasStorageExceptioncBseZRS((t__name__t __module__(((s*/usr/lib/python2.6/site-packages/cas/db.pyR st CasStoragecBs†eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „ZRS(cCs||_d|_d|_dS(sP setup database connection and return db cursor for traversing database N(tdbtNonetconntcursor(tselftdatabase((s*/usr/lib/python2.6/site-packages/cas/db.pyt__init__s  cCsEy+ti|iƒ|_|iiƒ|_Wntdƒ‚nXdS(s execute connection sCannot connect to databaseN(tsqlitetconnectRRRR(R((s*/usr/lib/python2.6/site-packages/cas/db.pyR s cCs|iiƒdS(N(Rtcommit(R((s*/usr/lib/python2.6/site-packages/cas/db.pyR s cCsN|iidƒ|iidƒ|iidƒ|iidƒ|iƒdS(Ns¥create table jobs ( job_id integer primary key autoincrement, identifier integer, date text, email text) sscreate table debuginfo ( debug_id integer primary key autoincrement, rpm text) s·create table timestamp ( timestamp_id integer primary key autoincrement, debugpath text, timestamp text, debug_id integer) s¤create table server ( server_id integer primary key autoincrement, arch text, port text, hostname text) (RtexecuteR (R((s*/usr/lib/python2.6/site-packages/cas/db.pyt buildTable#s     cCsS|f}|iid|ƒ|iiƒp|iid|ƒn|iƒdS(Ns&SELECT * from debuginfo where rpm="%s"s'INSERT into debuginfo(rpm) values("%s")(RRtfetchoneR (Rt debuginfo((s*/usr/lib/python2.6/site-packages/cas/db.pytaddDebuginfoRPM@s   cCs|iidƒ|iiƒS(NsSELECT * FROM debuginfo(RRtfetchall(R((s*/usr/lib/python2.6/site-packages/cas/db.pytgetAllDebuginfoRPMHscCs\|||f}|iid|fƒ|iiƒp|iid|ƒn|iƒdS(s? build relation to debuginfo rpm and add debug path, timestamp s,SELECT * FROM timestamp where timestamp="%s"sRINSERT into timestamp (debug_id,debugpath, timestamp) values(%d,"%s","%s")N(RRRR (Rtidtdebugt timestamptvalues((s*/usr/lib/python2.6/site-packages/cas/db.pyt addTimestampMs  cCs*|f}|iid|ƒ|iiƒS(s4 return timestamp based on extracted core timestamp sáSELECT rpm,debugpath FROM debuginfo, timestamp where timestamp.timestamp LIKE "%%%s%%" AND debuginfo.debug_id = timestamp.debug_id(RRR(RRR((s*/usr/lib/python2.6/site-packages/cas/db.pytgetTimestampDebugWs   cCs|iidƒ|iiƒS(s all jobs sSELECT * FROM jobs(RRR(R((s*/usr/lib/python2.6/site-packages/cas/db.pyt getAllJobsascCs$|iid|fƒ|iiƒS(s single job sSELECT * FROM jobs where id=%d(RRR(RR((s*/usr/lib/python2.6/site-packages/cas/db.pyt getJobByIdfscCsdS(sF provides jobs based on creation date from $days back N((Rtdays((s*/usr/lib/python2.6/site-packages/cas/db.pyt getJobRangekscCsZ|djo d}nt|ƒt|ƒt|ƒf}|iid|ƒ|iƒdS(s add job to db s cas@localhostsGINSERT into jobs (date,identifier,email) values ("%s",%d, "%s")N(RtstrtintRRR (Rt identifiertdatetemailR((s*/usr/lib/python2.6/site-packages/cas/db.pytaddJobqs  !   cCs\|||f}|iid|fƒ|iiƒp|iid|ƒn|iƒdS(s add server/arch to db s(select * from server where hostname="%s"sIINSERT into server (hostname, arch, port) values ("%s","%s","%s")N(RRRR (RthostnametporttarchR((s*/usr/lib/python2.6/site-packages/cas/db.pyt addServer|s  cCs|iidƒ|iiƒS(Ns'select hostname, port, arch from server(RRR(R((s*/usr/lib/python2.6/site-packages/cas/db.pyt getServers†s(RRR R R RRRRRRRRR$R(R)(((s*/usr/lib/python2.6/site-packages/cas/db.pyRs         (ii( tostsyst version_infotsqlite3R t ImportErrort SystemExitt ExceptionRtobjectR(((s*/usr/lib/python2.6/site-packages/cas/db.pyts