Results 1 to 10 of 10

 

Thread: Datafeed not being completely inserted into DB

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts


    Hi,

    Hopefully someone will be able to help me here,

    I've got a PHP script which downloads each merchants datafeed and then loads the feeds into a MySQL database using the LOAD DATA LOCAL INFILE command

    This works perfectly for most merchants, but when it comes to John Lewis for example who have 61K products, only 12K or so are inserted into the database. The same happens for other merchant feeds which have a high number of records

    Does anyone have any ideas?

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    Quote Originally Posted by Adrian1 View Post
    Hi,

    Hopefully someone will be able to help me here,

    I've got a PHP script which downloads each merchants datafeed and then loads the feeds into a MySQL database using the LOAD DATA LOCAL INFILE command

    This works perfectly for most merchants, but when it comes to John Lewis for example who have 61K products, only 12K or so are inserted into the database. The same happens for other merchant feeds which have a high number of records

    Does anyone have any ideas?
    sounds like it maybe timing out , u could try adding the below to a .htaccess at the top

    php_value max_execution_time 0

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the reply, I've just tried the code you suggested but with no success

    I've also been using:
    set_time_limit(0);
    ini_set("memory_limit","3072M");

    Got any other ideas?

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    i would assume it is timing out

    the host will sometimes limit this

    have you got the script to load the datafeed straight into the database all at once? you could split it up by adding a 1 or 2 second wait between every 1000 records or so as that could help

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Jan 2008
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the replies cheapdvds

    I've found the problem!

    It turns out that I wasn't allocating enough bytes to gzread for it to read all the data in the gzipped CSV file

    Doh

  6. #6
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    lol, that is always the problem when unzipping on the server, you have to go large!
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  7. #7
    babrees's Avatar
    Registered User

    Status
    Offline
    Join Date
    Feb 2007
    Location
    Norfolk
    Posts
    1,588
    Thanks
    142
    Thanked 101 Times in 89 Posts
    Quote Originally Posted by Adrian1 View Post
    Thanks for the replies cheapdvds

    I've found the problem!

    It turns out that I wasn't allocating enough bytes to gzread for it to read all the data in the gzipped CSV file

    Doh
    hmm, I wonder if this is my problem!! But where/how do you fix this please

    Cheers

  8. #8
    scriptmonkey's Avatar
    Oranges & Lemons

    Status
    Offline
    Join Date
    Jan 2009
    Location
    Worthing
    Posts
    1,607
    Thanks
    112
    Thanked 253 Times in 192 Posts
    where you call gzread, you have an object and an amount of bytes, eg.

    gzread($object, 500000);

    change the number by adding a 0 to the end until you are successful
    The trouble with the rat race is that even if you win you're still a rat.
    Time passes. Listen. Time passes. Dylan Thomas
    Ebay Alerts to your inbox

  9. #9
    babrees's Avatar
    Registered User

    Status
    Offline
    Join Date
    Feb 2007
    Location
    Norfolk
    Posts
    1,588
    Thanks
    142
    Thanked 101 Times in 89 Posts
    Quote Originally Posted by scriptmonkey View Post
    where you call gzread, you have an object and an amount of bytes, eg.

    gzread($object, 500000);

    change the number by adding a 0 to the end until you are successful
    hmm, thanks but I have no idea where this may be. I use Price Tapestry, but thought you may have been talking about something on the server rather than script?

  10. #10
    Registered User

    Status
    Offline
    Join Date
    Sep 2007
    Posts
    1,351
    Thanks
    43
    Thanked 72 Times in 63 Posts
    Quote Originally Posted by babrees View Post
    hmm, thanks but I have no idea where this may be. I use Price Tapestry, but thought you may have been talking about something on the server rather than script?
    in your .htaccess file at the top have you added anything like the below?

    php_value upload_max_filesize = 0
    php_value max_execution_time = 0
    php_value memory_limit = 256
    php_value post_max_size = 256

    if u havent you could add this and keep incresing the numbers to see if it works



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. completely free - a must read
    By chevg8 in forum Media Coverage & PR Strategy
    Replies: 0
    Last Post: 19-10-08, 10:26 PM
  2. Joomla completely free?
    By katy111 in forum Affiliate Marketing Lounge
    Replies: 8
    Last Post: 15-04-08, 10:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2