tableinfo.bmx 753 B

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