Skip to content

Commit 415a91f

Browse files
committed
Added missing PHPDocs. Added missing test files.
1 parent 6059f7f commit 415a91f

File tree

4 files changed

+70
-4
lines changed

4 files changed

+70
-4
lines changed

MysqliDb.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -970,9 +970,16 @@ public function loadData($importTable, $importFile, $importSettings =
970970
return $success;
971971
}
972972

973-
974-
public function loadXML($importTable, $importFile, $importSettings =
975-
Array("linesToIgnore" => 0))
973+
/**
974+
* This method is usefull for importing XML files into a specific table.
975+
* Check out the LOAD XML syntax for your MySQL server.
976+
*
977+
* @author Jonas Barascu
978+
* @param string $importTable The table in which the data will be imported to.
979+
* @param string $importFile The file which contains the .XML data.
980+
* @return boolean Returns true if the import succeeded, false if it failed.
981+
*/
982+
public function loadXML($importTable, $importFile, $importSettings = Array("linesToIgnore" => 0))
976983
{
977984
// Define default success var
978985
$success = false;
@@ -2080,4 +2087,4 @@ public function paginate ($table, $page, $fields = null) {
20802087
}
20812088
}
20822089

2083-
// END class
2090+
// END class

tests/dataimport/data.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
id;username;name
2+
3;simon;Simon Jarred
3+
4;martin;Martin Fuel
4+
5;example;Example Name 1
5+
6;example2;Example Name 2
6+
7;example3;Example Name 4

tests/dataimport/data.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<list>
2+
<user id="1" username="Kapek" name="Sainnouine" />
3+
<user id="2" username="Sajon" name="Rondela" />
4+
<user id="3">
5+
<username>Likame</username>
6+
<name>Datataa</name>
7+
</user>
8+
</list>

tests/dataimport/users.sql

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
-- phpMyAdmin SQL Dump
2+
-- version 4.5.1
3+
-- http://www.phpmyadmin.net
4+
--
5+
-- Host: 127.0.0.1
6+
-- Erstellungszeit: 27. Jun 2016 um 14:21
7+
-- Server-Version: 10.1.13-MariaDB
8+
-- PHP-Version: 5.6.20
9+
10+
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11+
SET time_zone = "+00:00";
12+
13+
14+
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
15+
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
16+
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
17+
/*!40101 SET NAMES utf8mb4 */;
18+
19+
--
20+
-- Datenbank: `db_test`
21+
--
22+
23+
-- --------------------------------------------------------
24+
25+
--
26+
-- Tabellenstruktur für Tabelle `users`
27+
--
28+
29+
CREATE TABLE `users` (
30+
`id` int(11) NOT NULL,
31+
`username` varchar(32) NOT NULL,
32+
`name` varchar(32) NOT NULL
33+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
34+
35+
--
36+
-- Daten für Tabelle `users`
37+
--
38+
39+
INSERT INTO `users` (`id`, `username`, `name`) VALUES
40+
(1, 'test_1', 'John Doe'),
41+
(2, 'test_2', 'Test User');
42+
43+
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
44+
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
45+
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

0 commit comments

Comments
 (0)