Class: Browser::Database::SQL::Transaction

Inherits:
Object
  • Object
show all
Includes:
Native
Defined in:
opal/browser/database/sql.rb

Overview

Allows you to make changes to the database or read data from it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#databaseDatabase (readonly)


93
94
95
# File 'opal/browser/database/sql.rb', line 93

def database
  @database
end

Instance Method Details

#query(query, *parameters) ⇒ Promise

Query the database.


108
109
110
111
112
113
114
115
116
# File 'opal/browser/database/sql.rb', line 108

def query(query, *parameters)
  promise = Promise.new

  `#@native.executeSql(#{query}, #{parameters},
    #{-> _, r { promise.resolve(Result.new(self, r)) }},
    #{-> _, e { promise.reject(Error.new(e)) }})`

  promise
end