Skip to content

Commit

Permalink
Quick fix to allow inspecting passed in arguments to .execute() with …
Browse files Browse the repository at this point in the history
…params functionally being optional now
  • Loading branch information
Stephen Rivas JR committed Sep 14, 2012
1 parent 7c2af53 commit 812e013
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/GraphDatabase._coffee
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ module.exports = class GraphDatabase

actual.call @, query, params, callback


#
do (actual = @::execute) =>
@::execute = (script, params, callback) ->
if typeof params is 'function'
callback = params
params = null

actual.call @, script, params, callback

# executes a query against the given node index. lucene syntax reference:
# http://lucene.apache.org/java/3_1_0/queryparsersyntax.html
queryNodeIndex: (index, query, _) ->
Expand Down
10 changes: 10 additions & 0 deletions test/gremlin._coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,15 @@ assert.ok typeof traversals[0][0], 'object'
assert.ok traversals[0][1] instanceof Array
assert.ok typeof traversals[0][2], 'number'


# ensure you can call without params

params_test = db.execute """
g.v(#{user0.id})
""", _

assert.ok typeof params_test, 'object'
assert.equal params_test.data.name, user0.name

# Should be relatively clear at this point the .execute() function is working with gremlin on some level
console.log 'Passed initial Gremlin tests'

0 comments on commit 812e013

Please sign in to comment.