Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backslash problem #18

Closed
fofo2411 opened this issue Jan 7, 2019 · 2 comments
Closed

backslash problem #18

fofo2411 opened this issue Jan 7, 2019 · 2 comments

Comments

@fofo2411
Copy link

fofo2411 commented Jan 7, 2019

Hi,
Great plugin....

I found a problem after running this command:

php artisan geonames:install --country=CR --language=en

It fails at some point with this:

Inserting via LOAD DATA INFILE: D:\Web Development\laravel\timezonedb\storage\geonames\iso-languagecodes.txt
SQLSTATE[HY000]: General error: 7890 Can't find file 'D:Web Developmentlaravel  imezonedbstoragegeonamesiso-languagecod'.

I am developing on my Windows computer, so path file has backslash, these causes problems while running the following query:

$query = "LOAD DATA LOCAL INFILE '" . $localFilePath . "'
    INTO TABLE " . self::TABLE_WORKING . " IGNORE 1 LINES
        (   iso_639_3, 
            iso_639_2,
            iso_639_1, 
            language_name,          
            @created_at, 
            @updated_at)
    SET created_at=NOW(),updated_at=null";

I fixed it by adding the following line

$localFilePath = str_replace("\\", "\/", $localFilePath); <<<!! 
        $query = "LOAD DATA LOCAL INFILE '" . $localFilePath . "'......
@fofo2411
Copy link
Author

fofo2411 commented Jan 7, 2019

I was lazy to find where was $localFilePath parameter pass in the code, so I just fixed it before it creates the query.

@michaeldrennen
Copy link
Owner

Sorry for the incredible delay.

That really is peculiar.
In my code that generates the path to the file on your local machine I use the PHP constant DIRECTORY_SEPARATOR which should avoid this problem altogether.

I've made a bunch of changes to the library, so perhaps try to run it again and let me know what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants