@@ -904,9 +904,6 @@ public function join($joinTable, $joinCondition, $joinType = '')
904904 */
905905 public function loadData ($ importTable , $ importFile , $ importSettings = null )
906906 {
907- // Define default success var
908- $ success = false ;
909-
910907 // We have to check if the file exists
911908 if (!file_exists ($ importFile )) {
912909 // Throw an exception
@@ -916,16 +913,14 @@ public function loadData($importTable, $importFile, $importSettings = null)
916913
917914 // Define the default values
918915 // We will merge it later
919- $ settings = Array ("fieldChar " => '; ' , "lineChar " => ' \r\n ' , "linesToIgnore " => 1 );
916+ $ settings = Array ("fieldChar " => '; ' , "lineChar " => PHP_EOL , "linesToIgnore " => 1 );
920917
921918 // Check the import settings
922919 if (gettype ($ importSettings ) == "array " ) {
923920 // Merge the default array with the custom one
924921 $ settings = array_merge ($ settings , $ importSettings );
925922 }
926-
927- echo (var_dump ($ settings ));
928-
923+
929924 // Add the prefix to the import table
930925 $ table = self ::$ prefix . $ importTable ;
931926
@@ -950,12 +945,10 @@ public function loadData($importTable, $importFile, $importSettings = null)
950945
951946 // IGNORE LINES
952947 $ sqlSyntax .= sprintf (' IGNORE %d LINES ' , $ settings ["linesToIgnore " ]);
953-
954- echo ($ sqlSyntax );
955-
948+
956949 // Exceute the query unprepared because LOAD DATA only works with unprepared statements.
957950 $ result = $ this ->queryUnprepared ($ sqlSyntax );
958-
951+
959952 // Are there rows modified?
960953 // Let the user know if the import failed / succeeded
961954 return (bool ) $ result ;
@@ -974,17 +967,13 @@ public function loadData($importTable, $importFile, $importSettings = null)
974967 */
975968 public function loadXml ($ importTable , $ importFile , $ importSettings = null )
976969 {
977- // Define default success var
978- $ success = false ;
979-
980970 // We have to check if the file exists
981971 if (!file_exists ($ importFile )) {
982972 // Does not exists
983973 throw new Exception ("loadXml: Import file does not exists " );
984974 return ;
985975 }
986976
987-
988977 // Create default values
989978 $ settings = Array ("linesToIgnore " => 0 );
990979
0 commit comments