2
0

tableinfo.bmx 718 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. SuperStrict
  2. Framework Database.PostgreSQL
  3. Import BRL.StandardIO
  4. Local db:TDBConnection = LoadDatabase("POSTGRESQL", "maxtest", "localhost", 0, "user", "pass")
  5. If Not db Then
  6. Print "Didn't work..."
  7. End
  8. End If
  9. If db.hasError() Then
  10. errorAndClose(db)
  11. End If
  12. If db.isOpen() Then
  13. Local table:TDBTable = db.getTableInfo("person", True)
  14. If table Then
  15. Print "name = " + table.name
  16. For Local i:Int = 0 Until table.columns.length
  17. Print i + " : " + table.columns[i].name
  18. Next
  19. Print "DDL : ~n" + table.ddl
  20. Else
  21. Print "oops..."
  22. End If
  23. db.close()
  24. End If
  25. Function errorAndClose(db:TDBConnection)
  26. Print db.error().toString()
  27. db.close()
  28. End
  29. End Function