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 7398043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:49:22+00:00 2026-05-29T03:49:22+00:00

The following is the code which i am using, – (void) readDataFromDatabase{ sqlite3 *database;

  • 0

The following is the code which i am using,

- (void) readDataFromDatabase{

    sqlite3 *database;
    persons = [[NSMutableArray alloc]init];

    if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK){

        const char *sqlStatement = "select * from sdata";
        sqlite3_stmt *compiledStatement;
        if (sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK){

            while (sqlite3_step(compiledStatement) == SQLITE_ROW) {

                pID = sqlite3_column_int(compiledStatement, 0);
                pName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
                pAdd = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
                pPh = sqlite3_column_int(compiledStatement, 3);
                pCp = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)];
                pLat = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 5)];
                pLong = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 6)];

                Person *temp = [[Person alloc]initWithID:pID name:pName address:pAdd phone:pPh contactperson:pCp fLat:pLat fLong:pLong];


                [persons addObject:temp];
                NSLog(@"Inside Persons : %@",persons);
                [temp release];

            }

        }
        sqlite3_finalize(compiledStatement);
    }
    sqlite3_close(database);
}
For the NSLog in  NSLog(@"Inside Persons : %@",persons);i get the output as Inside Persons : ("<Person: 0x4c26ae0>"

- (void)startTest
{

    for(int j=0;j<[persons count];j++){

        Person *arr = [persons objectAtIndex:j];


        NSString *s = [[NSString alloc]initWithFormat:@"%f",arr.fLat] ;
        NSLog(@" data in array : %@", s);
    }


#define COORDS_COUNT 1
#define RADIUS       100.0f

    CLLocationCoordinate2D coords[COORDS_COUNT] = {
        CLLocationCoordinate2DMake([arr.fLat floatValue], [arr.fLong floatValue ]),


    };

    CLLocationCoordinate2D center = CLLocationCoordinate2DMake([lat floatValue], [longt floatValue]); 
    CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:center radius:RADIUS identifier:@"Banashankari"];



    for (int i = 0; i < COORDS_COUNT; i++)
    {
        CLLocationCoordinate2D coord = coords[i];

        NSString *coordString = [NSString stringWithFormat:@"%f,%f",coord.latitude, coord.longitude];
        [dataArray addObject:coordString];

        if ([region containsCoordinate:coord])
        {
            NSLog(@"location %f, %f is within %.0f meters of coord %f, %f", coord.latitude, coord.longitude, RADIUS, center.latitude, center.longitude);
            [resultArray addObject:coordString];
            NSLog(@"data in resultArray %@",resultArray);
        }
        else 
        {
            NSLog(@"location %f, %f is not within %.0f meters of coord %f, %f", coord.latitude, coord.longitude, RADIUS, center.latitude, center.longitude);    

        }
    }
}

For the NSLog(@” data in array : %@”, s); i am getting the output as data in array : 0.000000, but the expected value is 12.920684, 77.560033.
How to get the expected value in startTest Method, where i am doing the mistake.
Thanks in Advance.

  • 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-29T03:49:22+00:00Added an answer on May 29, 2026 at 3:49 am

    Use @property(non atomic,retain) for the nsmutablearray persons? Also try to check if the value if fetched in the array. Use retain after the array is filled with values.

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

Sidebar

Related Questions

Given the following lines of code which is using JQTOUCH: $('#customers').bind('pageAnimationEnd', function(e, info){ if
I'm using he following code the call a CFC which returns auto-suggest results through
I'm using the following code to post to the server which is then sent
I have the following code which downloads video content: WebRequest wreq = (HttpWebRequest)WebRequest.Create(url); using
I am using ups service for my project,I have the following code which is
To scroll down my chat DIV I am using the following code which is
I am new to OpenMP. I have the following code which compiles fine using
I have the following jQuery code which I'm using to populate a jqGrid. It
I have the following code which I have been using on a 188 byte
I have the following code which I am are currently using .... Basically, this

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.