Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
NPM Packages
js-db
Commits
ff18d8dc
Commit
ff18d8dc
authored
Mar 28, 2020
by
Milan Wikarski
Browse files
Added onsuccess() to query
parent
7f223505
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/classes/query.class.js
View file @
ff18d8dc
...
...
@@ -17,6 +17,8 @@ class Query {
this
.
success
=
null
;
this
.
rows
=
null
;
this
.
err
=
null
;
this
.
_onsuccess
=
null
;
}
/**
...
...
@@ -39,6 +41,17 @@ class Query {
return
is
.
not
.
emptyString
(
this
.
query
);
}
/**
* Sets the onsuccess callback
*
* @param {Function} onsuccess
* @returns Query
*/
onsuccess
(
onsuccess
)
{
this
.
_onsuccess
=
onsuccess
;
return
this
;
}
/**
* Executes a generic query
* - returns `true` if successful; `false` otherwise
...
...
@@ -59,6 +72,11 @@ class Query {
resolve
(
false
);
}
else
{
this
.
rows
=
res
.
rows
;
if
(
this
.
_onsuccess
instanceof
Function
)
{
this
.
_onsuccess
();
}
resolve
(
true
);
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment