Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i don't know what is that sql statement mean any one exaplain it


note that
QS_BUILD_CREATEUPGRADE
=5

IF (proc_type='".QS_BUILD_CREATEUPGRADE."' , building_id <> 25 AND building_id <> 26, 1)





it's mysql
Posted
Updated 8-Jun-14 5:57am
v2
Comments
PIEBALDconsult 8-Jun-14 11:50am    
Should that IF maybe be an IIF ?

1 solution

It doesn't matter what QS_BUILD_CREATEUPGRADE is: that code treats it's name as a string.
It looks like it compares the value in the proc_type column with the string value:
".QS_BUILD_CREATEUPGRADE."
but it looks like no SQL IF function or statement I recognize: I suspect that isn't SQL but some odd processor which feeds to / from SQL

Check where you got the code from.
 
Share this answer
 
Comments
TheSniper105 8-Jun-14 11:56am    
here is link of the code

https://raw.githubusercontent.com/Bazaid/tatar-wars/master/app/model/queue.php



this lines

$tasksTypeArray = ($troopTrain ? array( QS_TROOP_TRAINING ) : array( QS_BUILD_CREATEUPGRADE, QS_TROOP_RESEARCH, QS_TROOP_UPGRADE_ATTACK, QS_TROOP_UPGRADE_DEFENSE ));
$updatesCount = $this->provider->executeQuery2( 'UPDATE
p_queue q
SET
q.end_date=NOW()
WHERE
q.player_id=%s
AND q.village_id=%s
AND q.proc_type IN(%s)
AND IF(q.proc_type=%s, q.building_id!=25 AND q.building_id!=26, 1)', array( $playerId, $this->page->data['selected_village_id'], implode( ',', $tasksTypeArray ), QS_BUILD_CREATEUPGRADE ) );

if (0 < $updatesCount) {
$this->page->data['gold_num'] -= $goldCost;
$this->provider->executeQuery( 'UPDATE p_players p SET p.gold_num=p.gold_num-%s WHERE p.id=%s', array( $goldCost, $playerId ) );
$this->_changeUpdateKey( );
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900