1
0

TitleCrew.class.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * dolphin. Collection of useful PHP skeletons.
  4. * Copyright (C) 2013-2020 Johannes 'Banana' Keßler
  5. *
  6. * https://www.bananas-playground.net
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
  10. *
  11. * You should have received a copy of the
  12. * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
  13. * along with this program. If not, see http://www.sun.com/cddl/cddl.html
  14. */
  15. /**
  16. * Class TitleCrew
  17. * Import the data from imdb dataset title.crew.tsv
  18. */
  19. class TitleCrew extends TSVImport {
  20. /**
  21. * @inheritDoc
  22. */
  23. public function setup() {
  24. $this->_db_table_name = 'title_crew';
  25. $this->_db_table_crate_str = "CREATE TABLE `".$this->_db_table_name."` (
  26. `tconst` varchar(16) COLLATE utf8mb4_bin NOT NULL,
  27. `directors` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  28. `writers` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
  29. UNIQUE KEY `tconst` (`tconst`)
  30. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin";
  31. }
  32. /**
  33. * @inheritDoc
  34. */
  35. public function queryValuePart($data) {
  36. $ret = '';
  37. if(!empty($data)) {
  38. if(!isset($data[2])) {
  39. return $ret;
  40. }
  41. $ret .= "(
  42. '".$this->_DB->real_escape_string($data[0])."',
  43. '".$this->_DB->real_escape_string($data[1])."',
  44. '".$this->_DB->real_escape_string($data[2])."'
  45. )";
  46. }
  47. return $ret;
  48. }
  49. }