private function getTabSql($struct, $tab, $removeDatabase = true)
    {
        $result = '';
        $database = '';
        $tableDef = '';

        /* create table should be single line in this case*/
        // 1 - part before database, 2-database name, 3 - part after database
        if (preg_match('/(CREATE(?:\s*TEMPORARY)?\s*TABLE\s*(?:IF NOT EXISTS\s*)?)(?:`?(\w+)`?\.)?(`?(' . $tab . ')`?(\W|$))/i', $struct, $m, PREG_OFFSET_CAPTURE)) {
            $tableDef = $m[0][0];
            $start = $m[0][1];
            $database = $m[2][0];
            $offset = $start + strlen($m[0][0]);
            $end = $this->getDelimiterPos($struct, $offset);
            if ($end === false) {
                $result = substr($struct, $start);
            } else {
                $result = substr($struct, $start, $end - $start);//already without ';'
            }
        }

        $result = trim($result);
        if ($database && $removeDatabase) {
            $result = str_replace($tableDef, $m[1][0] . $m[3][0], $result);
        }

        return $result;
    }