How to use the mysql2/lib/constants/client.js.COMPRESS function in mysql2

To help you get started, we’ve selected a few mysql2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sidorares / node-mysql2 / examples / mysqlproxy.js View on Github external
server.on('connection', conn => {
  console.log('connection');

  conn.serverHandshake({
    protocolVersion: 10,
    serverVersion: 'node.js rocks',
    connectionId: 1234,
    statusFlags: 2,
    characterSet: 8,
    capabilityFlags: 0xffffff ^ ClientFlags.COMPRESS
  });

  conn.on('field_list', (table, fields) => {
    console.log('field list:', table, fields);
    conn.writeEof();
  });

  const remote = mysql.createConnection({
    user: 'root',
    database: 'dbname',
    host: 'server.example.com',
    password: 'secret'
  });

  conn.on('query', sql => {
    console.log(`proxying query: ${sql}`);
github gajus / seeql / src / index.js View on Github external
server.on('connection', (connection) => {
  debug('received client connection request');

  connection.serverHandshake({
    capabilityFlags: 0xffffff ^ ClientFlags.COMPRESS,
    characterSet: 8,
    connectionId: connectionId++,
    protocolVersion: 10,
    serverVersion: '5.6.10',
    statusFlags: 2
  });

  const remote = mysql.createConnection(createDatabaseConnectionConfiguration(argv));

  connection.on('error', (error) => {
    debug('connection error', error.message);
  });

  connection.on('field_list', (targetTable, fields) => {
    debug('field_list', targetTable, fields);