phpBMS

Changeset 759 for trunk

Show
Ignore:
Timestamp:
01/14/10 16:59:01 (2 years ago)
Author:
nate
Message:
  • Removed unneded comments in apiclass.php and api_json.php
  • Added ping functionality (for connection / access / tabledef testing) in the api class and the apiwrapper class.
Location:
trunk/phpbms/modules/api
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/api/apiwrapper.php

    r758 r759  
    6666         
    6767    }//end function 
     68     
     69    /* 
     70     * function ping 
     71     * @param string $tabledefuuid A tabledef uuid. 
     72     * 
     73     * @return array|bool An associative array containing the response, or false if a connection error has occured (in which case see $this->errorMessage). 
     74     * @returnf string type The type of response.  This will either be 'error' or 'message'. 
     75     * @returnf string message The related message.  This will be 'Everything is phpBMSy!' if no errors have occurred and the tabledefuuid is api accessible. 
     76     */ 
     77     
     78    function ping($tabledefuuid) { 
     79         
     80        $params["request"][0]["tabledefid"] = $tabledefuuid; 
     81        $params["request"][0]["command"] = "ping"; 
     82        $params["request"][0]["data"] = array(); 
     83         
     84        $response = $this->_callServer($params); 
     85         
     86        if($response !== false) 
     87            return $response[0]; 
     88        else 
     89            return false; 
     90         
     91    }//end funciton 
    6892     
    6993     
     
    284308    /* 
    285309     * function runStoredProcedure 
    286      *  
     310     * 
     311     * @param string $tabledefuuid The uuid of an api accessible tabledefinition. 
    287312     * @param string $procedureName The stored procedure to be called. 
    288313     * 
     
    292317     */ 
    293318     
    294     public function runStoredProcedure($procedureName) { 
     319    public function runStoredProcedure($tabledefuuid, $procedureName) { 
    295320         
    296321        $params["request"][0]["command"] = "procedure"; 
    297322        $params["request"][0]["data"]["name"] = $procedurename; 
     323        $params["request"][0]["tabledefid"] = $tabledefuuid; 
    298324         
    299325        $response = $this->_callServer($params); 
     
    719745        fclose($sock); 
    720746        ob_end_clean(); 
    721          
    722747        list($throw, $response) = explode("\r\n\r\n", $response, 2); 
    723748         
  • trunk/phpbms/modules/api/api_json.php

    r703 r759  
    3737 +-------------------------------------------------------------------------+ 
    3838*/ 
    39  
    40 //Test Information 
    41 //$_POST["phpbmsusername"] = "api"; 
    42 //$_POST["phpbmspassword"] = "spiderman"; 
    43 //$_POST["request"] = '[ 
    44 //    { 
    45 //        "tabledefid": "tbld:c9ff2c8c-ce1f-659a-9c55-31bca7cce70e", 
    46 //        "command" : "insert", 
    47 //        "data" : {"name":"FOObar","percentage":"3","inactive":"0","createdby":"2","creationdate":"2009-06-25 14:38:02","modifiedby":"2","modifieddate":"2009-06-25 14:38:02","custom1":null,"custom2":null,"custom3":null,"custom4":null,"custom5":null,"custom6":null,"custom7":null,"custom8":null} 
    48 //    } 
    49 //]'; 
    50 //$_POST["request"] = '[ 
    51 //    { 
    52 //        "tabledefid": "tbld:c9ff2c8c-ce1f-659a-9c55-31bca7cce70e", 
    53 //        "command" : "update", 
    54 //        "data" : {"useUuid":false, "id":2, "name":"JOOOOO","percentage":"3","inactive":"0","createdby":"2","creationdate":"2009-06-25 14:38:02","modifiedby":"2","modifieddate":"2009-06-25 14:38:02","custom1":null,"custom2":null,"custom3":null,"custom4":null,"custom5":null,"custom6":null,"custom7":null,"custom8":null} 
    55 //    } 
    56 //]'; 
    57 //$_POST["request"] = '[ 
    58 //    { 
    59 //        "tabledefid": "tbld:c9ff2c8c-ce1f-659a-9c55-31bca7cce70e", 
    60 //        "command" : "get", 
    61 //        "data" : {"uuid":"tax:66dd77f5-c68e-74f4-5ce6-64768282b232"} 
    62 //    } 
    63 //]'; 
    64 //$_POST["request"] = '[ 
    65 //    { 
    66 //        "tabledefid": "tbld:c9ff2c8c-ce1f-659a-9c55-31bca7cce70e", 
    67 //        "command" : "inactivate", 
    68 //        "data" : [4], 
    69 //        "options" : {"useUuid" : false} 
    70 //    } 
    71 //]'; 
    72  
    73 //if(isset($_POST["foo"])){ 
    74 //    var_dump(stripslashes($_POST["request"])); 
    75 //    exit; 
    76 //} 
    77  
    7839require("../../include/session.php"); 
    7940require("include/apiclass.php"); 
  • trunk/phpbms/modules/api/include/apiclass.php

    r703 r759  
    456456 
    457457                switch($request["command"]){ 
     458                     
     459                    case "ping": 
     460                        //====================================================== 
     461                         
     462                        $this->_addToResponse("message", "Everything is phpBMSy!"); 
     463                         
     464                        break; 
    458465 
    459466                    case "insert": 
     
    636643                            include_once("include/search_class.php"); 
    637644 
    638                            //if($useUuid){ 
    639                            //     if(!isset($request["data"]->uuid)) 
    640                            //         $this->sendError("The `uuid` field must be set in request number ".$i, $request["data"], true); 
    641                            //     else 
    642                            //         $id = $request["data"]->uuid; 
    643                            // 
    644                            // }else{ 
    645                            //     if(!isset($request["data"]->id)) 
    646                            //         $this->sendError("The `id` field must be set in request number ".$i, $request["data"], true); 
    647                            //     else 
    648                            //         $id = $request["data"]->uuid; 
    649                            // }//end if 
    650  
    651645                            if($hasTableClassOveride){ 
    652646 
Scanned by Orvant Copyright © 2010 Kreotek, LLC. All Rights reserved.