+(void)upload_message_Table { NSLog(@"upload message table----------------------------------------- ---------------------"); // NSMutableArray *historyArray=[[NSMutableArray alloc]init]; sqlite3_stmt *statement; //int upload_bp_id, upload_patient_id,upload_systolic,upload_diastolic;

sacktoysΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 5 μήνες)

499 εμφανίσεις

+(void)upload_message_Table

{


NSLog(@"upload message table
-----------------------------------------
---------------------
");


// NSMutableArray *historyArray=[[NSMutableArray alloc]init];


sqlite3_stmt *statement;


//int upload_bp_id,
upload_patient_id,upload_systolic,upload_diastolic;


//NSString *upload_dateTime;


NSString *myDBPath;


sqlite3 *myDB;


[self loadDb];


myDBPath= [self getDBPath];


const char *dbPathchar = [ myDBPath UTF8String];


if(sqlite3_open(dbPathchar, &myDB)==SQLITE_OK)


{


NSLog(@"Inside sqlite_open in upload_message_table");


NSString *sql= [NSString stringWithFormat:@"SELECT
patient_id,subject,body,dateTime,read FROM outbox_table ;"];




const char *opendb = [sql UTF8String];






if (sqlite3_prepare_v2(myDB, opendb,
-
1, &statement, NULL) ==
SQLITE_OK)


{


NSLog(@"Inside sqlite_prepare_v2 in upload_outbox_table");


while (sqlite3_step(state
ment)==SQLITE_ROW)


{


NSLog(@"Inside while");


// cell.textLabel.text=[NSString
stringWithFormat:@"%@",[self.entries objectAtIndex:indexPath.row]];




//NSString *tableC
olumn0= [[NSString alloc]
initWithUTF8String: (char *)sqlite3_column_int(statement, 0)] ;


int tableColumn0= sqlite3_column_int(statement, 0) ;


NSLog(@"tablecolumn0=%d",tableColumn0);


NSString *tableColumn1= [[NSString alloc]
initWithUTF8String: (char *)sqlite3_column_text(statement, 1)] ;


NSLog(@"tablecolumn1=%@",tableColumn1);


NSString *tableColumn2= [[NSString alloc]
initWithUTF8String:

(char *)sqlite3_column_text(statement, 2)] ;


NSLog(@"tablecolumn2=%@",tableColumn2);


NSString *tableColumn3= [[NSString alloc]
initWithUTF8String: (char *)sqlite3_column_text(statement, 3)] ;


NSLog(@"tableco
lumn3=%@",tableColumn3);


NSString *tableColumn4= [[NSString alloc]
initWithUTF8String: (char *)sqlite3_column_text(statement, 4)] ;


NSLog(@"tablecolumn4=%@",tableColumn4);


NSLog(@"values gone in tablecolumn")
;


//NSString *tablerow=[[NSString alloc]initWithFormat:@"%@
Sytolic=%@ Diastolic=%@ ",tableColumn0,tableColumn1,tableColumn2];


//NSLog(@"%@",tablerow);


//NSString *weightstr= [[NSString
alloc]initWithUTF8Stri
ng:weight];


// NSLog(@"%@",weightstr);


//[entries addObject: weight];


//[historyArray addObject: tablerow];


if (tableColumn4.integerValue!=1 ||
tableColumn4.boolValue!=true)


{


NSLog(@" Inside tableColumn4.integerValue!=1 ||
tableColumn4.boolValue!=true");





NSString *urlString = [NSString stringWithFormat:
@"http://people.cs.clemson.edu/~punitk/upload_message.php?patient_id=%d&s
ubject=
\
"%
@
\
"&body=
\
"%@
\
"&dateTime=
\
"%@
\
"&isMessageRead=
\
"%@
\
"",tableColu
mn0,tableColumn1,tableColumn2,tableColumn3, tableColumn4 ];




// NSString *urlString=[[NSString alloc]
initWithString:
(@"http://people.cs.clemson.edu/~pu
nitk/upload_bp.php?patient_id=%d&systo
lic=%@&diastolic=%@&dateTime=%@&uploaded=1",tableColumn0,tableColumn1,tab
leColumn2,tableColumn3)];


NSLog(@"url called:%@",urlString);




NSURL *url= [NSURL
URLWithString:[urlString
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];





NSURLRequest *request=[NSURLRequest
requestWithURL:url];


NSData *urlData;


NSURLResponse *response;



NSError *error;


urlData = [NSURLConnection
sendSynchronousRequest:request


returningResponse:&response


e
rror:&error];




}


}


NSLog(@"Outside While");


}






}// if sqlite opens


//return historyArray;





}