コード例 #1
0
 con.execute('select id, big_sample from sampletable1 where id=100;', null, function (err, result) {
   if (err) test.fail(err);
   else {
     test.equal(big.toOctetString(), result.rows[0].get('big_sample').toOctetString(), 'Retrieved bigint does not match.');
   }
   test.done();
   return;
 });
コード例 #2
0
        fs.read(fd, footer, 0, kFooterEncodedLength, stats.size - kFooterEncodedLength, function (err, len) {
          if (err)
            return ee.emit('error', err)

          if (len != kFooterEncodedLength)
            return ee.emit('error', new Error('problem reading table file footer')) // eh?

          var magic = coding.readFullInt64(footer, kFooterEncodedLength - 8)
          if (magic.toOctetString() != kTableMagicNumber.toOctetString())
            ee.emit('error', new Error('corrupt table file, bad magic number'))

          var pos = 0
            , metaIndex
            , index
            , tmp = coding.readBlockHandle(footer, pos)

          metaIndex = tmp[0]
          tmp = coding.readBlockHandle(footer, pos += tmp[1])
          index = tmp[0]

          readBlock(fd, metaIndex, function (err, data) {
            if (err)
              return ee.emit('error', err)

            console.log('meta:', metaIndex, 'data', data)
          })

          readBlock(fd, index, function (err, data) {
            if (err)
              return ee.emit('error', err)

            console.log('index:', index, 'data', data)

            processIndex(fd, data, function (err) {
              if (err)
                ee.emit('error')
              ee.emit('done')
            })
          })
        })