Giter Site home page Giter Site logo

dlwicksell / nodem Goto Github PK

View Code? Open in Web Editor NEW
66.0 27.0 15.0 1.5 MB

A YottaDB and GT.M database driver and language binding for Node.js

License: GNU Affero General Public License v3.0

Python 0.46% JavaScript 0.97% C++ 89.48% M 8.27% Shell 0.82%
c-plus-plus m mumps yottadb gtm javascript

nodem's People

Contributors

christopheredwards avatar dlwicksell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodem's Issues

GT.M bindings/drivers for AIX System

Hi , good work beforehand.

We are currently using your module to provide support for our GT.M system on a Linux System, but there's a legacy system that still runs on AIX, in which we could not get this module working .

Do you know if it's easy/possible to build/get/have AIX bindings for this module ?

Thanks a lot.

Always getting error GTM-E-SYSCALL

I believe I setup GT.M correctly (I'm using rob tweed's node-mwire library which works fine) but when I issue any command to the DB I get an error back as follows:

ok: 0,
errorCode: 150379602,
errorMessage: GTM-E-SYSCALL

When I do db.open() I get:
{ok: 1, result: 1}
So I assumed the connection was opened successfully. I don't understand mumps so I have no idea where this error is coming from or what it means.

Any help would be appreciated.

Thanks,
Roy

function - error when passing argument with quotes

Hi David,

I'm having an issue when using the function call when I pass an argument containing double quotes (such as when referencing a global). It seems to be a simple issue with the function call turning the result in to JSON since the M routine being called appears to succeed (i.e. the M function completes successfully, 'function' generates a exception). Here are a couple snippets of code to reproduce:

JS file:

var nodem = require('/home/vista/NodeM/mumps.node');
var db = new nodem.Gtm();
var openResult = db.open();
console.log(db.function({function : 'MYTAG^MYROUTINE', arguments: [ 1, 'no_quotes', 'string_"with"_quotes' ]}));
db.close();

Generates the error:

SyntaxError: Unexpected string
at Object.parse (native)
at Object. (/home/vista/share/test/testRunner.js:28:24)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

MYTAG^MYROUTINE:

MYTAG(ONE,TWO,THREE) ; test issue with NODEM
;
Q "OK"

Finally, note that if you remove the double quotes from the third argument in the JS file above (change to: 'string_with_quotes'), the call returns successfully:

vista@dEWDrop:~/share/test$ node testRunner.js
{ ok: 1,
function: 'MYTAG^MYROUTINE',
arguments: [ 1, 'no_quotes', 'string_with_quotes' ],
result: 'OK' }

Hope that is enough to go on. Thanks for any insight you can provide.

P.S. Your tools have been quite useful. Dewdrop and NodeM are great resources. Hopefully me and my company can send you some green in the future to show our gratitude. Thanks again!

Are lock and unlock needed for transaction commit?

I am not sure how do we guarantee transaction for set. I am using nodem with globals and I tried to do

var globals = new globals.GlobalNode("root", ["1"]);
db.lock(globals);
set to save data
db.unlock(globals);

And I do get SyntaxError: Need to supply a global property exception.

It would be great if there is an example for doing things transactionally like multiple sets in a row. Thanks for your help.

Create a

