test-postgresql.nut 511 B

1234567891011121314151617181920212223
  1. local db = PostgreSQL("host=localhost dbname=ourbiz user=ourbiz password=ourbiz2");
  2. print(db.version());
  3. print(db.exec_scalar("select count(*) from pg_type;"));
  4. local qry = db.exec_query("select * from pg_type;");
  5. local col_count = qry.col_count();
  6. while(qry.next_row()){
  7. for(local i=0; i < col_count; ++i){
  8. print1(qry.col_value(i));
  9. print1("|");
  10. }
  11. print1("\n");
  12. }
  13. qry._curr_row = -1;
  14. while(qry.next_row()){
  15. foreach(v in qry.row_as_array()){
  16. print1(v);
  17. print1("|");
  18. }
  19. print1("\n");
  20. }
  21. db.close();