Int maxPos() { … } Int main() { … EXEC SQL BEGIN DECLARE SECTION; charszServerDatabase[(SQLID_MAX * 2)+2] = dbname ; charszLoginPassword[(SQLID_MAX * 2)+2] = uname.password ; intt0, t1, t2, t3, t4 ; EXEC SQL END DECLARE SECTION; … EXEC SQL CONNECT TO :szServerDatabase USER :szLoginPassword; … EXEC SQL DECLARE C1 CURSOR FOR SELECT * FROM my_demo_test; EXEC SQL OPEN C1 ; … EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; while (SQLCODE == 0) { Pos = maxPos(t0, t1, t2, t3, t4); PosCount[Pos] = PosCount[Pos] + 1; EXEC SQL FETCH C1 INTO :t0, :t1, :t2, :t3, :t4 ; } }
{}