The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Text::CSV::SQLhelper - Processes a CSV file and tries to figure out

VERSION

Version 0.0.0

SYNOPSIS

METHODS

new

args hash

csv

This is the text CSV object.

defaultAllowNull

If no null is found,

It defaults to false.

error

Returns the current error code and true if there is an error.

If there is no error, undef is returned.

    my $error=$foo->error;
    if($error){
        print 'error code: '.$error."\n";
    }

errorString

Returns the error string if there is one. If there is not, it will return ''.

    my $error=$foo->error;
    if($error){
        print 'error code:'.$error.': '.$foo->errorString."\n";
    }

processFile

This processes the specified file.

Two arguements are required. The first one is the file to read and the second one is a boolean specifying if the top line should be skipped or not.

The returned value is a array.

returned array

allownull

Wether or not a column can have a null value.

This defaults to false.

min

This is the smallest value found. In regards to strings, it represents number of characters in the shortest string.

max

This is the largest value found. In regards to strings, it represents number of characters in the longest string.

sql

This is a SQL description for the column.

type

This is the data type of the column.

The possible values are 'float', 'int', and 'string'.

    #process the file, including the top line
    my @columns=$foo->processFile($file);
    if($foo->error){
        print 'error code:'.$foo->error.': '.$foo->errorString."\n";
    }

    #process the file, skipping the top line
    my @columns=$foo->processFile($file, 1);
    if($foo->error){
        print 'error code:'.$foo->error.': '.$foo->errorString."\n";
    }

errorblank

This blanks the error storage and is only meant for internal usage.

If a permanent error is set, it will not be cleared.

It does the following.

    $self->{error}=undef;
    $self->{errorString}="";

ERROR CODES

1

No "Text::CSV" object specified or defined.

2

No file specified.

3

Failed to open the file.

AUTHOR

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-text-csv-sqlhelper at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-CSV-SQLhelper. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Text::CSV::SQLhelper

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2010 Zane C. Bowers, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.