Class: Arango::AQL
- Inherits:
-
Object
- Object
- Arango::AQL
- Includes:
- Database_Return, Helper_Error, Helper_Return
- Defined in:
- lib/AQL.rb
Instance Attribute Summary collapse
-
#batchSize ⇒ Object
(also: #size)
DEFINE ===.
-
#bindVars ⇒ Object
DEFINE ===.
-
#cache ⇒ Object
DEFINE ===.
-
#cached ⇒ Object
readonly
Returns the value of attribute cached.
-
#count ⇒ Object
DEFINE ===.
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#extra ⇒ Object
readonly
Returns the value of attribute extra.
-
#failOnWarning ⇒ Object
readonly
Returns the value of attribute failOnWarning.
-
#fullCount ⇒ Object
readonly
Returns the value of attribute fullCount.
-
#hasMore ⇒ Object
readonly
Returns the value of attribute hasMore.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#idCache ⇒ Object
readonly
Returns the value of attribute idCache.
-
#intermediateCommitCount ⇒ Object
readonly
Returns the value of attribute intermediateCommitCount.
-
#intermediateCommitSize ⇒ Object
readonly
Returns the value of attribute intermediateCommitSize.
-
#maxPlans ⇒ Object
readonly
Returns the value of attribute maxPlans.
-
#maxTransactionSize ⇒ Object
readonly
Returns the value of attribute maxTransactionSize.
-
#maxWarningCount ⇒ Object
readonly
Returns the value of attribute maxWarningCount.
-
#optimizer_rules ⇒ Object
readonly
Returns the value of attribute optimizer_rules.
-
#options ⇒ Object
DEFINE ===.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#quantity ⇒ Object
DEFINE ===.
-
#query ⇒ Object
DEFINE ===.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#satelliteSyncWait ⇒ Object
readonly
Returns the value of attribute satelliteSyncWait.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#skipInaccessibleCollections ⇒ Object
readonly
Returns the value of attribute skipInaccessibleCollections.
-
#ttl ⇒ Object
DEFINE ===.
Instance Method Summary collapse
- #destroy ⇒ Object
-
#execute ⇒ Object
EXECUTE QUERY ===.
-
#explain ⇒ Object
PROPERTY QUERY ===.
-
#initialize(query:, database:, count: nil, batchSize: nil, cache: nil, memoryLimit: nil, ttl: nil, bindVars: nil, failOnWarning: nil, profile: nil, maxTransactionSize: nil, skipInaccessibleCollections: nil, maxWarningCount: nil, intermediateCommitCount: nil, satelliteSyncWait: nil, fullCount: nil, intermediateCommitSize: nil, optimizer_rules: nil, maxPlans: nil) ⇒ AQL
constructor
A new instance of AQL.
- #kill ⇒ Object
- #next ⇒ Object
- #parse ⇒ Object
-
#to_h ⇒ Object
TO HASH ===.
Methods included from Database_Return
Methods included from Helper_Return
#return_delete, #return_directly?, #return_element
Methods included from Helper_Error
#satisfy_category?, #satisfy_class?, #warning_deprecated
Constructor Details
#initialize(query:, database:, count: nil, batchSize: nil, cache: nil, memoryLimit: nil, ttl: nil, bindVars: nil, failOnWarning: nil, profile: nil, maxTransactionSize: nil, skipInaccessibleCollections: nil, maxWarningCount: nil, intermediateCommitCount: nil, satelliteSyncWait: nil, fullCount: nil, intermediateCommitSize: nil, optimizer_rules: nil, maxPlans: nil) ⇒ AQL
Returns a new instance of AQL.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/AQL.rb', line 9 def initialize(query:, database:, count: nil, batchSize: nil, cache: nil, memoryLimit: nil, ttl: nil, bindVars: nil, failOnWarning: nil, profile: nil, maxTransactionSize: nil, skipInaccessibleCollections: nil, maxWarningCount: nil, intermediateCommitCount: nil, satelliteSyncWait: nil, fullCount: nil, intermediateCommitSize: nil, optimizer_rules: nil, maxPlans: nil) satisfy_class?(query, [String]) @query = query assign_database(database) @count = count @batchSize = batchSize @cache = cache @memoryLimit = memoryLimit @ttl = ttl @bindVars = bindVars @quantity = nil @hasMore = false @id = "" @result = [] @options = {} # DEFINE ["failOnWarning", "profile", "maxTransactionSize", "skipInaccessibleCollections", "maxWarningCount", "intermediateCommitCount", "satelliteSyncWait", "fullCount", "intermediateCommitSize", "optimizer_rules", "maxPlans"].each do |param_name| param = eval(param_name) set_option(param, param_name) define_singleton_method("#{param_name}=") do |value| set_option(value, param_name) end end end |
Instance Attribute Details
#batchSize ⇒ Object Also known as: size
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def batchSize @batchSize end |
#bindVars ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def bindVars @bindVars end |
#cache ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def cache @cache end |
#cached ⇒ Object (readonly)
Returns the value of attribute cached.
47 48 49 |
# File 'lib/AQL.rb', line 47 def cached @cached end |
#count ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def count @count end |
#database ⇒ Object (readonly)
Returns the value of attribute database.
47 48 49 |
# File 'lib/AQL.rb', line 47 def database @database end |
#extra ⇒ Object (readonly)
Returns the value of attribute extra.
47 48 49 |
# File 'lib/AQL.rb', line 47 def extra @extra end |
#failOnWarning ⇒ Object (readonly)
Returns the value of attribute failOnWarning.
47 48 49 |
# File 'lib/AQL.rb', line 47 def failOnWarning @failOnWarning end |
#fullCount ⇒ Object (readonly)
Returns the value of attribute fullCount.
47 48 49 |
# File 'lib/AQL.rb', line 47 def fullCount @fullCount end |
#hasMore ⇒ Object (readonly)
Returns the value of attribute hasMore.
47 48 49 |
# File 'lib/AQL.rb', line 47 def hasMore @hasMore end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
47 48 49 |
# File 'lib/AQL.rb', line 47 def id @id end |
#idCache ⇒ Object (readonly)
Returns the value of attribute idCache.
47 48 49 |
# File 'lib/AQL.rb', line 47 def idCache @idCache end |
#intermediateCommitCount ⇒ Object (readonly)
Returns the value of attribute intermediateCommitCount.
47 48 49 |
# File 'lib/AQL.rb', line 47 def intermediateCommitCount @intermediateCommitCount end |
#intermediateCommitSize ⇒ Object (readonly)
Returns the value of attribute intermediateCommitSize.
47 48 49 |
# File 'lib/AQL.rb', line 47 def intermediateCommitSize @intermediateCommitSize end |
#maxPlans ⇒ Object (readonly)
Returns the value of attribute maxPlans.
47 48 49 |
# File 'lib/AQL.rb', line 47 def maxPlans @maxPlans end |
#maxTransactionSize ⇒ Object (readonly)
Returns the value of attribute maxTransactionSize.
47 48 49 |
# File 'lib/AQL.rb', line 47 def maxTransactionSize @maxTransactionSize end |
#maxWarningCount ⇒ Object (readonly)
Returns the value of attribute maxWarningCount.
47 48 49 |
# File 'lib/AQL.rb', line 47 def maxWarningCount @maxWarningCount end |
#optimizer_rules ⇒ Object (readonly)
Returns the value of attribute optimizer_rules.
47 48 49 |
# File 'lib/AQL.rb', line 47 def optimizer_rules @optimizer_rules end |
#options ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def @options end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
47 48 49 |
# File 'lib/AQL.rb', line 47 def profile @profile end |
#quantity ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def quantity @quantity end |
#query ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def query @query end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
47 48 49 |
# File 'lib/AQL.rb', line 47 def result @result end |
#satelliteSyncWait ⇒ Object (readonly)
Returns the value of attribute satelliteSyncWait.
47 48 49 |
# File 'lib/AQL.rb', line 47 def satelliteSyncWait @satelliteSyncWait end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
47 48 49 |
# File 'lib/AQL.rb', line 47 def server @server end |
#skipInaccessibleCollections ⇒ Object (readonly)
Returns the value of attribute skipInaccessibleCollections.
47 48 49 |
# File 'lib/AQL.rb', line 47 def skipInaccessibleCollections @skipInaccessibleCollections end |
#ttl ⇒ Object
DEFINE ===
46 47 48 |
# File 'lib/AQL.rb', line 46 def ttl @ttl end |
Instance Method Details
#destroy ⇒ Object
132 133 134 |
# File 'lib/AQL.rb', line 132 def destroy @database.request("DELETE", "_api/cursor/#{@id}") end |
#execute ⇒ Object
EXECUTE QUERY ===
108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/AQL.rb', line 108 def execute body = { "query": @query, "count": @count, "batchSize": @batchSize, "ttl": @ttl, "cache": @cache, "options": @options, "bindVars": @bindVars, "memoryLimit": @memoryLimit } result = @database.request("POST", "_api/cursor", body: body) return_aql(result) end |
#explain ⇒ Object
PROPERTY QUERY ===
142 143 144 145 146 147 148 149 |
# File 'lib/AQL.rb', line 142 def explain body = { "query": @query, "options": @options, "bindVars": @bindVars } @database.request("POST", "_api/explain", body: body) end |
#kill ⇒ Object
136 137 138 |
# File 'lib/AQL.rb', line 136 def kill @database.request("DELETE", "_api/query/#{@id}") end |
#next ⇒ Object
123 124 125 126 127 128 129 130 |
# File 'lib/AQL.rb', line 123 def next if @hasMore result = @database.request("PUT", "_api/cursor/#{@id}") return_aql(result) else raise Arango::Error.new err::no_other_aql_next, data: {"hasMore": false} end end |
#parse ⇒ Object
151 152 153 |
# File 'lib/AQL.rb', line 151 def parse @database.request("POST", "_api/query", body: {"query": @query}) end |
#to_h ⇒ Object
TO HASH ===
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/AQL.rb', line 68 def to_h { "query": @query, "result": @result, "count": @count, "quantity": @quantity, "ttl": @ttl, "cache": @cache, "batchSize": @batchSize, "bindVars": @bindVars, "options": @options, "idCache": @idCache, "memoryLimit": @memoryLimit, "database": @database.name }.delete_if{|k,v| v.nil?} end |