Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default string whitespace error #379

Open
creisle opened this issue Jul 5, 2019 · 0 comments
Open

Default string whitespace error #379

creisle opened this issue Jul 5, 2019 · 0 comments

Comments

@creisle
Copy link

creisle commented Jul 5, 2019

Version Information

orientdb: 3.0.20
orientjs: 3.0.5
node: v10

Behaviour

Throws an error when the default value of a string field contains white space

Steps to reproduce

const DB_NAME = 'test_whitespace_bug';

const cleanup = async (server, conf) => {
    await server.dropDatabase({
        name: DB_NAME,
        username: conf.DBS_USER,
        password: conf.DBS_PASS
    });
    await server.close();
};

const test = async (conf) => {
    const server = await OrientDBClient.connect({
        host: conf.DB_HOST,
        port: conf.DB_PORT
    });
    await server.createDatabase({
        name: DB_NAME,
        username: conf.DBS_USER,
        password: conf.DBS_PASS
    });
    const db = await server.session({
        name: DB_NAME,
        username: conf.DBS_USER,
        password: conf.DBS_PASS
    });
    // create the class
    const dbClass = await db.class.create('whitespace', 'V');

    try {
        // create the string property and default
        await dbClass.property.create({
            name: 'name',
            type: 'string',
            default: 'some string with whitespace'
        });
    } catch (err) {
        await cleanup(server, conf);
        throw err;
    }
    await cleanup(server, conf);
};

the error observed was as follows

{ OrientDB.RequestError: Error parsing query:
ALTER PROPERTY whitespace.name DEFAULT some string with whitespace
                                                 ^
Encountered " <IDENTIFIER> "string "" at line 1, column 45.
Was expecting one of:
    <EOF> 
    ";" ...
    
	DB name="test_whitespace_bug"
	Error Code="1"
    at child.Operation.parseError (/home/creisle/git/knowledgebase/knowledgebase_api/node_modules/orientjs/lib/client/network/protocol37/operation.js:1224:13)
    at child.Operation.consume (/home/creisle/git/knowledgebase/knowledgebase_api/node_modules/orientjs/lib/client/network/protocol37/operation.js:566:35)
    at ONetworkConnection.Connection.process (/home/creisle/git/knowledgebase/knowledgebase_api/node_modules/orientjs/lib/client/network/conn.js:462:17)
    at ONetworkConnection.Connection.handleSocketData (/home/creisle/git/knowledgebase/knowledgebase_api/node_modules/orientjs/lib/client/network/conn.js:344:20)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
  name: 'OrientDB.RequestError',
  message:
   'Error parsing query:\nALTER PROPERTY whitespace.name DEFAULT some string with whitespace\n                                                 ^\nEncountered " <IDENTIFIER> "string "" at line 1, column 45.\nWas expecting one of:\n    <EOF> \n    ";" ...\n    \r\n\tDB name="test_whitespace_bug"\r\n\tError Code="1"',
  data: {},
  isMVCC: [Function],
  isTokenException: [Function],
  previous: [],
  code: 1,
  identifier: 0,
  id: 1,
  type:
   'com.orientechnologies.orient.core.sql.OCommandSQLParsingException',
  hasMore: 0 }
creisle added a commit to bcgsc/pori_graphkb_api that referenced this issue Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant