Code Duplication    Length = 20-25 lines in 3 locations

html/inc/bossa_db.inc 1 location

@@ 120-144 (lines=25) @@
117
    }
118
}
119
120
class BossaApp {
121
    static function insert($clause) {
122
        $db = BossaDb::get();
123
        return $db->insert('bossa_app', $clause);
124
    }
125
126
    static function lookup($clause) {
127
        $db = BossaDb::get();
128
        return $db->lookup('bossa_app', 'BossaApp', $clause);
129
    }
130
131
    static function lookup_id($id) {
132
        $db = BossaDb::get();
133
        return $db->lookup_id($id, 'bossa_app', 'BossaApp');
134
    }
135
136
    static function enum() {
137
        $db = BossaDb::get();
138
        return $db->enum('bossa_app', 'BossaApp');
139
    }
140
    function update($clause) {
141
        $db = BossaDb::get();
142
        return $db->update($this, 'bossa_app', $clause);
143
    }
144
}
145
146
// values for bossa_job.state
147
//

html/inc/submit_db.inc 2 locations

@@ 117-136 (lines=20) @@
114
    }
115
}
116
117
class BoincJobFile {
118
    static function insert($clause) {
119
        $db = BoincDb::get();
120
        $ret = $db->insert('job_file', $clause);
121
        if (!$ret) return false;
122
        return $db->insert_id();
123
    }
124
    static function lookup_name($name) {
125
        $db = BoincDb::get();
126
        return $db->lookup('job_file', 'BoincJobFile', "name='$name'");
127
    }
128
    function delete() {
129
        $db = BoincDb::get();
130
        return $db->delete($this, 'job_file');
131
    }
132
    function update($clause) {
133
        $db = BoincDb::get();
134
        return $db->update($this, 'job_file', $clause);
135
    }
136
}
137
138
class BoincBatchFileAssoc {
139
    static function insert($clause) {
@@ 138-161 (lines=24) @@
135
    }
136
}
137
138
class BoincBatchFileAssoc {
139
    static function insert($clause) {
140
        $db = BoincDb::get();
141
        $ret = $db->insert('batch_file_assoc', $clause);
142
        if (!$ret) return false;
143
        return true;
144
    }
145
    static function lookup($clause) {
146
        $db = BoincDb::get();
147
        return $db->lookup('batch_file_assoc', 'BoincBatchFileAssoc', $clause);
148
    }
149
    function delete() {
150
        $db = BoincDb::get();
151
        return $db->delete_aux('batch_file_assoc',
152
            "job_file_id=$this->job_file_id and batch_id=$this->batch_id"
153
        );
154
    }
155
    static function delete_batch($batch_id) {
156
        $db = BoincDb::get();
157
        return $db->delete_aux('batch_file_assoc',
158
            "batch_id=$batch_id"
159
        );
160
    }
161
}
162
163
?>
164