Method | Description | |
---|---|---|
createTableFromCSVFile ( string $tableName, array $fields, string $filePath, array $fileSpec ) : boolean | Batch insert into table from CSV (or other delimited) file. | |
tableInsertBatch ( string $tableName, array $fields, array $values, boolean $throwException = false, string $charset = 'utf8' ) : boolean | Performs a batch insert into a specific table using either LOAD DATA INFILE or plain INSERTs, as a fallback. On MySQL, LOAD DATA INFILE is 20x faster than a series of plain INSERTs. | |
tableInsertBatchIterate ( string $tableName, array $fields, array $values, boolean $ignoreWhenDuplicate = true ) | Performs a batch insert into a specific table by iterating through the data |
Method | Description | |
---|---|---|
createCSVFile ( string $filePath, array $fileSpec, array $rows ) | Create CSV (or other delimited) files |
Method | Description | |
---|---|---|
getBestPathForLoadData ( ) |
public static createTableFromCSVFile ( string $tableName, array $fields, string $filePath, array $fileSpec ) : boolean | ||
$tableName | string | Name of table |
$fields | array | Field names |
$filePath | string | Path name of a file. |
$fileSpec | array | File specifications (delimiter, line terminator, etc) |
return | boolean | True if successful; false otherwise |
public static tableInsertBatch ( string $tableName, array $fields, array $values, boolean $throwException = false, string $charset = 'utf8' ) : boolean | ||
$tableName | string | PREFIXED table name! you must call Common::prefixTable() before passing the table name |
$fields | array | array of unquoted field names |
$values | array | array of data to be inserted |
$throwException | boolean | Whether to throw an exception that was caught while trying LOAD DATA INFILE, or not. |
$charset | string | The charset to use, defaults to utf8 |
return | boolean | True if the bulk LOAD was used, false if we fallback to plain INSERTs |
public static tableInsertBatchIterate ( string $tableName, array $fields, array $values, boolean $ignoreWhenDuplicate = true ) | ||
$tableName | string | PREFIXED table name! you must call Common::prefixTable() before passing the table name |
$fields | array | array of unquoted field names |
$values | array | array of data to be inserted |
$ignoreWhenDuplicate | boolean | Ignore new rows that contain unique key values that duplicate old rows |