PHP 7.4.33
Preview: command.js Size: 1.23 KB
/var/www/receipt-app-backend-bitkit.dk/httpdocs/node_modules/mysql2/lib/commands/command.js
'use strict';

const EventEmitter = require('events').EventEmitter;
const Timers = require('timers');

class Command extends EventEmitter {
  constructor() {
    super();
    this.next = null;
  }

  // slow. debug only
  stateName() {
    const state = this.next;
    for (const i in this) {
      if (this[i] === state && i !== 'next') {
        return i;
      }
    }
    return 'unknown name';
  }

  execute(packet, connection) {
    if (!this.next) {
      this.next = this.start;
      connection._resetSequenceId();
    }
    if (packet && packet.isError()) {
      const err = packet.asError(connection.clientEncoding);
      err.sql = this.sql || this.query;
      if (this.queryTimeout) {
        Timers.clearTimeout(this.queryTimeout);
        this.queryTimeout = null;
      }
      if (this.onResult) {
        this.onResult(err);
        this.emit('end');
      } else {
        this.emit('error', err);
        this.emit('end');
      }
      return true;
    }
    // TODO: don't return anything from execute, it's ugly and error-prone. Listen for 'end' event in connection
    this.next = this.next(packet, connection);
    if (this.next) {
      return false;
    }
    this.emit('end');
    return true;
  }
}

module.exports = Command;

Directory Contents

Dirs: 0 × Files: 15
Name Size Perms Modified Actions
5.06 KB lrw-r--r-- 2026-05-06 08:23:46
Edit Download
2.85 KB lrw-r--r-- 2026-05-06 08:23:46
Edit Download
2.64 KB lrw-r--r-- 2026-05-06 08:23:46
Edit Download
13.55 KB lrw-r--r-- 2026-05-06 08:23:46
Edit Download
361 B lrw-r--r-- 2026-05-06 08:23:46
Edit Download
1.23 KB lrw-r--r-- 2026-05-06 08:23:46
Edit Download
3.98 KB lrw-r--r-- 2026-05-06 08:23:47
Edit Download
774 B lrw-r--r-- 2026-05-06 08:23:47
Edit Download
817 B lrw-r--r-- 2026-05-06 08:23:47
Edit Download
3.96 KB lrw-r--r-- 2026-05-06 08:23:47
Edit Download
10.72 KB lrw-r--r-- 2026-05-06 08:23:47
Edit Download
575 B lrw-r--r-- 2026-05-06 08:23:47
Edit Download
592 B lrw-r--r-- 2026-05-06 08:23:47
Edit Download
675 B lrw-r--r-- 2026-05-06 08:23:47
Edit Download
6.47 KB lrw-r--r-- 2026-05-06 08:23:47
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).