Skip to content

Commit

Permalink
Fix oracle datatype error
Browse files Browse the repository at this point in the history
  • Loading branch information
Chat2DB-Pro committed Nov 15, 2023
1 parent fc6f7aa commit 5b126a3
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//package ai.chat2db.server.start.config;
//
//import jakarta.annotation.PostConstruct;
//import org.springframework.boot.context.event.ApplicationReadyEvent;
//import org.springframework.context.ApplicationListener;
//import org.springframework.stereotype.Component;
//
//import java.util.Scanner;
//
//@Component
//public class StdinReader implements ApplicationListener<ApplicationReadyEvent> {
//
//
// @Override
// public void onApplicationEvent(ApplicationReadyEvent event) {
// // 启动读取 stdin 的线程
// new Thread(() -> readStdin()).start();
// }
//
// private void readStdin() {
// Scanner scanner = new Scanner(System.in);
// while (scanner.hasNextLine()) {
// String line = scanner.nextLine();
// // 处理接收到的数据
// System.out.println("接收到数据: " + line);
// // 在这里调用其他服务或逻辑
// }
// }
//
//}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
spring:
datasource:
# 配置自带数据库的相对路径
url: jdbc:h2:~/.chat2db/db/chat2db_dev;MODE=MYSQL
url: jdbc:h2:~/.chat2db/db/chat2db_dev;MODE=MYSQL;FILE_LOCK=NO
driver-class-name: org.h2.Driver
h2:
console:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ public WebPageResult<TableVO> list(@Valid TableBriefQueryRequest request) {
PageResult<Table> tableDTOPageResult = tableService.pageQuery(queryParam, tableSelector);
List<TableVO> tableVOS = rdbWebConverter.tableDto2vo(tableDTOPageResult.getData());

ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
singleThreadExecutor.submit(() -> {
try {
Chat2DBContext.putContext(connectInfo);
syncTableVector(request);
// syncTableEs(request);
} catch (Exception e) {
log.error("sync table vector error", e);
} finally {
Chat2DBContext.removeContext();
}
log.info("sync table vector finish");
});
// ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
// singleThreadExecutor.submit(() -> {
// try {
// Chat2DBContext.putContext(connectInfo);
// syncTableVector(request);
//// syncTableEs(request);
// } catch (Exception e) {
// log.error("sync table vector error", e);
// } finally {
// Chat2DBContext.removeContext();
// }
// log.info("sync table vector finish");
// });
return WebPageResult.of(tableVOS, tableDTOPageResult.getTotal(), request.getPageNo(),
request.getPageSize());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ public WebPageResult<TableVO> list(@Valid TableBriefQueryRequest request) {
tableSelector.setIndexList(false);
PageResult<Table> tableDTOPageResult = tableService.pageQuery(queryParam, tableSelector);
List<TableVO> tableVOS = rdbWebConverter.tableDto2vo(tableDTOPageResult.getData());
ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
singleThreadExecutor.submit(() -> {
try {
Chat2DBContext.putContext(connectInfo);
syncTableVector(request);
// syncTableEs(request);
} catch (Exception e) {
log.error("sync table vector error", e);
} finally {
Chat2DBContext.removeContext();
}
log.info("sync table vector finish");
});
// ConnectInfo connectInfo = Chat2DBContext.getConnectInfo();
// singleThreadExecutor.submit(() -> {
// try {
// Chat2DBContext.putContext(connectInfo);
// syncTableVector(request);
//// syncTableEs(request);
// } catch (Exception e) {
// log.error("sync table vector error", e);
// } finally {
// Chat2DBContext.removeContext();
// }
// log.info("sync table vector finish");
// });
return WebPageResult.of(tableVOS, tableDTOPageResult.getTotal(), request.getPageNo(),
request.getPageSize());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ public static Connection getConnection() {
if (connection == null) {
synchronized (connectInfo) {
connection = connectInfo.getConnection();
if (connection != null) {
return connection;
} else {
try {
if (connection != null && !connection.isClosed()) {
return connection;
} else {
connection = getDBManage().getConnection(connectInfo);
}
} catch (SQLException e) {
connection = getDBManage().getConnection(connectInfo);
}
}
Expand Down

0 comments on commit 5b126a3

Please sign in to comment.