投稿者 okigaru | 2016/06/01

こんなExecuteSQLの書き方を発見


Let ( [ ~sql = "
SELECT t1.~field
FROM ~table1 t1
JOIN ~table2 t2
ON t1.~field = t2.~field
WHERE ~field LIKE '%~value%'
AND ~field=?
ORDER BY ~field";

$sqlQuery = Substitute ( ~sql ;
[ "~table1" ; SQLTableName ( Table1::fieldName ) ];
[ "~table2" ; SQLTableName ( Table2::fieldName ) ];
[ "~field" ; SQLFieldName ( Table1::fieldName ) ];
[ "~value" ; Table::field ]
);

$sqlResult = ExecuteSQL ( $sqlQuery ; "" ; "" ;
$value;
$value[2];
$value[$n]
)
];
//Substitute ( $sqlQuery ; " " ; "" ) &¶& // sql preview
If ( $sqlResult = "?" ;
Let ( ~debug = False ; If ( ~debug ; SQLDebugResult ( $sqlResult ) ; False ) );
$sqlResult
)
)

広告

カテゴリー

%d人のブロガーが「いいね」をつけました。