PHP 클래스 Piwik\Db\BatchInsert

파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

공개 메소드들

메소드 설명
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

보호된 메소드들

메소드 설명
createCSVFile ( string $filePath, array $fileSpec, array $rows ) Create CSV (or other delimited) files

비공개 메소드들

메소드 설명
getBestPathForLoadData ( )

메소드 상세

createCSVFile() 보호된 정적인 메소드

Create CSV (or other delimited) files
protected static createCSVFile ( string $filePath, array $fileSpec, array $rows )
$filePath string filename to create
$fileSpec array File specifications (delimiter, line terminator, etc)
$rows array Array of array corresponding to rows of values

createTableFromCSVFile() 공개 정적인 메소드

Batch insert into table from CSV (or other delimited) file.
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)
리턴 boolean True if successful; false otherwise

tableInsertBatch() 공개 정적인 메소드

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.
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
리턴 boolean True if the bulk LOAD was used, false if we fallback to plain INSERTs

tableInsertBatchIterate() 공개 정적인 메소드

NOTE: you should use tableInsertBatch() which will fallback to this function if LOAD DATA INFILE not available
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