Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

any-db-adapter-spec

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-db-adapter-spec - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

tests/modification-counts.js

4

interfaces/queryable.js

@@ -99,3 +99,3 @@ var inOrder = require('assert-in-order')

function testEventsQueryError (queryable, test, name) {
test.plan(6)
test.plan(5)

@@ -107,3 +107,3 @@ var emittedClose = false

var query = queryable.query('not a valid SQL statement', function (err, result) {
test.ok(emittedClose, 'callback called after query.emit("close")')
//test.ok(emittedClose, 'callback called after query.emit("close")')
test.ok(!emittedError, 'callback is first listener to query.emit("error")')

@@ -110,0 +110,0 @@ test.ok(!emittedEnd, 'callback before query.emit("end")')

{
"name": "any-db-adapter-spec",
"version": "2.1.1",
"version": "2.1.2",
"description": "Specification and test suite for any-db adapters",

@@ -5,0 +5,0 @@ "main": "test-any-db-adapter.js",

@@ -76,4 +76,10 @@ # Any-DB API

- `'query', query` - Emitted immediately before a query is executed.
#### Query event
The `'query'` event is emitted immediately before a query is executed.
One argument is passed to event handlers:
* `query` - a [Query][] object
## Connection

@@ -113,5 +119,14 @@

* `'error', err` - Emitted when there is a connection-level error.
* `'close'` - Emitted when the connection has been closed.
#### Error event
The `'error'` event is emitted when there is a connection-level error.
No arguments are passed to event listeners.
#### Close event
The `'close'` event is emitted when the connection has been closed.
No arguments are passed to event listeners.
## Query

@@ -157,14 +172,44 @@

* `'error', error` - Emitted at most once per query. Note that this event will
be emitted for errors even if a callback was provided, the callback will
simply be subscribed to the 'error' event.
* `'fields', fields` - An array of [Field][ResultSet] objects emitted before
any `'data'` events.
#### Error event
The following events are part of the [Readable][] interface:
The `'error'` event is emitted at most once per query. Note that this event will
be emitted for errors even if a callback was provided, the callback will simply
be subscribed to the `'error'` event.
* `'data', row` - Emitted for each row in the query result set.
* `'close'` - Emitted when the query completes.
* `'end'` - Emitted after all query results have been consumed.
One argument is passed to event listeners:
* `error` - the error object.
#### Fields event
A `'fields'` event is emmitted before any `'data'` events.
One argument is passed to event listeners:
* `fields` - an array of [Field][ResultSet] objects.
### [Readable][] events
The following events are part of the [Readable][] interface which is implemented by Query:
#### Data event
A `'data'` event is emitted for each row in the query result set.
One argument is passed to event listeners:
* `row` contains the contents of a single row in the query result
#### Close event
A `'close'` event is emitted when the query completes.
No arguments are passed to event listeners.
#### End event
An `'end'` event is emitted after all query results have been consumed.
No arguments are passed to event listeners.
## ResultSet

@@ -224,2 +269,3 @@

(text: String, params: Array?, Continuation<ResultSet>?) => Query
(Query) => Query {* returns same Query *}
```

@@ -256,2 +302,3 @@

[test suite]: tests
[Adapter]: #adapter
[Queryable]: #queryable

@@ -258,0 +305,0 @@ [Queryable.query]: #queryablequery

@@ -9,11 +9,12 @@ require('../test')("Last insert id", function (conn, t) {

conn.query("DROP TABLE last_insert_id_test", function (err) {})
if (conn.adapter.name == 'sqlite3')
if (conn.adapter.name == 'sqlite3') {
conn.query("CREATE TABLE last_insert_id_test (id integer primary key autoincrement, a int)")
else if (conn.adapter.name == 'mysql')
{
}
else if (conn.adapter.name == 'mysql') {
conn.query("CREATE TABLE last_insert_id_test (id integer primary key auto_increment, a int)")
}
}
else {
throw new Error("Unknown adapter: " + conn.adapter.name)
}
else throw new Error("Unknown adapter: " + conn.adapter.name)
conn.query('INSERT INTO last_insert_id_test (a) VALUES (123)', function (err, res) {

@@ -20,0 +21,0 @@ if (err) throw err

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc