SQL

SQL integeration

TODO

subroutine test_select_simple ()
include lib_sql

call ptunit_planadd(1)
integer dbh
call sql_prepare(dbh,"SELECT * FROM test_full ORDER BY id DESC")
call sql_execute(dbh)
integer i = 0
do while (sql_fetch(dbh))
    i = i + 1
    print "(3x,i2,' id=', i4, ' description=', a12, ' cost=', i8, ' len=', i4)"
+      sql_row(dbh),
+      sql_get_integer(dbh, "id"), 
+      sql_get_string(dbh, "description"),
+      sql_get_integer(dbh, "cost"),
+      sql_get_length(dbh, "description")
    if (i == 4) then
        call ptunit_cmp_ok(sql_get_integer(dbh, "id"), "==", 5, "Saw that we selected id 5 last")
    end if
end do

call sql_info()
call sql_finish(dbh)

return

end subroutine test_select_simple