Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6107513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:11:48+00:00 2026-05-23T14:11:48+00:00

All, I am working with WebOS enyo, but having a really senior moment…. Basically

  • 0

All,

I am working with WebOS enyo, but having a really senior moment….

Basically the fact its enyo has no relation to my question however…

I have a method:

clickPopulate: function(){

     // Do some SQL

};

I am using a database class to handle my SQL lite Db connection, the interface for the method i am using is:

 * Execute an arbitrary SQL command on the database.
 *
 * If you need to execute multiple commands in a transaction, use queries()
 *
 * Parameters:
 * - sql (string or query object, required)
 * - options (object):
 *    * values (array): replacements for '?' placeholders in SQL
 *      (only use if not passing a DatabaseQuery object)
 *    * onSuccess (function): method to call on successful query
 *        + receives single argument: results as an array of objects
 *    * onError (function): method to call on error; defaults to logging
 */


query: function(sql, options)

So anyway i send it some SQL and some options, one of which is the onSuccess callback.

this.$.db.query("SELECT fullName, count(*) FROM user WHERE username=? and password=? GROUP BY username",
        {values: [inUser,inPass], onSuccess: enyo.bind(this, this.callBackFunction)});

What i really want to be able to do is have the SQL result array return to my click handler function – clickPopulate, but as its the calling method, i cant get it to work?

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:11:48+00:00Added an answer on May 23, 2026 at 2:11 pm

    You can’t have an asynchronous callback return to the original caller.

    The closest you can do is something like this (since I don’t know the Enyo apis I’ll just use some pseudo’ish stuff)

    function clickPopulate() {
        db.query('Some SQL here', function(results) {
            //This is the code that will be run once the query is complete.
        });
    }
    

    So basically you can include a closure as the callback inside your function. This way it kind of looks like it’s part of the original caller but it really isn’t.


    If you really wanted to, you could probably have it call the original function back, and define some parameter which is used to determine whether it’s the results from the query, but that would just make it kinda ugly and confusing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

They were all working fine on my XAMMP sandbox but now nothing. Something im
My wordpress*(a custom template)* nav is all working on all of the pages but
I have 2 div boxes. It's all working fine but when the browser is
I'm uploading a file, all working fine, but I want to set a time
I have this code, but can't get it all working. I am trying to
I'm using the fb:registration Plugin and get some data as signed_request. Its all working
I am using the iOS MFMailComposeView method of sending emails - its all working
can anyone help? I have just started asp.net mvc and its all working.. entering
I've setup WP multisite got it all working, but how do I create /
I am using a software client based on Eclipse (Ganymede) and its all working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.