HRDIODB
[ class tree: HRDIODB ] [ index: HRDIODB ] [ all elements ]

Class: csv_loader

Source Location: /csv_loader_class.php

Class Overview


A class for loading a CSV file into the database.


Methods



Class Details

[line 39]
A class for loading a CSV file into the database.

The csv_loader class requires a table name, a unique key name and a CSV file where the first line that is not a comment is a comma separated list of field names. Each following non comment line is a comma separated list of values for those fields. Comments are denoted by the # sign.




[ Top ]


Class Methods


constructor csv_loader [line 44]

csv_loader csv_loader( )

Constructor.

Class constructor.




[ Top ]

method get_line [line 137]

mixed get_line( )

Reads one csv line into an array.

Performs cleaning actions on the data from the CSV.




Tags:

return:  Cleaned data


[ Top ]

method load_csv_line [line 165]

mixed load_csv_line( )

Parses one line of a CSV file.

Determines if that line is a comment, the list of fields, or the data.




Tags:

return:  Line of data or FALSE.


[ Top ]

method parse_file [line 127]

void parse_file( )

Parses the file.

Parses all the lines of the object's file.




[ Top ]

method print_file_info [line 254]

void print_file_info( )

Prints file information.

Prints detailed information about a parsed file.




[ Top ]

method push_to_db [line 286]

void push_to_db( )

Pushes information to the database.

Pushes parsed file information to the database.




[ Top ]

method set_db [line 59]

void set_db( &$db, hrdi_db $db)

Sets the database object.

Sets the database object. Requires a hrdi_db object.




Parameters:

hrdi_db   $db   The reference to a hrdi_db object
   &$db  

[ Top ]

method set_fields [line 98]

void set_fields( string $line)

Sets field.

Sets a field to the input line. Takes an array of the target database fields.




Parameters:

string   $line   A single CSV formatted line containing only field names

[ Top ]

method set_file [line 68]

void set_file( string $file)

Creates a file handle.

Takes a file name and creates a file handle.




Parameters:

string   $file   Filename

[ Top ]

method set_table [line 78]

void set_table( string $table)

Sets table name.

Sets the destination table name.




Parameters:

string   $table   Table name

[ Top ]

method set_table_keys [line 88]

void set_table_keys( array $table_keys)

Sets the table / key array.

Sets an associative array of unique keys to be used to determine if data exists in a table.




Parameters:

array   $table_keys   Table keys array

[ Top ]


Documentation generated on Tue, 23 Jan 2007 22:57:44 -0500 by phpDocumentor 1.3.0RC6