• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:where +full:- +full:object

2 # Use of this source code is governed by a BSD-style license that can be
9 # even in environments where MyQSLdb is unavailable. Thus, we
13 class UtterlyFakeDb(object):
15 OperationalError = object()
66 class db_sql(object):
99 If they do not exist, they un-prefixed settings will be used.
130 # Using fallback to non-global in order to work without configuration
131 # overhead on non-shard instances.
194 This will re-connect to the database, so it is NOT safe
214 elapsed_time = stop_time - start_time
270 def _where_clause(self, where): argument
271 if not where:
274 if isinstance(where, dict):
277 for field, value in where.iteritems():
285 elif isinstance(where, basestring):
287 where_clause = where
289 elif isinstance(where, tuple):
290 # preformatted where clause + values
291 where_clause, values = where
294 raise ValueError('Invalid "where" value: %r' % where)
296 return ' WHERE ' + where_clause, values
300 def select(self, fields, table, where, distinct=False, group_by=None, argument
304 specific table with a particular where clause.
305 The where clause can either be a dictionary of
314 where = ("a = %s AND b = %s", ['val', 'val'])
316 where = "a = 'val' AND b = 'val'"
320 @param where: The where clause string.
330 where_clause, values = self._where_clause(where)
338 # create a re-runable function for executing the query
348 # run the query, re-trying after operational errors
367 # create a -re-runable function for executing the query
372 # run the query, re-trying after operational errors
381 # re-run the query until it succeeds
415 def delete(self, table, where, commit = None): argument
419 @param where: The where clause.
425 where_clause, values = self._where_clause(where)
433 def update(self, table, data, where, commit = None): argument
435 'update table set data values (%s ... %s) where ...'
442 @param where: The where clause.
453 where_clause, where_values = self._where_clause(where)
470 where = {'test_idx' : test_idx}
471 self.delete('tko_iteration_result', where)
472 self.delete('tko_iteration_perf_value', where)
473 self.delete('tko_iteration_attributes', where)
474 self.delete('tko_test_attributes', where)
476 where = {'job_idx' : job_idx}
477 self.delete('tko_tests', where)
478 self.delete('tko_jobs', where)
485 @param job: The job object.
522 @param job: tko.models.job object.
556 @param job: The job object.
560 where = {'job_id': job.job_idx, 'key': key}
561 data = dict(where, value=value)
562 exists = self.select('id', 'tko_job_keyvals', where=where)
565 self.update('tko_job_keyvals', data, where=where, commit=commit)
573 @param job: The job object.
574 @param test: The test object.
589 where = {'test_idx': test_idx}
590 self.delete('tko_iteration_result', where)
591 self.delete('tko_iteration_perf_value', where)
592 self.delete('tko_iteration_attributes', where)
593 where['user_created'] = 0
594 self.delete('tko_test_attributes', where)
645 @param job: The job object.
665 Also updates the job object with new machine index, if any.
667 @param job: tko.models.job object.
682 @param job: tko.models.job object.
699 @param job: The job object.
710 @param job: The job object.
715 where={'hostname': machine_info['hostname']},
724 where = { 'hostname' : hostname }
725 rows = self.select('machine_idx', 'tko_machines', where)
735 @param kernel: The kernel object.
748 @param kernel: The kernel object.
760 match = re.match(r'.*(-mm[0-9]+|-git[0-9]+)\.(bz2|gz)$',
787 @param patch: The kernel patch object.
807 where = {'job_idx': job_idx , 'test': testname, 'subdir': subdir}
808 rows = self.select('test_idx', 'tko_tests', where)
821 where = { 'job_idx':job_idx }
822 rows = self.select('test_idx', 'tko_tests', where)
833 @return: The job object or None.
852 where = 'job_idx in (%s)' % ', '.join(tko_job_ids)
853 rows = self.select(', '.join(fields), 'tko_test_view_2', where)
865 @return: An db object.