Class mr_db_queue

Description

MR DB Queue

Processes mr_db_record's as efficiently as possible

Located in /db/queue.php (line 47)


	
			
Variable Summary
static array $metacolumns
array $counts
string $deletes
array $inserts
int $size
Method Summary
mr_db_queue __construct ([int $size = 500])
void __destruct ()
mr_db_queue add (mr_db_record|mr_db_record[] $records)
mr_db_queue flush ([string $table = NULL])
mixed get_counts ([string $type = NULL])
int|null|string normalise_value (mr_db_table $table, $column $column, $value $value)
void _flush_deletes (string $table)
void _flush_inserts (string $table)
Variables
static array $metacolumns = array() (line 81)

Cache meta column data for tables

  • access: protected
array $counts = array('inserts' => 0, 'updates' => 0, 'deletes' => 0) (line 67)

Stores the number of inserts and updates through lifetime of queue

  • access: protected
string $deletes = array() (line 60)

Record delete queue

  • access: protected
array $inserts = array() (line 53)

Record insert queue

  • access: protected
int $size = 500 (line 74)

Queue size

  • access: protected
Methods
Constructor __construct (line 88)

Construct

  • access: public
mr_db_queue __construct ([int $size = 500])
  • int $size: Set queue size before auto flushes
Destructor __destruct (line 97)

Destruct - flush it!

  • access: public
void __destruct ()
add (line 113)

Add record(s)

  • throws: coding_exception
  • access: public
mr_db_queue add (mr_db_record|mr_db_record[] $records)
  • mr_db_record|mr_db_record[] $records: Can be a single record or an array of records Records must be of type mr_db_record
flush (line 172)

Flush the queue

  • access: public
mr_db_queue flush ([string $table = NULL])
  • string $table: Pass a table name to flush for a specific table, none for all tables
get_counts (line 194)

Returns the count of inserts, updates, and deletes for the queue either independently if $type is specified or all together if not

  • return: - count of specified type or array of counts
  • access: public
mixed get_counts ([string $type = NULL])
  • string $type: - the count type to return count for
normalise_value (line 287)

Mostly copied from mysqli_native_moodle_database. Main change is that it defaults the numeric value to the table's default value instead of zero

  • throws: dml_write_exception
  • access: protected
int|null|string normalise_value (mr_db_table $table, $column $column, $value $value)
_flush_deletes (line 263)

Flushes deletes

  • throws: coding_exception
  • access: protected
void _flush_deletes (string $table)
  • string $table: The table to flush
_flush_inserts (line 209)

Flushes inserts

  • throws: coding_exception
  • access: protected
void _flush_inserts (string $table)
  • string $table: The table to flush

Documentation generated on Thu, 28 Jun 2012 16:33:50 -0700 by phpDocumentor 1.4.3