123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /**
- * dolphin. Collection of useful PHP skeletons.
- * Copyright (C) 2013-2020 Johannes 'Banana' Keßler
- *
- * https://www.bananas-playground.net
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
- *
- * You should have received a copy of the
- * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
- * along with this program. If not, see http://www.sun.com/cddl/cddl.html
- */
- /**
- * Class TitleCrew
- * Import the data from imdb dataset title.crew.tsv
- */
- class TitleCrew extends TSVImport {
- /**
- * @inheritDoc
- */
- public function setup() {
- $this->_db_table_name = 'title_crew';
- $this->_db_table_crate_str = "CREATE TABLE `".$this->_db_table_name."` (
- `tconst` varchar(16) COLLATE utf8mb4_bin NOT NULL,
- `directors` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
- `writers` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
- UNIQUE KEY `tconst` (`tconst`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin";
- }
- /**
- * @inheritDoc
- */
- public function queryValuePart($data) {
- $ret = '';
- if(!empty($data)) {
- if(!isset($data[2])) {
- return $ret;
- }
- $ret .= "(
- '".$this->_DB->real_escape_string($data[0])."',
- '".$this->_DB->real_escape_string($data[1])."',
- '".$this->_DB->real_escape_string($data[2])."'
- )";
- }
- return $ret;
- }
- }
|