Related
diff --git a/src/browser/documentation/help/params.jsx b/src/browser/documentation/help/params.jsx
index 315b93ec5a5..a05785f0496 100644
--- a/src/browser/documentation/help/params.jsx
+++ b/src/browser/documentation/help/params.jsx
@@ -19,6 +19,7 @@
*/
import React from 'react'
+import ParamsOnSystemDb from './partials/params-on-systemdb'
const title = 'Parameters'
const subtitle = 'View and set parameters to be sent with queries.'
const category = 'cypherQueries'
@@ -64,11 +65,12 @@ const content = (
{` `}
{`MATCH (n:Person) WHERE n.name = $name`}
+
diff --git a/src/browser/documentation/help/partials/params-on-systemdb.jsx b/src/browser/documentation/help/partials/params-on-systemdb.jsx
new file mode 100644
index 00000000000..211f24eaff7
--- /dev/null
+++ b/src/browser/documentation/help/partials/params-on-systemdb.jsx
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2002-2019 "Neo4j,"
+ * Neo4j Sweden AB [http://neo4j.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
.
+ */
+import React from 'react'
+export default function ParamsOnSystemDb () {
+ return (
+
+ A note on system database
+
+ If you are using a multi-database DBMS, parameters cannot be declared when
+ using the system database. Switch to a different database and declare,
+ then switch back to system database and use them.
+
+ )
+}
diff --git a/src/shared/modules/commands/helpers/params.js b/src/shared/modules/commands/helpers/params.js
index 496a8450812..570fb49fd07 100644
--- a/src/shared/modules/commands/helpers/params.js
+++ b/src/shared/modules/commands/helpers/params.js
@@ -21,6 +21,7 @@ import jsonic from 'jsonic'
import { splitStringOnFirst } from 'services/commandUtils'
import { update, replace } from 'shared/modules/params/paramsDuck'
import { collectLambdaValues, parseLambdaStatement } from './lambdas'
+import { SYSTEM_DB } from 'shared/modules/dbMeta/dbMetaDuck'
export const extractParams = param => {
// early bail, now handled by parser
@@ -77,7 +78,12 @@ export const getParamName = (input, cmdchar) => {
return parts[0].trim()
}
-export const handleParamsCommand = (action, cmdchar, put) => {
+export const handleParamsCommand = (action, cmdchar, put, targetDb) => {
+ if (targetDb === SYSTEM_DB) {
+ return Promise.reject(
+ new Error('Parameters cannot be declared when using system database.')
+ )
+ }
const strippedCmd = action.cmd.substr(cmdchar.length)
const parts = splitStringOnFirst(strippedCmd, ' ')
const param = parts[1].trim()
diff --git a/src/shared/services/commandInterpreterHelper.js b/src/shared/services/commandInterpreterHelper.js
index 92bd9ec513e..27ea911a326 100644
--- a/src/shared/services/commandInterpreterHelper.js
+++ b/src/shared/services/commandInterpreterHelper.js
@@ -131,7 +131,12 @@ const availableCommands = [
name: 'set-params',
match: cmd => /^params?\s/.test(cmd),
exec: function (action, cmdchar, put, store) {
- return handleParamsCommand(action, cmdchar, put)
+ return handleParamsCommand(
+ action,
+ cmdchar,
+ put,
+ getUseDb(store.getState())
+ )
.then(res => {
const params =
res.type === 'param' ? res.result : getParams(store.getState())
@@ -152,10 +157,11 @@ const availableCommands = [
if (!action.parentId) {
put(
frames.add({
+ useDb: getUseDb(store.getState()),
...action,
error: {
type: 'Syntax Error',
- message: error.message.substring('Error: '.length)
+ message: error.message.replace(/^Error: /, '')
},
showHelpForCmd: getParamName(action, cmdchar),
type: 'error'