Renames the service configuration if necessary.

@param array $stmts List of SQL statements to execute.
550997
protected function _process( array $stmts )
	{
		$this->_msg( 'Renaming service configuration', 0 );

		if( $this->_schema->tableExists( 'mshop_service' )
			&& $this->_schema->columnExists( 'mshop_service', 'config' ) === true
		) {
			$cntRows = 0;

			foreach( $stmts as $stmt )
			{
				$result = $this->_conn->create( $stmt )->execute();
				$cntRows += $result->affectedRows();
				$result->finish();
			}

			if( $cntRows > 0 ) {
				$this->_status( sprintf( 'done (%1$d)', $cntRows ) );
			} else {
				$this->_status( 'OK' );
			}
		}
		else
		{
			$this->_status( 'OK' );
		}
	}
1009996
public function addStmt($stmt)
    {
        if (method_exists($stmt, 'isMixinCode')) {
            $name = strval($stmt->getName());
        } else {
            $stmt = self::getStmtNode($stmt);
            $name = isset($stmt->name) ? strval($stmt->name) : null;
        }
        $type = $stmt->getType();
        switch ($type) {
            case 'Stmt_Namespace':
                $this->namespaces[$name] = $this->offset;
                break;
            case 'Stmt_Class':
            case 'Stmt_Interface':
            case 'Stmt_Trait':
                $stmt = new Code\ClassCode($stmt);
                // no break
            case 'ClassCode':
                $this->classes[$name] = $this->offset;
                break;
            case 'Stmt_Function':
                $stmt = new Code\FunctionCode($stmt);
                // no break
            case 'FunctionCode':
                $name = strtolower($name);
                $this->functions[$name] = $this->offset;
                break;
        }
        $this->stmts[$this->offset++] = $stmt;
        return $this;
    }
957754
protected function process( array $stmts )
	{
		$table = 'users_address';
		$this->msg( sprintf( 'Rename "refid" to "parentid" in table "%1$s"', $table ), 0 ); $this->status( '' );

		foreach( $stmts as $column => $stmts )
		{
			$this->msg( sprintf( 'Checking column "%1$s"', $column ), 1 );

			if( $this->schema->tableExists( $table )
				&& $this->schema->columnExists( $table, $column ) === true
			) {
				$this->executeList( $stmts );
				$this->status( 'done' );
			} else {
				$this->status( 'OK' );
			}
		}
	}
661388
public static function executeStmt($stmt, $types, $inserts) {
        self::init();
        try {
            if(!$stmt) {
                throw new DbException('Statement not established');
            } elseif(!$stmt->bind_param($types, ...$inserts)) {
                throw new DbException('Binding error');
            }
            $stmt->execute();
        } catch(DbException $e) {
            self::$_ops->formatError($inserts, $e->getMessage());
        } finally {
            return self::evaluateQuery($stmt);
        }

    }
1068925
protected function _process( array $stmts )
	{
		$this->_msg( 'Changing attribute value type in order domain', 0 );
		$this->_status( '' );

		foreach( $stmts as $table => $stmts )
		{
			$this->_msg( sprintf( 'Checking table "%1$s": ', $table ), 1 );

			if( $this->_schema->tableExists( $table ) === true &&
				$this->_schema->columnExists( $table, 'value' ) === true &&
				$this->_schema->getColumnDetails( $table, 'value' )->getDataType() === 'varchar'
			) {
				foreach( $stmts['index'] as $index => $sql )
				{
					if( $this->_schema->indexExists( $table, $index ) === true ) {
						$this->_execute( $sql );
					}
				}

				$this->_execute( $stmts['column'] );
				$this->_status( 'changed' );
			}
			else
			{
				$this->_status( 'OK' );
			}
		}
	}
1294128
public function hydrateAll($stmt, $resultSetMapping, array $hints = array())
    {
        $this->_stmt  = $stmt;
        $this->_rsm   = $resultSetMapping;
        $this->_hints = $hints;

        $this->prepare();

        $result = $this->hydrateAllData();

        $this->cleanup();

        return $result;
    }
1185986
protected function process( array $stmts )
	{
		$this->msg( 'Removing locale constraints from customer tables', 0 );
		$this->status( '' );

		$schema = $this->getSchema( 'db-customer' );

		foreach( $stmts as $table => $list )
		{
			if( $schema->tableExists( $table ) === true )
			{
				foreach( $list as $constraint => $stmt )
				{
					$this->msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 );

					if( $schema->constraintExists( $table, $constraint ) !== false )
					{
						$this->execute( $stmt, 'db-customer' );
						$this->status( 'done' );
					} else {
						$this->status( 'OK' );
					}
				}
			}
		}
	}
394041
public static function setMetas(array $metas, bool $replace_existing=false) :void {
		// if we want to purge existing metas
		!$replace_existing ?: self::$_metas = [];
		// name is the key for storing metas
		self::$_metas += $metas;
	}
1175780
public function rename($from, $to)
    {
        $this->build(tap($this->createBlueprint($from), function ($blueprint) use ($to) {
            $blueprint->rename($to);
        }));
    }
345836
public static function doesEverBreak(array $stmts)
    {
        if (empty($stmts)) {
            return false;
        }

        for ($i = count($stmts) - 1; $i >= 0; --$i) {
            $stmt = $stmts[$i];

            if ($stmt instanceof PhpParser\Node\Stmt\Break_) {
                return true;
            }

            if ($stmt instanceof PhpParser\Node\Stmt\If_) {
                if (self::doesEverBreak($stmt->stmts)) {
                    return true;
                }

                if ($stmt->else && self::doesEverBreak($stmt->else->stmts)) {
                    return true;
                }

                foreach ($stmt->elseifs as $elseif) {
                    if (self::doesEverBreak($elseif->stmts)) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
1288227
public function setSmtpConfig($swiftSmtpTransport, $attributes)
    {
        foreach ($attributes as $key => $value) {
            $method = 'set'.ucfirst($key);
            $swiftSmtpTransport->{$method}($value);
        }
    }
1365933
public function addBindingsToStatement(PDOStatement $stmt, array $bindings)
    {
        foreach ($bindings as $key => &$binding) {
            $value  = &$binding;
            $type   = PDO::PARAM_STR;
            $length = -1;

            if (is_array($binding)) {
                $value  = &$binding['value'];
                $type   = array_key_exists('type', $binding) ? $binding['type'] : PDO::PARAM_STR;
                $length = array_key_exists('length', $binding) ? $binding['length'] : -1;
            }

            $stmt->bindParam(':' . $key, $value, $type, $length);
        }

        return $stmt;
    }
1250356
protected function _process( array $stmts )
	{
		$this->_msg( 'Migrating "Complete" to "BasketLimits" plugin', 0 ); $this->_status( '' );

		if( $this->_schema->columnExists( 'mshop_plugin', 'config' ) === true
			&& $this->_schema->columnExists( 'mshop_plugin', 'provider' ) === true
		) {
			foreach( $stmts as $key => $list )
			{
				$this->_msg( sprintf( 'Migrating "%1$s"', $key ), 1 );

				if( $this->_getValue( $list['select'], 'cnt' ) > 0 )
				{
					$this->_execute( $list['update'] );
					$this->_status( 'migrated' );
				}
				else
				{
					$this->_status( 'OK' );
				}
			}
		}
	}
1144038
protected function setStmtError($stmt = null)
    {
        if ($stmt) {
            $this->setErrorCode(db2_stmt_error($stmt));
            $this->setErrorMsg(db2_stmt_errormsg($stmt));
        } else {
            $this->setErrorCode(db2_stmt_error());
            $this->setErrorMsg(db2_stmt_errormsg());
        }        
    }
1308951
public function renameShowTab($tabName, $newTabName, $keepOrder = true)
    {
        $tabs = $this->getShowTabs();

        if (!$tabs) {
            return;
        }

        if (!isset($tabs[$tabName])) {
            throw new \Exception(sprintf('Tab %s does not exist.', $tabName));
        }
        if (isset($tabs[$newTabName])) {
            return;
        }

        if ($keepOrder) {
            $keys = array_keys($tabs);
            $keys[array_search($tabName, $keys)] = $newTabName;
            $tabs = array_combine($keys, $tabs);
        } else {
            $tabs[$newTabName] = $tabs[$tabName];
            unset($tabs[$tabName]);
        }

        $this->setShowTabs($tabs);
    }
668726
function replace($table, $data, $stmt_key = null)
    {
        return $this->executeBySyntax(self::REPLACE, $table, $data, null, array(), $stmt_key);
    }
415093
protected function processStatements(array $statements, string $prefix = ''): void
    {
        $uses = [];

        foreach ($statements as $statement) {
            if ($statement instanceof Namespace_) {
                $this->processStatements($statement->stmts, (string)$statement->name);

                return;
            }

            if ($statement instanceof Use_) {
                foreach ($statement->uses as $use) {
                    /** @var Identifier $aliasIdentifier */
                    $aliasIdentifier = $use->alias;
                    if (empty($aliasIdentifier->name)) {
                        $parts = $use->name->parts;
                        $alias = (string)end($parts);
                    } else {
                        $alias = $aliasIdentifier->name;
                    }

                    $uses[$alias] = $use->name->toString();
                }
            }

            if ($statement instanceof Class_) {
                $this->processClassStatement($statement, $prefix, $uses);
            }
        }
    }