Error Info: Array ( [0] => HY000 [1] => 1467 [2] => Failed to read auto-increment value from storage engine )
in /data1000/app/frameworks/yii2/vendor/yiisoft/yii2/db/Command.php at line 844
$exceptionClass = '\yii\db\Exception'; foreach ($this->exceptionMap as $error => $class) { if (strpos($e->getMessage(), $error) !== false) { $exceptionClass = $class; } } $message = $e->getMessage() . "\nThe SQL being executed was: $rawSql"; $errorInfo = $e instanceof \PDOException ? $e->errorInfo : null; return new $exceptionClass($message, $errorInfo, (int) $e->getCode(), $e); } /** * Returns a value indicating whether a SQL statement is for read purpose. * @param string $sql the SQL statement * @return boolean whether a SQL statement is for read purpose. */ public function isReadQuery($sql) {
$this->refreshTableSchema(); return $n; } catch (\Exception $e) { Yii::endProfile($token, __METHOD__); throw $this->db->getSchema()->convertException($e, $rawSql); } } /** * Performs the actual DB query of a SQL statement. * @param string $method method of PDOStatement to be called
* @return array|false primary key values or false if the command fails * @since 2.0.4 */ public function insert($table, $columns) { $command = $this->db->createCommand()->insert($table, $columns); if (!$command->execute()) { return false; } $tableSchema = $this->getTableSchema($table); $result = []; foreach ($tableSchema->primaryKey as $name) { if ($tableSchema->columns[$name]->autoIncrement) {
protected function insertInternal($attributes = null) { if (!$this->beforeSave(true)) { return false; } $values = $this->getDirtyAttributes($attributes); if (($primaryKeys = static::getDb()->schema->insert(static::tableName(), $values)) === false) { return false; } foreach ($primaryKeys as $name => $value) { $id = static::getTableSchema()->columns[$name]->phpTypecast($value); $this->setAttribute($name, $id); $values[$name] = $id;
if ($runValidation && !$this->validate($attributes)) { Yii::info('Model not inserted due to validation error.', __METHOD__); return false; } if (!$this->isTransactional(self::OP_INSERT)) { return $this->insertInternal($attributes); } $transaction = static::getDb()->beginTransaction(); try { $result = $this->insertInternal($attributes); if ($result === false) {
* meaning all attributes that are loaded from DB will be saved. * @return boolean whether the saving succeeded (i.e. no validation errors occurred). */ public function save($runValidation = true, $attributeNames = null) { if ($this->getIsNewRecord()) { return $this->insert($runValidation, $attributeNames); } else { return $this->update($runValidation, $attributeNames) !== false; } } /**
$accessToken->CREATE_DATE = time(); $accessToken->UPDATE_USER = 0; $accessToken->UPDATE_DATE = time(); $accessToken->SHOP_ID = $shopProfile->ID; $accessToken->ACCESS_TOKEN = AccessToken::generateAccessToken(); $accessToken->REMOTE_IP = Yii::$app->request->getUserIP(); $accessToken->save(); $return['status'] = 'Y'; $return['msg'] = ''; $return['token'] = $accessToken->ACCESS_TOKEN; $return['type'] = $shopProfile->isPublic() ? 'public' : 'shop'; $return['shop_id'] = $accessToken->SHOP_ID;
} // set access token if (!isset(Yii::$app->session['API_TOKEN']) || AccessToken::findToken(Yii::$app->session['API_TOKEN']) == null) { $model = new \common\apis\ApiAuth(); $return = $model->call(['app_id' => Yii::$app->params['secretKey'], 'locale' => Yii::$app->language]); if ($return['status'] == 'Y') { Yii::$app->session['API_TOKEN'] = $return['token']; Yii::$app->session->remove('user'); Yii::$app->session['TYPE'] = $return['type'];
use ZipArchive as ZipArchive; class TshopController extends MasterController { public function beforeAction($action) { if (parent::beforeAction($action)) { // get config file $this->view->params['theme_config'] = require(__DIR__ . '/../../common/config/tshop-config.php'); // set asset $this->view->params['asset'] = '\\frontend\\assets\\TshopAsset';
use common\models\Page; class TshopV2Controller extends TshopController { public function beforeAction($action) { if (parent::beforeAction($action)) { // get config file $this->view->params['theme_config'] = require(__DIR__ . '/../../common/config/tshop-v2-config.php'); // set asset $this->view->params['asset'] = '\\frontend\\assets\\TshopV2Asset';
break; } } $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; } else {
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$application = new yii\web\Application($config); //Change the UrlFormat for urlManager to get if a get request is given instead of a path format one. if (isset($_GET['r'])) { Yii::$app->urlManager->enablePrettyUrl = false; } $application->run();
$_GET = [ 'id' => '3', 'lang' => 'EN_US', ]; $_SESSION = [ '__flash' => [], 'lang' => 'EN_US', ];