在laravel中创建表时出现以下错误-
表创建语法-
$sql = 'CREATE TABLE `temp_mobile_03b1effe4c12` (
`id` bigint(20) unsigned NOT NULL,
`mobile` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`operator` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`circle` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`country` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
KEY `temp_mobile_03b1effe4c12_id_index` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci';
DB::connection()->getpdo()->exec($sql);
错误-
[2019-01-08 15:18:38] local.ERROR: ErrorException: Error while sending QUERY packet. PID=6865 in /var/www/html/listmanager/deploy/releases/20190107104605/app/Jobs/UpdateBulkListSubscribers.php:303
Stack trace:
# 0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Error while sen...', '/var/www/html/l...', 303, Array)
# 1 /var/www/html/listmanager/deploy/releases/20190107104605/app/Jobs/UpdateBulkListSubscribers.php(303): PDO->exec('CREATE TABLE t...')
# 2 /var/www/html/listmanager/deploy/releases/20190107104605/app/Jobs/UpdateBulkListSubscribers.php(264): App\Jobs\UpdateBulkListSubscribers::createTempTable('temp_mobile_00d...', Array, Array)
# 3 /var/www/html/listmanager/deploy/releases/20190107104605/app/Jobs/UpdateBulkListSubscribers.php(227): App\Jobs\UpdateBulkListSubscribers->updateMobileInfo()
1条答案
按热度按时间7cwmlq891#
对于laravel:运行常规语句某些数据库语句不返回任何值。对于这些类型的操作,可以在db上使用statement方法。请尝试以下语法
如: