AddCameraOrientationColumns.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4. import java.sql.Statement;
  5. public class AddCameraOrientationColumns {
  6. public static void main(String[] args) {
  7. String url = "jdbc:dm://192.168.0.145:30236?charSet=utf8";
  8. String username = "WATERSHED";
  9. String password = "WaterShed./1224";
  10. try (Connection conn = DriverManager.getConnection(url, username, password);
  11. Statement stmt = conn.createStatement()) {
  12. // 添加第三人称相机朝向字段
  13. String addHeadingSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_HEADING DECIMAL(10,6)";
  14. String addPitchSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_PITCH DECIMAL(10,6)";
  15. String addRollSql = "ALTER TABLE BUSINESS_SCENE ADD COLUMN THIRD_PERSON_CAMERA_ROLL DECIMAL(10,6)";
  16. try {
  17. stmt.execute(addHeadingSql);
  18. System.out.println("成功添加 THIRD_PERSON_CAMERA_HEADING 字段");
  19. } catch (SQLException e) {
  20. System.out.println("THIRD_PERSON_CAMERA_HEADING 字段已存在,跳过");
  21. }
  22. try {
  23. stmt.execute(addPitchSql);
  24. System.out.println("成功添加 THIRD_PERSON_CAMERA_PITCH 字段");
  25. } catch (SQLException e) {
  26. System.out.println("THIRD_PERSON_CAMERA_PITCH 字段已存在,跳过");
  27. }
  28. try {
  29. stmt.execute(addRollSql);
  30. System.out.println("成功添加 THIRD_PERSON_CAMERA_ROLL 字段");
  31. } catch (SQLException e) {
  32. System.out.println("THIRD_PERSON_CAMERA_ROLL 字段已存在,跳过");
  33. }
  34. System.out.println("所有字段添加完成!");
  35. } catch (SQLException e) {
  36. e.printStackTrace();
  37. }
  38. }
  39. }