Author: chintana Date: Tue Dec 8 09:34:07 2009 New Revision: 888300 URL: http://svn.apache.org/viewvc?rev=888300&view=rev Log: (empty)
Modified: incubator/stonehenge/trunk/stocktrader/php/business_service/business_processor.php incubator/stonehenge/trunk/stocktrader/php/business_service/order_processor_proxy.php incubator/stonehenge/trunk/stocktrader/php/config_service/config_svc.php incubator/stonehenge/trunk/stocktrader/php/data_layer/database.php incubator/stonehenge/trunk/stocktrader/php/data_layer/mssql_database.php incubator/stonehenge/trunk/stocktrader/php/data_layer/mysql_database.php incubator/stonehenge/trunk/stocktrader/php/order_processor/order_processor.php Modified: incubator/stonehenge/trunk/stocktrader/php/business_service/business_processor.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/business_service/business_processor.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/business_service/business_processor.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/business_service/business_processor.php Tue Dec 8 09:34:07 2009 @@ -453,7 +453,8 @@ holding WHERE holdingid= '$sellInfo->holdingID'"; $result = $db->ExecuteQuery($query); - $symbol = $db->GetSQLValue($result, 0, 4); + $dbval = $db->GetSQLValue($result); + $symbol = $dbval['quote_symbol']; if ($symbol) { @@ -514,28 +515,29 @@ $response->getOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; - while(($orderID = $db->GetSQLValue($result, $rawNo, 0))) + while(($dbval = $db->GetSQLValue($result))) { + $orderID = $dbval['orderid']; $response->getOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderType = $db->GetSQLValue($result, $rawNo, 1); + orderType = $dbval['ordertype']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderStatus = $db->GetSQLValue($result, $rawNo, 2); + orderStatus = $dbval['orderstatus']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - openDate = formatDate($db->GetSQLValue($result, $rawNo, 3)); + openDate = formatDate($dbval['opendate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> - completionDate = formatDate($db->GetSQLValue($result, $rawNo, 4)); + completionDate = formatDate($dbval['completiondate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> - quantity = $db->GetSQLValue($result, $rawNo, 5); + quantity = $dbval['quantity']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - price = $db->GetSQLValue($result, $rawNo, 6); + price = $dbval['price']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderFee = $db->GetSQLValue($result, $rawNo, 7); + orderFee = $dbval['orderfee']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - symbol = $db->GetSQLValue($result, $rawNo, 8); + symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; if ($rawNo == TOP_ORDERS) @@ -572,11 +574,12 @@ { $response = new getHoldingResponse(); $response->getHoldingReturn = new HoldingDataBean(); + $dbval = $db->GetSQLValue($result); $response->getHoldingReturn->holdingID = $holdingInfo->holdingID; - $response->getHoldingReturn->quantity = $db->GetSQLValue($result, 0, 1); - $response->getHoldingReturn->purchasePrice = $db->GetSQLValue($result, 0, 2); - $response->getHoldingReturn->purchaseDate = formatDate($db->GetSQLValue($result, 0, 3)); - $response->getHoldingReturn->quoteID = $db->GetSQLValue($result, 0, 4); + $response->getHoldingReturn->quantity = $dbval['quantity']; + $response->getHoldingReturn->purchasePrice = $dbval['purchaseprice']; + $response->getHoldingReturn->purchaseDate = formatDate($dbval['purchasedate']); + $response->getHoldingReturn->quoteID = $dbval['quote_symbol']; } $db->CloseDatabase(); } @@ -655,24 +658,24 @@ $result = $db->ExecuteQuery($queryTSIA); if ($result) { - $response->getMarketSummaryReturn->TSIA = - $db->GetSQLValue($result, 0, 0); + $dbval = $db->GetSQLValue($result); + $response->getMarketSummaryReturn->TSIA = $dbval['tsia']; $result = null; } $result = $db->ExecuteQuery($queryOPENTSIA); if ($result) { - $response->getMarketSummaryReturn->openTSIA = - $db->GetSQLValue($result, 0, 0); + $dbval = $db->GetSQLValue($result); + $response->getMarketSummaryReturn->openTSIA = $dbval['opentsia']; $result = null; } $result = $db->ExecuteQuery($queryVolume); if($result) { - $response->getMarketSummaryReturn->volume = - $db->GetSQLValue($result, 0, 0); + $dbval = $db->GetSQLValue($result); + $response->getMarketSummaryReturn->volume = $dbval[0]; $result = null; } @@ -682,26 +685,27 @@ $response->getMarketSummaryReturn->topGainers = new ArrayOfQuoteDataBean(); $rawNo = 0; - while(($symbol = $db->GetSQLValue($result, $rawNo, 0)) && $rawNo < 5) + while(($dbval = $db->GetSQLValue($result)) && $rawNo < 5) { + $symbol = $dbval['symbol']; $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo] = new QuoteDataBean(); $response->getMarketSummaryReturn->topGainers-> QuoteDataBean[$rawNo]->symbol = $symbol; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->companyName = $db->GetSQLValue($result, $rawNo, 1); + QuoteDataBean[$rawNo]->companyName = $dbval['companyname']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->volume = $db->GetSQLValue($result, $rawNo, 2); + QuoteDataBean[$rawNo]->volume = $dbval['volume']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->price = $db->GetSQLValue($result, $rawNo, 3); + QuoteDataBean[$rawNo]->price = $dbval['price']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->open = $db->GetSQLValue($result, $rawNo, 4); + QuoteDataBean[$rawNo]->open = $dbval['open1']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->low = $db->GetSQLValue($result, $rawNo, 5); + QuoteDataBean[$rawNo]->low = $dbval['low']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->high = $db->GetSQLValue($result, $rawNo, 6); + QuoteDataBean[$rawNo]->high = $dbval['high']; $response->getMarketSummaryReturn->topGainers-> - QuoteDataBean[$rawNo]->change = $db->GetSQLValue($result, $rawNo, 7); + QuoteDataBean[$rawNo]->change = $dbval['change1']; $rawNo = $rawNo + 1; } $result = null; @@ -713,26 +717,27 @@ $response->getMarketSummaryReturn->topLosers = new ArrayOfQuoteDataBean(); $rawNo = 0; - while(($symbol = $db->GetSQLValue($result, $rawNo, 0)) && $rawNo < 5) + while(($dbval = $db->GetSQLValue($result)) && $rawNo < 5) { + $symbol = $dbval['symbol']; $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo] = new QuoteDataBean(); $response->getMarketSummaryReturn->topLosers-> QuoteDataBean[$rawNo]->symbol = $symbol; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->companyName = $db->GetSQLValue($result, $rawNo, 1); + QuoteDataBean[$rawNo]->companyName = $dbval['companyname']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->volume = $db->GetSQLValue($result, $rawNo, 2); + QuoteDataBean[$rawNo]->volume = $dbval['volume']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->price = $db->GetSQLValue($result, $rawNo, 3); + QuoteDataBean[$rawNo]->price = $dbval['price']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->open = $db->GetSQLValue($result, $rawNo, 4); + QuoteDataBean[$rawNo]->open = $dbval['open1']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->low = $db->GetSQLValue($result, $rawNo, 5); + QuoteDataBean[$rawNo]->low = $dbval['low']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->high = $db->GetSQLValue($result, $rawNo, 6); + QuoteDataBean[$rawNo]->high = $dbval['high']; $response->getMarketSummaryReturn->topLosers-> - QuoteDataBean[$rawNo]->change = $db->GetSQLValue($result, $rawNo, 7); + QuoteDataBean[$rawNo]->change = $dbval['change1']; $rawNo = $rawNo + 1; } $result = null; @@ -766,7 +771,8 @@ $result = $db->ExecuteQuery($query); if($result) { - $response = $db->GetSQLValue($result, 0, 0); + $dbval = $db->GetSQLValue($result); + $response = $dbval['accountid']; } return $response; } @@ -882,14 +888,15 @@ { $response = new getQuoteResponse(); $response->getQuoteReturn = new QuoteDataBean(); - $response->getQuoteReturn->symbol = $db->GetSQLValue($result, 0, 0); - $response->getQuoteReturn->companyName = $db->GetSQLValue($result, 0, 1); - $response->getQuoteReturn->volume = $db->GetSQLValue($result, 0, 2); - $response->getQuoteReturn->price = $db->GetSQLValue($result, 0, 3); - $response->getQuoteReturn->open = $db->GetSQLValue($result, 0, 4); - $response->getQuoteReturn->low = $db->GetSQLValue($result, 0, 5); - $response->getQuoteReturn->high = $db->GetSQLValue($result, 0, 6); - $response->getQuoteReturn->change = $db->GetSQLValue($result, 0, 7); + $dbval = $db->GetSQLValue($result); + $response->getQuoteReturn->symbol = $dbval['symbol']; + $response->getQuoteReturn->companyName = $dbval['companyname']; + $response->getQuoteReturn->volume = $dbval['volume']; + $response->getQuoteReturn->price = $dbval['price']; + $response->getQuoteReturn->open = $dbval['open1']; + $response->getQuoteReturn->low = $dbval['low']; + $response->getQuoteReturn->high = $dbval['high']; + $response->getQuoteReturn->change = $dbval['change1']; } $db->CloseDatabase(); @@ -985,20 +992,21 @@ $response->getHoldingsReturn = new ArrayOfHoldingDataBean(); $rawNo = 0; - while(($holdingID = $db->GetSQLValue($result, $rawNo, 0))) + while(($dbval = $db->GetSQLValue($result))) { + $holdingID = $dbval['holdingid']; $response->getHoldingsReturn->HoldingDataBean[$rawNo] = new HoldingDataBean(); $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> - holdingID = $db->GetSQLValue($result, $rawNo, 0); + holdingID = $holdingID; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> - quantity = $db->GetSQLValue($result, $rawNo, 1); + quantity = $dbval['quantity']; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> - purchasePrice = $db->GetSQLValue($result, $rawNo, 2); + purchasePrice = $dbval['purchaseprice']; $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> - purchaseDate = formatDate($db->GetSQLValue($result, $rawNo, 3)); + purchaseDate = formatDate($dbval['purchasedate']); $response->getHoldingsReturn->HoldingDataBean[$rawNo]-> - quoteID = $db->GetSQLValue($result, $rawNo, 4); + quoteID = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } } @@ -1032,28 +1040,29 @@ $response->getClosedOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; - while(($orderID = $db->GetSQLValue($result, $rawNo, 0))) + while(($dbval = $db->GetSQLValue($result))) { + $orderID = $dbval['orderid']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - orderType = $db->GetSQLValue($result, 0, 1); + orderType = $dbval['ordertype']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - orderStatus = $db->GetSQLValue($result, $rawNo, 2); + orderStatus = $dbval['orderstatus']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - completionDate = formatDate($db->GetSQLValue($result, $rawNo, 3)); + completionDate = formatDate($dbval['completiondate']); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - openDate = formatDate($db->GetSQLValue($result, $rawNo, 4)); + openDate = formatDate($dbval['opendate']); $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - quantity = $db->GetSQLValue($result, $rawNo, 5); + quantity = $dbval['quantity']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - price = $db->GetSQLValue($result, $rawNo, 6); + price = $dbval['price']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - orderFee = $db->GetSQLValue($result, $rawNo, 7); + orderFee = $dbval['orderfee']; $response->getClosedOrdersReturn->OrderDataBean[$rawNo]-> - symbol = $db->GetSQLValue($result, $rawNo, 8); + symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } @@ -1092,12 +1101,13 @@ { $response = new getAccountProfileDataResponse(); $response->getAccountProfileDataReturn = new AccountProfileDataBean(); + $dbval = $db->GetSQLValue($result); $response->getAccountProfileDataReturn->userID = $userID; - $response->getAccountProfileDataReturn->password = $db->GetSQLValue($result, 0, 1); - $response->getAccountProfileDataReturn->fullName = $db->GetSQLValue($result, 0, 2); - $response->getAccountProfileDataReturn->address = $db->GetSQLValue($result, 0, 3); - $response->getAccountProfileDataReturn->email = $db->GetSQLValue($result, 0, 4); - $response->getAccountProfileDataReturn->creditCard = $db->GetSQLValue($result, 0, 5); + $response->getAccountProfileDataReturn->password = $dbval['password']; + $response->getAccountProfileDataReturn->fullName = $dbval['fullname']; + $response->getAccountProfileDataReturn->address = $dbval['address']; + $response->getAccountProfileDataReturn->email = $dbval['email']; + $response->getAccountProfileDataReturn->creditCard = $dbval['creditcard']; } $db->CloseDatabase(); } @@ -1126,14 +1136,15 @@ { $response = new getAccountDataResponse(); $response->getAccountDataReturn = new AccountDataBean(); - $response->getAccountDataReturn->accountID = $db->GetSQLValue($result, 0, 0); - $response->getAccountDataReturn->profileID = $db->GetSQLValue($result, 0, 1); - $response->getAccountDataReturn->creationDate = formatDate($db->GetSQLValue($result, 0, 2)); - $response->getAccountDataReturn->openBalance = $db->GetSQLValue($result, 0, 3); - $response->getAccountDataReturn->logoutCount = $db->GetSQLValue($result, 0, 4); - $response->getAccountDataReturn->balance = $db->GetSQLValue($result, 0, 5); - $response->getAccountDataReturn->lastLogin = formatDate($db->GetSQLValue($result, 0, 6)); - $response->getAccountDataReturn->loginCount = $db->GetSQLValue($result, 0, 7); + $dbval = $db->GetSQLValue($result); + $response->getAccountDataReturn->accountID = $dbval['accountid']; + $response->getAccountDataReturn->profileID = $dbval['profile_userid']; + $response->getAccountDataReturn->creationDate = formatDate($dbval['creationdate']); + $response->getAccountDataReturn->openBalance = $dbval['openbalance']; + $response->getAccountDataReturn->logoutCount = $dbval['logoutcount']; + $response->getAccountDataReturn->balance = $dbval['balance']; + $response->getAccountDataReturn->lastLogin = formatDate($dbval['lastlogin']); + $response->getAccountDataReturn->loginCount = $dbval['logincount']; } $db->CloseDatabase(); } @@ -1166,28 +1177,29 @@ $response->getOrdersReturn = new ArrayOfOrderDataBean(); $rawNo = 0; - while(($orderID = $db->GetSQLValue($result, $rawNo, 0))) + while(($dbval = $db->GetSQLValue($result))) { + $orderID = $dbval['orderid']; $response->getOrdersReturn->OrderDataBean[$rawNo] = new OrderDataBean(); $response->getOrdersReturn->OrderDataBean[$rawNo]-> orderID = $orderID; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderType = $db->GetSQLValue($result, $rawNo, 1); + orderType = $dbval['ordertype']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderStatus = $db->GetSQLValue($result, $rawNo, 2); + orderStatus = $dbval['orderstatus']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - openDate = formatDate($db->GetSQLValue($result, $rawNo, 3)); + openDate = formatDate($dbval['opendate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> - completionDate = formatDate($db->GetSQLValue($result, $rawNo, 4)); + completionDate = formatDate($dbval['completiondate']); $response->getOrdersReturn->OrderDataBean[$rawNo]-> - quantity = $db->GetSQLValue($result, $rawNo, 5); + quantity = $dbval['quantity']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - price = $db->GetSQLValue($result, $rawNo, 6); + price = $dbval['price']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - orderFee = $db->GetSQLValue($result, $rawNo, 7); + orderFee = $dbval['orderfee']; $response->getOrdersReturn->OrderDataBean[$rawNo]-> - symbol = $db->GetSQLValue($result, $rawNo, 8); + symbol = $dbval['quote_symbol']; $rawNo = $rawNo + 1; } @@ -1216,8 +1228,8 @@ WHERE accountprofile.userid = '$userID'"; $result = $db->ExecuteQuery($query); - - if ($password == $db->GetSQLValue($result, 0, 1)) + $dbval = $db->GetSQLValue($result); + if ($dbval['password']) { $query = "UPDATE account SET logincount = (logincount + 1), lastlogin = CURRENT_TIMESTAMP WHERE @@ -1231,18 +1243,19 @@ account.profile_userid = '$userID'"; $result = null; - $result = $db->ExecuteQuery($query); + $result = $db->ExecuteQuery($query); if ($result) { $response = new loginResponse(); $response->loginReturn = new AccountDataBean(); - $response->loginReturn->accountID = $db->GetSQLValue($result, 0, 0); - $response->loginReturn->creationDate = formatDate($db->GetSQLValue($result, 0, 1)); - $response->loginReturn->openBalance = $db->GetSQLValue($result, 0, 2); - $response->loginReturn->logoutCount = $db->GetSQLValue($result, 0, 3); - $response->loginReturn->balance = $db->GetSQLValue($result, 0, 4); - $response->loginReturn->lastLogin = formatDate($db->GetSQLValue($result, 0, 5)); - $response->loginReturn->loginCount = $db->GetSQLValue($result, 0, 6); + $dbval = $db->GetSQLValue($result); + $response->loginReturn->accountID = $dbval['accountid']; + $response->loginReturn->creationDate = formatDate($dbval['creationdate']); + $response->loginReturn->openBalance = $dbval['openbalance']; + $response->loginReturn->logoutCount = $dbval['logoutcount']; + $response->loginReturn->balance = $dbval['balance']; + $response->loginReturn->lastLogin = formatDate($dbval['lastlogin']); + $response->loginReturn->loginCount = $dbval['logincount']; $response->loginReturn->profileID = $userID; } } Modified: incubator/stonehenge/trunk/stocktrader/php/business_service/order_processor_proxy.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/business_service/order_processor_proxy.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/business_service/order_processor_proxy.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/business_service/order_processor_proxy.php Tue Dec 8 09:34:07 2009 @@ -147,7 +147,7 @@ "OrderDataBean" => "OrderDataBean", "SubmitOrder" => "SubmitOrder"); - if ($OPSConfig->GetBSConfigResult->Sec) + if ($OPSConfig->GetBSConfigResult->Sec == "true") { //This is the security information $rec_cert = ws_get_key_from_file("../resources/keys/OPS.cert"); Modified: incubator/stonehenge/trunk/stocktrader/php/config_service/config_svc.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/config_service/config_svc.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/config_service/config_svc.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/config_service/config_svc.php Tue Dec 8 09:34:07 2009 @@ -40,11 +40,12 @@ // getting the BS configured for the client $query = "SELECT bs FROM clienttobs WHERE client = '" . $client . "'"; $result = $db->ExecuteQuery($query); - + $bs = ''; // hold the BS corresponding to the input CLIENT if ($result) { - $bs = $db->GetSQLValue($result, 0, 0); + $dbval = $db->GetSQLValue($result); + $bs = $dbval['bs']; } if ($bs) { @@ -53,9 +54,10 @@ if ($result) { $client_config->GetClientConfigResult = new ClientConfigResponse(); - $client_config->GetClientConfigResult->Sec = $db->GetSQLValue($result, 0, 0) ? "true" : "false"; - $client_config->GetClientConfigResult->BSName = $db->GetSQLValue($result, 0, 1); - $client_config->GetClientConfigResult->BS = $db->GetSQLValue($result, 0, 2); + $dbval = $db->GetSQLValue($result); + $client_config->GetClientConfigResult->Sec = $dbval['sec'] ? "true" : "false"; + $client_config->GetClientConfigResult->BSName = $dbval['servicename']; + $client_config->GetClientConfigResult->BS = $dbval['url']; } } @@ -87,7 +89,8 @@ if ($result) { - $ops = $db->GetSQLValue( $result, 0, 0 ); + $dbval = $db->GetSQLValue( $result ); + $ops = $dbval['ops']; } if ($ops) { @@ -96,9 +99,10 @@ if ($result) { $bs_config->GetBSConfigResult = new BSConfigResponse ( ); - $bs_config->GetBSConfigResult->Sec = $db->GetSQLValue ( $result, 0, 0 ) ? "true" : "false"; - $bs_config->GetBSConfigResult->OPSName = $db->GetSQLValue ( $result, 0, 1 ); - $bs_config->GetBSConfigResult->OPS = $db->GetSQLValue ( $result, 0, 2 ); + $dbval = $db->GetSQLValue( $result ); + $bs_config->GetBSConfigResult->Sec = ($dbval['sec'] == "true" || $dbval['sec'] == "Y") ? "true" : "false"; + $bs_config->GetBSConfigResult->OPSName = $dbval['servicename']; + $bs_config->GetBSConfigResult->OPS = $dbval['url']; $host = ''; @@ -195,12 +199,12 @@ $locations = new GetBSLocationsResponse(); $locations->GetBSLocationsResult = new ArrayOfServiceLocation(); - if ($result) { - for ($i = 0; $db->GetSQLValue($result, $i, 1); $i++) { + if ($result) { + for ($i = 0; $dbval = $db->GetSQLValue($result); $i++) { $locations->GetBSLocationsResult->ServiceLocation[$i] = new ServiceLocation(); - $locations->GetBSLocationsResult->ServiceLocation[$i]->Sec = $db->GetSQLValue($result, $i, 0) ? "true" : "false"; - $locations->GetBSLocationsResult->ServiceLocation[$i]->ServiceName = $db->GetSQLValue($result, $i, 1); - $locations->GetBSLocationsResult->ServiceLocation[$i]->ServiceURL = $db->GetSQLValue($result, $i, 2); + $locations->GetBSLocationsResult->ServiceLocation[$i]->Sec = $dbval['sec'] ? "true" : "false"; + $locations->GetBSLocationsResult->ServiceLocation[$i]->ServiceName = $dbval['servicename']; + $locations->GetBSLocationsResult->ServiceLocation[$i]->ServiceURL = $dbval['url']; } } @@ -227,11 +231,11 @@ $locations->GetOPSLocationsResult = new ArrayOfServiceLocation(); if ($result) { - for ($i = 0; $db->GetSQLValue($result, $i, 1); $i++) { + for ($i = 0; $dbval = $db->GetSQLValue($result); $i++) { $locations->GetOPSLocationsResult->ServiceLocation[$i] = new ServiceLocation(); - $locations->GetOPSLocationsResult->ServiceLocation[$i]->Sec = $db->GetSQLValue($result, $i, 0) ? "true" : "false"; - $locations->GetOPSLocationsResult->ServiceLocation[$i]->ServiceName = $db->GetSQLValue($result, $i, 1); - $locations->GetOPSLocationsResult->ServiceLocation[$i]->ServiceURL = $db->GetSQLValue($result, $i, 2); + $locations->GetOPSLocationsResult->ServiceLocation[$i]->Sec = $dbval['sec'] ? "true" : "false"; + $locations->GetOPSLocationsResult->ServiceLocation[$i]->ServiceName = $dbval['servicename']; + $locations->GetOPSLocationsResult->ServiceLocation[$i]->ServiceURL = $dbval['url']; } } @@ -257,8 +261,9 @@ $query = "SELECT servicename FROM service WHERE servicename = '$sname'"; $result = $db->ExecuteQuery($query); $q2 = ''; - - if ($result && $db->GetSQLValue($result, 0, 0)) { + + $dbval = $db->GetSQLValue($result); + if ($result && $dbval['servicename']) { // update $q2 = "UPDATE service SET url = '$surl', sec = $sec WHERE servicename = '$sname'"; } else { Modified: incubator/stonehenge/trunk/stocktrader/php/data_layer/database.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/data_layer/database.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/data_layer/database.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/data_layer/database.php Tue Dec 8 09:34:07 2009 @@ -58,11 +58,9 @@ * This method returns the a value from a sql result set (a tuple * returned after execution of ExecuteQuery method. * @param result, the result obtained from ExecuteQuery method. - * @param raw, the raw number - * @param column, the column number * @return the value at (raw, column) of the tuple. */ - abstract public function GetSQLValue($result, $raw, $column); + abstract public function GetSQLValue($result); /** * Gets the ID of the last inserted record. returns -1 if error Modified: incubator/stonehenge/trunk/stocktrader/php/data_layer/mssql_database.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/data_layer/mssql_database.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/data_layer/mssql_database.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/data_layer/mssql_database.php Tue Dec 8 09:34:07 2009 @@ -51,10 +51,12 @@ { if ($this->connectionInfo != NULL) { - $this->dbhandle = mssql_connect($this->connectionInfo->server, $this->connectionInfo->user, $this->connectionInfo->password) + $this->dbhandle = sqlsrv_connect( $this->connectionInfo->server, + array( "Database" => $this->connectionInfo->database, + "UID" => $this->connectionInfo->user, + "PWD" => $this->connectionInfo->password, + "MultipleActiveResultSets" => 0 ) ) or die ("Couldn't connect to the server!!!"); - $selected = mssql_select_db($this->connectionInfo->database, $this->dbhandle) - or die ("Couldn't open the database!!!"); } return true; } @@ -65,7 +67,7 @@ */ public function CloseDatabase() { - mssql_close($this->dbhandle); + sqlsrv_close($this->dbhandle); } /** @@ -75,20 +77,18 @@ */ public function ExecuteQuery($query) { - return mssql_query($query, $this->dbhandle); + return sqlsrv_query( $this->dbhandle, $query ); } /** * This method returns the a value from a sql result set (a tuple * returned after execution of ExecuteQuery method. * @param result, the result obtained from ExecuteQuery method. - * @param raw, the raw number - * @param column, the column number * @return the value at (raw, column) of the tuple. */ - public function GetSQLValue($result, $raw, $column) - { - return mssql_result($result, $raw, $column); + public function GetSQLValue($result) + { + return sqlsrv_fetch_array($result); } /** @@ -103,7 +103,8 @@ } else { - return $this->GetSQLValue($result, 0, 0); + $dbval = $this->GetSQLValue($result); + return $dbval[0]; } } Modified: incubator/stonehenge/trunk/stocktrader/php/data_layer/mysql_database.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/data_layer/mysql_database.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/data_layer/mysql_database.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/data_layer/mysql_database.php Tue Dec 8 09:34:07 2009 @@ -82,13 +82,11 @@ * This method returns the a value from a sql result set (a tuple * returned after execution of ExecuteQuery method. * @param result, the result obtained from ExecuteQuery method. - * @param raw, the raw number - * @param column, the column number * @return the value at (raw, column) of the tuple. */ - public function GetSQLValue($result, $raw, $column) + public function GetSQLValue($result) { - return mysql_result($result, $raw, $column); + return mysql_fetch_array($result, MYSQL_BOTH); } /** Modified: incubator/stonehenge/trunk/stocktrader/php/order_processor/order_processor.php URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/order_processor/order_processor.php?rev=888300&r1=888299&r2=888300&view=diff ============================================================================== --- incubator/stonehenge/trunk/stocktrader/php/order_processor/order_processor.php (original) +++ incubator/stonehenge/trunk/stocktrader/php/order_processor/order_processor.php Tue Dec 8 09:34:07 2009 @@ -193,10 +193,11 @@ if ($result) { $quote = new Quote(); - $quote->symbol = $db->GetSQLValue($result, 0, 0); //Get the symbol. - $quote->price = $db->GetSQLValue($result, 0, 3); //Get the price. - $quote->low = $db->GetSQLValue($result, 0, 5); //Get the low value. - $quote->high = $db->GetSQLValue($result, 0, 6); //Get the high value. + $dbval = $db->GetSQLValue($result); + $quote->symbol = $dbval['symbol'] ; //Get the symbol. + $quote->price = $dbval['price']; //Get the price. + $quote->low = $dbval['low']; //Get the low value. + $quote->high = $dbval['high']; //Get the high value. } return $quote; } @@ -369,13 +370,14 @@ if ($result) { - $holding = new Holding(); - $holding->holdingID = $db->GetSQLValue($result, 0, 0); //Get the holdingID. - $holding->accountID = $db->GetSQLValue($result, 0, 1); //Get the accountID. - $holding->quantity = $db->GetSQLValue($result, 0, 2); //Get the quantity. - $holding->purchasePrice = $db->GetSQLValue($result, 0, 3); //Get the price. - $holding->purchaseDate = $db->GetSQLValue($result, 0, 4); //Get the date. - $holding->quoteSymbol = $db->GetSQLValue($result, 0, 5); //Get the symbol. + $holding = new Holding(); + $dbval = $db->GetSQLValue($result); + $holding->holdingID = $dbval['holdingid']; //Get the holdingID. + $holding->accountID = $dbval['accountid']; //Get the accountID. + $holding->quantity = $dbval['quantity']; //Get the quantity. + $holding->purchasePrice = $dbval['purchaseprice']; //Get the price. + $holding->purchaseDate = $dbval['purchasedate']; //Get the date. + $holding->quoteSymbol = $dbval['quote_symbol']; //Get the symbol. } else { @@ -454,7 +456,8 @@ $result = $db->ExecuteQuery($query); if ($result != NULL) { - $accountID = $db->GetSQLValue($result, 0, 0); //Get accountID. + $dbval = $db->GetSQLValue($result); + $accountID = $dbval['account_accountid']; //Get accountID. } else {