It would be nice if NodeM came with a small program that one can run to confirm successful installation as well as use as an example of working code to copy (at least for me, I find it easiest to code by finding working code and modifying it, generalizing it, or at least learning from it. There is a sample C program at https://raw.githubusercontent.com/YottaDB/YottaDBtest/master/simpleapi/inref/wordfreq.c and an M program wordfreq1.m (attached) with a reference input file at https://raw.githubusercontent.com/YottaDB/YottaDBt
wordfreq1.m.gz
est/master/simpleapi/outref/wordfreq_input.txt and a reference output file at https://raw.githubusercontent.com/YottaDB/YottaDBtest/master/simpleapi/outref/wordfreq_output.txt

For example, see https://docs.yottadb.com/MultiLangProgGuide/MultiLangProgGuide.html#quick-start

Why YottaDB connection can't be opened by worker thread?

> Uncaught Error: YottaDB connection must be managed by main thread
    at Object.<anonymous> (/data/src/get.js:6:17)
    at Module._compile (internal/modules/cjs/loader.js:999:30)

I try to get access to YottaDB with ExpressJS server, and I found #9 issue where there is statement about short term access operations. #9 (comment)

I assume that if there is conception of one node process per one "open-get-close" operation, moving logic to work thread fit into this concept...

How is it supposed to interact with short-term operations if node process can be open only one connect with db? How share this access with other consumers if we need read/write to db in multithread mode?

enconding problem

Hi David, my name is Oscar Serna and we talked several months ago about node on AIX machines.

We discarded that approach (node with AIX) and we have been testing nodem in RHEL 6 for two months. All the results were really good, the performance was amazing, ease to use...etc, but we have a problem
with the encoding. According to this:

http://tinco.pair.com/bhaskar/gtm/doc/books/ao/UNIX_manual/ch03s03.html

Here we have GT.M configured to use M encoding, the gtm_chset environment variable is set to M, or empty, depending of the environment.
Also there is no utf8 subdirectory, so I suppose that out GT.M database is running with M encoding.

Let me to explain what is the problem:

  1. I set a global like this:
            var node = {global: 'dlw', subscripts: ["testing", 1], data: 'áéíóúñ'};
            var ret  = db.set(node);
  1. When I see the record in the GT.M console: (my putty console is in ISO-8859-1:1998 (Latin-1, West Europe) )
                GTM>D ^%G

                Global output

                Device:  /dev/pts/0
                  Right margin:  80
                Global ^dlw("testing",1
                ^dlw("testing",1)=ýýýýýý
                Global ^
  1. So, when I´ve tried to extract the data I see:
                var get = db.get({global: 'dlw', subscripts: ['testing', 1]});
                console.log(get['data']);

The result is: ������
  1. If I set the node content manually through the GT.M, what can I see in my putty console is what I expected:

GTM>SET ^dlw("testing",1)="áéíóúñ"

GTM>D ^%G

Global output

Device: /dev/pts/0
Right margin: 80
Global ^^dlw("testing",1
^dlw("testing",1)=áéíóúñ

  1. Also If I try to extract this data that I´ve set manually I see this:
                var get = db.get({global: 'dlw', subscripts: ['testing', 1]});
                console.log(get['data']);

The result is: ������

This is the complete source code:

const mumps = require('../lib/mumps');
const db = new mumps.Gtm();

db.open();

var node = {global: 'dlw', subscripts: ['testing', 1], data: 'áéíóúñ'};
var ret = db.set(node);

var get = db.get({global: 'dlw', subscripts: ['testing', 1]});
console.log(get['data']);

db.close()

Do you have any idea about this issue?

SyntaxError: Unexpected token when using function with parameters

I call a extrinsic function with paremters and get always the following error.

Unexpected token a
at Object.parse (native)
at Object. (/gtm/neo.js:5:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3

The Mumps function is called propertly and the parameters are passed.
Calling without paremeters works without an error.

neo.js
var gtm = require("/gtm/lib/mumps");
var db = new gtm.Gtm();
var ret;
db.open();
ret = db.function({function: 'run^neo', arguments: ['argument1',123]});
console.log("ret=" + JSON.stringify(ret));
db.close();

Error on opening database

I ran public docker image yottadb/yottadb-debian:latest and all was fine, I opened ydb connection and got version of base while before I did't set first global with value, e.g.: ^zoo="cat". I not sure that reason in that.
Then ydb became to return this error, and i don't understand, how to fix it...

root@9b56c4ffd24b:/data# node
Welcome to Node.js v12.22.12.
Type ".help" for more information.
> const ydb = require('nodem').Ydb();
undefined
> ydb.open()
{
  ok: false,
  errorCode: 150381514,
  errorMessage: '(Call-In),%YDB-E-ICUSYMNOTFOUND, Symbol u_getVersion not found in the ICU libraries. ICU needs to be built with symbol-renaming disabled or ydb_icu_version environment variable needs to be properly specified,%YDB-I-TEXT, /usr/lib/x86_64-linux-gnu/libicuio.so: undefined symbol: u_getVersion'
}

I hoped with docker image I can abstract from database administration...

error when trying to install with npm on Ubuntu 12.04 LTS 64bit server

When trying to install using npm on Ubuntu 12.04 LTS 64bit, with node 0.10.8, I get the following error:

marksires@xxxxxxx:~$ sudo npm install nodem
npm http GET https://registry.npmjs.org/nodem
npm http 304 https://registry.npmjs.org/nodem

[email protected] install /home/marksires/node_modules/nodem
node-gyp rebuild

make: Entering directory /home/marksires/node_modules/nodem/build' CXX(target) Release/obj.target/mumps/src/mumps.o ../src/mumps.cc:24:25: fatal error: nodejs/node.h: No such file or directory compilation terminated. make: *** [Release/obj.target/mumps/src/mumps.o] Error 1 make: Leaving directory/home/marksires/node_modules/nodem/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.2.0-44-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/marksires/node_modules/nodem
gyp ERR! node -v v0.10.8
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0

Here is the node 'global' information in case that is needed.
marksires@xxxxxxx:~$ node

global
{ ArrayBuffer: [Function: ArrayBuffer],
Int8Array: { [Function: Int8Array] BYTES_PER_ELEMENT: 1 },
Uint8Array: { [Function: Uint8Array] BYTES_PER_ELEMENT: 1 },
Uint8ClampedArray: { [Function: Uint8ClampedArray] BYTES_PER_ELEMENT: 1 },
Int16Array: { [Function: Int16Array] BYTES_PER_ELEMENT: 2 },
Uint16Array: { [Function: Uint16Array] BYTES_PER_ELEMENT: 2 },
Int32Array: { [Function: Int32Array] BYTES_PER_ELEMENT: 4 },
Uint32Array: { [Function: Uint32Array] BYTES_PER_ELEMENT: 4 },
Float32Array: { [Function: Float32Array] BYTES_PER_ELEMENT: 4 },
Float64Array: { [Function: Float64Array] BYTES_PER_ELEMENT: 8 },
DataView: [Function: DataView],
global: [Circular],
process:
{ title: 'node',
version: 'v0.10.8',
moduleLoadList:
[ 'Binding evals',
'Binding natives',
'NativeModule events',
'NativeModule buffer',
'Binding buffer',
'NativeModule assert',
'NativeModule util',
'NativeModule module',
'NativeModule path',
'NativeModule tty',
'NativeModule net',
'NativeModule stream',
'NativeModule _stream_readable',
'NativeModule _stream_writable',
'NativeModule _stream_duplex',
'NativeModule _stream_transform',
'NativeModule _stream_passthrough',
'NativeModule timers',
'Binding timer_wrap',
'NativeModule _linklist',
'Binding cares_wrap',
'Binding tty_wrap',
'NativeModule vm',
'NativeModule fs',
'Binding fs',
'Binding constants',
'NativeModule readline',
'NativeModule console',
'Binding signal_wrap',
'NativeModule string_decoder' ],
versions:
{ http_parser: '1.0',
node: '0.10.8',
v8: '3.14.5.9',
ares: '1.9.0-DEV',
uv: '0.10.8',
zlib: '1.2.3',
modules: '11',
openssl: '1.0.1e' },
arch: 'x64',
platform: 'linux',
argv: [ 'node' ],
execArgv: [],
env:
{ gtm_repl_instance: '/home/marksires/.fis-gtm/V6.0-002_x86_64/g/gtm.repl',
COMP_WORDBREAKS: ' \t\n"'><;|&(:',
gtm_log: '/tmp/fis-gtm/V6.0-002_x86_64',
TERM: 'xterm',
SHELL: '/bin/bash',
gtm_prompt: 'GTM>',
SSH_CLIENT: '192.168.2.152 50293 22',
gtm_retention: '42',
SSH_TTY: '/dev/pts/0',
gtmver: 'V6.0-002_x86_64',
USER: 'marksires',
LS_COLORS:

'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arj=01;31:.taz=01;31:.lzh=01;31:.lzma=01;31:*.tlz=0

1;31:.txz=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lz=01;31:.xz=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:

.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.jpg=01;35:.jpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=

01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:*.rmvb=01;35:

.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.axv=01;35:.anx=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.mid=00;36:.midi=00;

36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.axa=00;36:.oga=00;36:.spx=00;36:.xspf=00;36:',
gtmgbldir: '/home/marksires/.fis-gtm/V6.0-002_x86_64/g/gtm.gld',
MAIL: '/var/mail/marksires',
PATH: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/fis-gtm/V6.0-002_x8664_pro',
gtmroutines: '/home/marksires/.fis-gtm/V6.0-002_x86_64/o(/home/marksires/.fis-gtm/V6.0-002_x86_64/r /home/marksires/.fis-gtm/r) /usr/lib/fis-gtm/V6.0-002_x8664_pro/plugin/o(/usr/lib/fis-gtm/V6.0-002_x8664_pro/plugin/r)

/usr/lib/fis-gtm/V6.0-002_x8664_pro/libgtmutil.so /usr/lib/fis-gtm/V6.0-002_x8664_pro',
PWD: '/home/marksires',
LANG: 'en_US.UTF-8',
NODE_PATH: '/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript',
gtmdir: '/home/marksires/.fis-gtm',
SHLVL: '1',
HOME: '/home/marksires',
gtm_etrap: 'Write:(0=$STACK) "Error occurred: ",$ZStatus,!',
gtm_principal_editing: 'EDITING',
LOGNAME: 'marksires',
gtm_tmp: '/tmp/fis-gtm/V6.0-002_x86_64',
gtm_dist: '/usr/lib/fis-gtm/V6.0-002_x8664_pro',
SSH_CONNECTION: '192.168.2.152 50293 192.168.2.237 22',
LESSOPEN: '| /usr/bin/lesspipe %s',
LESSCLOSE: '/usr/bin/lesspipe %s %s',
_: '/usr/bin/node',
OLDPWD: '/' },
pid: 12548,
features:
{ debug: false,
uv: true,
ipv6: true,
tls_npn: true,
tls_sni: true,
tls: true },
_needImmediateCallback: false,
execPath: '/usr/bin/nodejs',
debugPort: 5858,
_getActiveRequests: [Function],
_getActiveHandles: [Function],
_needTickCallback: [Function],
reallyExit: [Function],
abort: [Function],
chdir: [Function],
cwd: [Function],
umask: [Function],
getuid: [Function],
setuid: [Function],
setgid: [Function],
getgid: [Function],
getgroups: [Function],
setgroups: [Function],
initgroups: [Function],
_kill: [Function],
_debugProcess: [Function],
_debugPause: [Function],
_debugEnd: [Function],
hrtime: [Function],
dlopen: [Function],
uptime: [Function],
memoryUsage: [Function],
binding: [Function],
_usingDomains: [Function],
_tickInfoBox:
{ '0': 1,
'1': 0,
'2': 0 },
_events: { SIGWINCH: [Function] },
domain: null,
_maxListeners: 10,
EventEmitter: { [Function: EventEmitter] listenerCount: [Function] },
_fatalException: [Function],
_exiting: false,
assert: [Function],
config:
{ target_defaults: [Object],
variables: [Object] },
nextTick: [Function: nextTick],
_nextDomainTick: [Function: _nextDomainTick],
_tickCallback: [Function: _tickCallback],
_tickDomainCallback: [Function: _tickDomainCallback],
_tickFromSpinner: [Function: _tickFromSpinner],
maxTickDepth: 1000,
stdout: [Getter],
stderr: [Getter],
stdin: [Getter],
openStdin: [Function],
exit: [Function],
kill: [Function],
addListener: [Function],
on: [Function],
removeListener: [Function] },
GLOBAL: [Circular],
root: [Circular],
Buffer:
{ [Function: Buffer]
isEncoding: [Function],
poolSize: 8192,
isBuffer: [Function: isBuffer],
byteLength: [Function],
concat: [Function] },
setTimeout: [Function],
setInterval: [Function],
clearTimeout: [Function],
clearInterval: [Function],
setImmediate: [Function],
clearImmediate: [Function],
console: [Getter],
module:
{ id: 'repl',
exports:
{ writer: [Object],
_builtinLibs: [Object],
REPLServer: [Object],
start: [Function],
repl: [Object] },
parent: undefined,
filename: '/home/marksires/repl',
loaded: false,
children: [],
paths:
[ '/home/marksires/repl/node_modules',
'/home/marksires/node_modules',
'/home/node_modules',
'/node_modules' ] },
require:
{ [Function: require]
resolve: [Function],
main: undefined,
extensions:
{ '.js': [Function],
'.json': [Function],
'.node': [Function] },
registerExtension: [Function],
cache: {} },
_: [Circular] }

(^C again to quit)

marksires@xxxxxxx:~$

Error: Module version mismatch. Expected 11, got 1.

i am just new to node.js and gtm so maybe its a newbe failler
when i try to call nodem.js i get this error( var nodem = require('nodem');)
--> Error: Module version mismatch. Expected 11, got 1.
node.js version is v0.10.4
how can i resolve this
Thanx in advance

GT.M can not be re-opened

Hi,

I am trying to write save and retrieve functions and I ran into a problem when I test the functions back to back. One of them will have an error with the returned result from open as GT.M can not be re-opened. Is this expected? The next question I have is what is the recommended way to deal with the db close if I have multiple functions dealing with the db? Right now, I do have db init and open in each function and close the db before exiting the function. But that still does not seem to work. Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.