<?php
require __DIR__.'/common.php';
require __DIR__.'/Native.php';
$n=0;
PPGate::plan('AI','CALL SP_TABLEDEF(?, ?)',[1=>['AIZHCT_APP',2],2=>['YOSHOP_USER',2]]);$n++;
function reject($fn){global $n;try{$fn();}catch(Throwable $e){$n++;return;}throw new RuntimeException('Counterexample wrongly accepted');}
reject(static function(){PPGate::kind('ZHCT','DELETE FROM ydy_prepay_order WHERE id=2');});
reject(static function(){PPGate::kind('ZHCT','SELECT * FROM ydy_prepay_order; DROP TABLE ydy_prepay_order');});
reject(static function(){PPGate::kind('AI','SELECT * FROM ydy_user');});
reject(static function(){PPGate::kind('ZHCT','INSERT INTO ydy_user (id) VALUES (:x)');});
reject(static function(){pp_fields(['id'=>2,'extra'=>1],['id'=>2]);});
reject(static function(){pp_where('id=:x OR id=2',['x'=>[2,1]]);});
reject(static function(){pp_where('id=:x AND meal_order_id=:z AND user_id=4',['x'=>[2,1],'z'=>[0,1]]);});
reject(static function(){pp_fields(['price'=>2],['price'=>1]);});
pp_need(pp_where('( id = :x ) AND ( meal_order_id = :z )',['x'=>[8,1],'z'=>[0,1]])===['id'=>8,'meal_order_id'=>0],'Exact CAS parser');$n++;
echo pp_json(['pure_pass'=>$n,'SQL'=>0,'DB'=>0])."\n";
