monetdb 1.3.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/Linux.yml +45 -0
- package/.github/workflows/docs.yml +79 -0
- package/.github/workflows/macos.yml +43 -0
- package/.github/workflows/monetdb-versions.yml +43 -0
- package/README.md +43 -512
- package/docs/components/alert.tsx +10 -0
- package/docs/components/info.tsx +6 -0
- package/docs/next.config.js +24 -0
- package/docs/package-lock.json +5069 -0
- package/docs/package.json +22 -0
- package/docs/pages/_app.js +9 -0
- package/docs/pages/_meta.json +16 -0
- package/docs/pages/apis/_meta.json +4 -0
- package/docs/pages/apis/connection.mdx +60 -0
- package/docs/pages/apis/result.mdx +39 -0
- package/docs/pages/index.mdx +27 -0
- package/docs/theme.config.js +35 -0
- package/docs/v1/README.md +532 -0
- package/package.json +17 -21
- package/src/PrepareStatement.ts +37 -0
- package/src/connection.ts +125 -0
- package/src/defaults.ts +13 -0
- package/src/file-transfer.ts +173 -0
- package/src/index.ts +3 -0
- package/src/mapi.ts +1016 -0
- package/src/monetize.ts +67 -0
- package/test/connection.ts +43 -0
- package/test/exec-queries.ts +100 -0
- package/test/filetransfer.ts +94 -0
- package/test/prepare-statement.ts +27 -0
- package/test/query-stream.ts +41 -0
- package/test/tmp/.gitignore +4 -0
- package/tsconfig.json +24 -0
- package/.travis.yml +0 -11
- package/index.js +0 -5
- package/src/mapi-connection.js +0 -784
- package/src/monetdb-connection.js +0 -385
- package/src/utils.js +0 -27
- package/test/common.js +0 -45
- package/test/install-monetdb.sh +0 -11
- package/test/monetdb_stream.js +0 -106
- package/test/start-monetdb.sh +0 -38
- package/test/test.js +0 -908
- package/test/test_connection.js +0 -290
- /package/docs/{README.v0.md → v0/README.v0.md} +0 -0
- /package/docs/{MapiConnection.md → v1/MapiConnection.md} +0 -0
- /package/docs/{v1-notes.md → v1/v1-notes.md} +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"name": "docs",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "next.config.js",
|
6
|
+
"scripts": {
|
7
|
+
"start": "next dev",
|
8
|
+
"build": "next build"
|
9
|
+
},
|
10
|
+
"keywords": [],
|
11
|
+
"author": {
|
12
|
+
"name": "Svetlin Stalinov",
|
13
|
+
"email": "svetlin.stalinov@monetdbsolutions.com"
|
14
|
+
},
|
15
|
+
"dependencies": {
|
16
|
+
"next": "^14.0.1",
|
17
|
+
"nextra": "^2.13.2",
|
18
|
+
"nextra-theme-docs": "^2.13.2",
|
19
|
+
"react": "^18.2.0",
|
20
|
+
"react-dom": "^18.2.0"
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"index": "Getting Started",
|
3
|
+
"apis": "API",
|
4
|
+
"example": "Examples",
|
5
|
+
"versions": {
|
6
|
+
"title": "archive",
|
7
|
+
"type": "menu",
|
8
|
+
"items": {
|
9
|
+
"v0": {
|
10
|
+
"title": "v0",
|
11
|
+
"href": "https://github.com/MonetDB/monetdb-nodejs/blob/master/docs/v0"},
|
12
|
+
"v1": {
|
13
|
+
"title": "v1",
|
14
|
+
"href": "https://github.com/MonetDB/monetdb-nodejs/blob/master/docs/v1"}}
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
## Connecting
|
2
|
+
```ts
|
3
|
+
const conn = new Connection(config: MapiConfig | string);
|
4
|
+
```
|
5
|
+
, all the optional fields get default values if not specified.
|
6
|
+
### Using configuration options
|
7
|
+
```ts
|
8
|
+
interface MapiConfig {
|
9
|
+
database: string;
|
10
|
+
username?: string;
|
11
|
+
password?: string;
|
12
|
+
language?: MAPI_LANGUAGE; // sql
|
13
|
+
host?: string;
|
14
|
+
port?: number;
|
15
|
+
timeout?: number;
|
16
|
+
autoCommit?: boolean;
|
17
|
+
replySize?: number;
|
18
|
+
}
|
19
|
+
|
20
|
+
const defaults = {
|
21
|
+
host: process.env.MAPI_HOST || 'localhost',
|
22
|
+
port: process.env.MAPI_PORT || 50000,
|
23
|
+
username: process.env.MAPI_USER || 'monetdb',
|
24
|
+
password: process.env.MAPI_PASSWORD || 'monetdb',
|
25
|
+
database: process.env.MAPI_DATABASE,
|
26
|
+
autoCommit: false,
|
27
|
+
replySize: 100,
|
28
|
+
};
|
29
|
+
|
30
|
+
const config: MapiConfig = {
|
31
|
+
...defaults
|
32
|
+
database: 'test',
|
33
|
+
}
|
34
|
+
const conn = new Connection(config);
|
35
|
+
```
|
36
|
+
### Using URL
|
37
|
+
```ts
|
38
|
+
const conn = new Connection('mapi:monetdb://<username>:<password>@<hostname>:<port>/<database>');
|
39
|
+
```
|
40
|
+
### Connection object
|
41
|
+
```ts
|
42
|
+
declare class Connection extends EventEmitter {
|
43
|
+
autoCommit?: boolean;
|
44
|
+
replySize?: number;
|
45
|
+
sizeHeader?: boolean;
|
46
|
+
mapi: MapiConnection;
|
47
|
+
constructor(params: MapiConfig | MAPI_URI);
|
48
|
+
connect(callback?: ConnectCallback): Promise<boolean>;
|
49
|
+
close(): Promise<boolean>;
|
50
|
+
commit(): Promise<any>;
|
51
|
+
private command;
|
52
|
+
execute(sql: string, stream?: boolean): Promise<QueryResult|QueryStream>;
|
53
|
+
prepare(sql: string): Promise<PrepareStatement>;
|
54
|
+
setAutocommit(v: boolean): Promise<boolean>;
|
55
|
+
setReplySize(v: number): Promise<number>;
|
56
|
+
setSizeHeader(v: boolean): Promise<boolean>;
|
57
|
+
setTimezone(sec: number): Promise<any>;
|
58
|
+
rollback(): Promise<any>;
|
59
|
+
}
|
60
|
+
```
|
@@ -0,0 +1,39 @@
|
|
1
|
+
## Query Result
|
2
|
+
The result object returned from sucessful query execution.
|
3
|
+
```ts
|
4
|
+
type QueryResult = {
|
5
|
+
id?: number;
|
6
|
+
type?: string;
|
7
|
+
queryId?: number;
|
8
|
+
rowCnt?: number;
|
9
|
+
affectedRows?: number;
|
10
|
+
columnCnt?: number;
|
11
|
+
queryTime?: number;
|
12
|
+
sqlOptimizerTime?: number;
|
13
|
+
malOptimizerTime?: number;
|
14
|
+
columns?: Column[];
|
15
|
+
headers?: ResponseHeaders;
|
16
|
+
data?: any[];
|
17
|
+
};
|
18
|
+
import { Connection } from 'monetdb';
|
19
|
+
const conn = new Connection({database: 'test'});
|
20
|
+
const ready = await conn.connect();
|
21
|
+
const res: QueryResult = await conn.execute('select 1 as one, 2 as two');
|
22
|
+
console.log(res);
|
23
|
+
// {
|
24
|
+
// type: '&1',
|
25
|
+
// id: 1,
|
26
|
+
// rowCnt: 1,
|
27
|
+
// columnCnt: 2,
|
28
|
+
// queryId: 37,
|
29
|
+
// queryTime: 311,
|
30
|
+
// malOptimizerTime: 129,
|
31
|
+
// sqlOptimizerTime: 22,
|
32
|
+
// columns: [
|
33
|
+
// { table: '.', name: 'one', type: 'tinyint', index: 0 },
|
34
|
+
// { table: '.', name: 'two', type: 'tinyint', index: 1 }
|
35
|
+
// ],
|
36
|
+
// data: [ [ 1, 2 ] ]
|
37
|
+
// }
|
38
|
+
|
39
|
+
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: Getting Started
|
3
|
+
slug: /
|
4
|
+
---
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
```bash
|
9
|
+
$ npm install monetdb
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
The simplest way to connect is to use default connection options and pass only the database name.
|
14
|
+
|
15
|
+
```js
|
16
|
+
import { Connection} from 'monetdb'
|
17
|
+
|
18
|
+
const opt = {database: 'test'}
|
19
|
+
|
20
|
+
const conn = new Connection(opt)
|
21
|
+
const ready = await conn.connect();
|
22
|
+
const res = conn.exec('select 42');
|
23
|
+
console.log(res.data)
|
24
|
+
await conn.close();
|
25
|
+
```
|
26
|
+
, see [connection api](/apis/connection) for more details.
|
27
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// theme.config.js
|
2
|
+
export default {
|
3
|
+
project: {
|
4
|
+
link: 'https://github.com/MonetDB/monetdb-nodejs',
|
5
|
+
},
|
6
|
+
docsRepositoryBase: 'https://github.com/MonetDB/monetdb-nodejs/blob/master/docs', // base URL for the docs repository
|
7
|
+
darkMode: true,
|
8
|
+
footer: true,
|
9
|
+
navigation: {
|
10
|
+
prev: true,
|
11
|
+
next: true,
|
12
|
+
},
|
13
|
+
footer: {
|
14
|
+
text: `Mozilla Public License, v.2.0 ${new Date().getFullYear()}`,
|
15
|
+
},
|
16
|
+
editLink: {
|
17
|
+
text: 'Edit this page on GitHub',
|
18
|
+
},
|
19
|
+
logo: (
|
20
|
+
<>
|
21
|
+
<span>monetdb-nodejs</span>
|
22
|
+
</>
|
23
|
+
),
|
24
|
+
head: (
|
25
|
+
<>
|
26
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
27
|
+
<meta
|
28
|
+
name="description"
|
29
|
+
content="MonetDB Node.js connector"
|
30
|
+
/>
|
31
|
+
<meta name="og:title" content="monetdb-nodejs" />
|
32
|
+
<meta name="og:description" content="MonetDB Node.js driver" />
|
33
|
+
</>
|
34
|
+
),
|
35
|
+
}
|