@@ -904,9 +904,6 @@ public function join($joinTable, $joinCondition, $joinType = '')
904
904
*/
905
905
public function loadData ($ importTable , $ importFile , $ importSettings = null )
906
906
{
907
- // Define default success var
908
- $ success = false ;
909
-
910
907
// We have to check if the file exists
911
908
if (!file_exists ($ importFile )) {
912
909
// Throw an exception
@@ -916,16 +913,14 @@ public function loadData($importTable, $importFile, $importSettings = null)
916
913
917
914
// Define the default values
918
915
// We will merge it later
919
- $ settings = Array ("fieldChar " => '; ' , "lineChar " => ' \r\n ' , "linesToIgnore " => 1 );
916
+ $ settings = Array ("fieldChar " => '; ' , "lineChar " => PHP_EOL , "linesToIgnore " => 1 );
920
917
921
918
// Check the import settings
922
919
if (gettype ($ importSettings ) == "array " ) {
923
920
// Merge the default array with the custom one
924
921
$ settings = array_merge ($ settings , $ importSettings );
925
922
}
926
-
927
- echo (var_dump ($ settings ));
928
-
923
+
929
924
// Add the prefix to the import table
930
925
$ table = self ::$ prefix . $ importTable ;
931
926
@@ -950,12 +945,10 @@ public function loadData($importTable, $importFile, $importSettings = null)
950
945
951
946
// IGNORE LINES
952
947
$ sqlSyntax .= sprintf (' IGNORE %d LINES ' , $ settings ["linesToIgnore " ]);
953
-
954
- echo ($ sqlSyntax );
955
-
948
+
956
949
// Exceute the query unprepared because LOAD DATA only works with unprepared statements.
957
950
$ result = $ this ->queryUnprepared ($ sqlSyntax );
958
-
951
+
959
952
// Are there rows modified?
960
953
// Let the user know if the import failed / succeeded
961
954
return (bool ) $ result ;
@@ -974,17 +967,13 @@ public function loadData($importTable, $importFile, $importSettings = null)
974
967
*/
975
968
public function loadXml ($ importTable , $ importFile , $ importSettings = null )
976
969
{
977
- // Define default success var
978
- $ success = false ;
979
-
980
970
// We have to check if the file exists
981
971
if (!file_exists ($ importFile )) {
982
972
// Does not exists
983
973
throw new Exception ("loadXml: Import file does not exists " );
984
974
return ;
985
975
}
986
976
987
-
988
977
// Create default values
989
978
$ settings = Array ("linesToIgnore " => 0 );
990
979
0 commit comments