1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?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 TitleEpisode
- * Import the data from imdb dataset title.episode.tsv
- */
- class TitleEpisode extends TSVImport {
- /**
- * @inheritDoc
- */
- public function setup() {
- $this->_db_table_name = 'title_episode';
- $this->_db_table_crate_str = "CREATE TABLE `".$this->_db_table_name."` (
- `tconst` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
- `parentTconst` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
- `seasonNumber` int NOT NULL,
- `episodeNumber` int 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[3])) {
- return $ret;
- }
- $ret .= "(
- '".$this->_DB->real_escape_string($data[0])."',
- '".$this->_DB->real_escape_string($data[1])."',
- '".$this->_DB->real_escape_string($data[2])."',
- '".$this->_DB->real_escape_string($data[3])."'
- )";
- }
- return $ret;
- }
- }
|