A C++ DAL / ORM code generation framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

12 years ago
  1. #include "../src/sql/wsqlcolumn.h"
  2. #include <iostream>
  3. int main()
  4. {
  5. WSql::WSqlColumn clm;
  6. double testd = 1455.09432;
  7. int testi = 99;
  8. std::string tests = "this is a string";
  9. clm.setPrecision(5);
  10. clm.setDefaultValue(testd);
  11. clm.setDataType(WSql::WSqlDataType::DOUBLE);
  12. double d = clm.defaultValue<double>();
  13. std::cout.setf(std::ios::fixed, std::ios::floatfield);
  14. std::cout.precision(10);
  15. std::cout << "value: " << d << std::endl;
  16. std::cout << "type: " << WSql::WSqlDataType::toString(clm.dataType()) << std::endl;
  17. clm.setDefaultValue(testi);
  18. clm.setDataType(WSql::WSqlDataType::INT);
  19. int i = clm.defaultValue<int>();
  20. std::cout << "value: " << i << std::endl;
  21. std::cout << "type: " << WSql::WSqlDataType::toString(clm.dataType()) << std::endl;
  22. //clm.
  23. clm.setDefaultValue(tests);
  24. clm.setDataType(WSql::WSqlDataType::TEXT);
  25. std::string s = clm.defaultValue<std::string>();
  26. std::cout << "value: " << s.c_str() << std::endl;
  27. std::cout << "type: " << WSql::WSqlDataType::toString(clm.dataType()) << std::endl;
  28. return 0;
  29. }