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

  • SEARCH
  • Home
  • 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 4019904
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:09:44+00:00 2026-05-20T10:09:44+00:00

Hopefully you can see a bit from the code what I’m trying to do

  • 0

Hopefully you can see a bit from the code what I’m trying to do here, basically I need to check if a record exists in a database, so I call a function to do so, but I’m using the sqlrunner class wherein the result of a query is called as an event response and I don’t know how to get that value out of the resulting function back to the parent.
I feel like I must be doing things backwards or something..

        public function dbmatch(datetime:String, typecode:String):Boolean {
            var q:String = "SELECT DateTime FROM Event WHERE DateTime='"+datetime+"' AND EventTypeCode='"+typecode+"'"
            SQLService.getInstance().execute(q,null,matchresult);
            function matchresult(result:SQLResult):Boolean{
                var match:String = result.data[0];
                if (match == null){return false} else {return true}
            }
            return matchresult();
        }

elsewhere:

var recordexists:Boolean = dbmatch(datetime, "Gb");

if (!recordexists){...}
  • 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-20T10:09:45+00:00Added an answer on May 20, 2026 at 10:09 am

    Basically the problem is that the SQLService class can’t immediatly return a result for your query. That is why it uses a callback listener function (matchresult in your example) to inform your program at a later time that it has finished the search.

    A basic way of handling this would be to call the query, then wait for the Query to “callback” to your listening funciton, that can then continue execution.

    public function dbmatch(datetime:String, typecode:String, callbackListener:Function):void {
        var q:String = "SELECT DateTime FROM Event WHERE DateTime='"+datetime+"' AND EventTypeCode='"+typecode+"'"
        SQLService.getInstance().execute(q, null, callbackListener);
    }
    

    Elsewhere:

        // Start the query, but can't react to it immediatly        
        dbmatch(datetime, "Gb", onSQLQueryResult);
    
        // Your callback function
        public function onSQLQueryResult(result:SQLResult):void {
            var match:String = result.data[0];
            if (match == null) {
                // Do stuff you were going to do at (!recordexists)
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, this is bit of an obscure question, but hopefully someone can help me
Hopefully, I can get answers for each database server. For an outline of how
Hopefully this is a simple one, but can anyone provide some simple c# code
Made a much simpler example, hopefully someone can follow this and help me Here
Hopefully there are some WCF wizards out there that can spot my mistake here.
I'm trying to call JDIC from my application, but I can't get it to
Hopefully someone can see something which I've missed out or something, because this is
I've been working at this all morning hopefully someone can see the problem, I've
Hopefully I can do the problem justice, because it was too difficult to summarise
Hopefully someone can shed a little light on an issue that I'm currently having

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.