Skip to content

Absrd Home

hernansaab edited this page Aug 28, 2012 · 28 revisions

Welcome to the absrd wiki! This tool takes advantage of parallel gcd and allows for for concurrent running sql queries. It also offers a lean object oriented wrapper to sql.

Sample Show Off Code

Here we are creating 5 different query blocks. 1 of them query db called default and 4 of them query db called web1

Code as follows:

AbsrdQueryBlock block1 = ^(){
        DbConnector *default_conn = [DbManager getConnector:@"default"];;

        NSMutableArray *res = [default_conn query:@"select * from courses limit 1"];

        return res;

    };

    AbsrdQueryBlock block2 = ^(){

        DbConnector *web1_conn    = [DbManager getConnector:@"web1"];;

        NSMutableArray *res = [web1_conn query:@"select * from t_contents limit 1"];

        return res;

    };

    AbsrdQueryBlock block3 = ^(){

        DbConnector *web1_conn    = [DbManager getConnector:@"web1"];;

        NSMutableArray *res = [web1_conn query:@"select * from t_resources limit 1"];

        return res;

   };
    
    AbsrdQueryBlock block4 = ^(){

        DbConnector *web1_conn    = [DbManager getConnector:@"web1"];;

        NSMutableArray *res = [web1_conn query:@"select * from t_activities limit 1"];

        return res;

    };
    
   AbsrdQueryBlock block5 = ^(){

        DbConnector *web1_conn    = [DbManager getConnector:@"web1"];;

        NSMutableArray *res = [web1_conn query:@"select * from t_content_thumbnails limit 1"];

        return res;

    };

// Now we add these query blocks to the query blaster

    QueryBlockBuster *bb = [[QueryBlockBuster alloc] init];

    [bb addQueryBlock:block1];

    [bb addQueryBlock:block2];

    [bb addQueryBlock:block3];

    [bb addQueryBlock:block4];

    [bb addQueryBlock:block5];


// And now we execute all queries in 5 concurrent queries saving you a fracion of a time compared to
// querying them sequentially


    NSMutableArray *result = [bb multiQueryParallel];







              

Clone this wiki locally