Create bulk nodes - PDOException
You should be using migrate for this: https://www.drupal.org/project/migrate, it covers many of the pitfalls you are currently encountering when creating or importing content from a CSV, database or XML file. Don't recreate the wheel when someone has already created it for you. 

It's not like the feeds module or other "import" type modules, it's an entirely  code based OOP solution. You just extend the main migration class and map your data. It comes with a number of built in PHP functions to process the data further and it literally covers almost every scenario you could possibly encounter when mass creating or transferring content. 

As someone who's been down this path many times, it will save you a lot of time and hair pulling. I recommend looking at the code examples migrate provides.