mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-27 17:52:28 +08:00
feat:support Serializable
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
package ai.chat2db.plugin.mongodb;
|
||||
|
||||
import ai.chat2db.spi.model.Command;
|
||||
import ai.chat2db.spi.model.ExecuteResult;
|
||||
import ai.chat2db.spi.sql.SQLExecutor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MongodbCommandExecutor extends SQLExecutor {
|
||||
|
||||
@Override
|
||||
public List<ExecuteResult> executeSelectTable(Command command) {
|
||||
String sql = "db." + command.getTableName() + ".find()";
|
||||
command.setScript(sql);
|
||||
return execute(command);
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package ai.chat2db.plugin.mongodb;
|
||||
|
||||
import ai.chat2db.spi.CommandExecutor;
|
||||
import ai.chat2db.spi.MetaData;
|
||||
import ai.chat2db.spi.jdbc.DefaultMetaService;
|
||||
import ai.chat2db.spi.model.Database;
|
||||
import ai.chat2db.spi.sql.SQLExecutor;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.sql.Connection;
|
||||
@ -17,4 +17,9 @@ public class MongodbMetaData extends DefaultMetaService implements MetaData {
|
||||
public List<Database> databases(Connection connection) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandExecutor getCommandExecutor() {
|
||||
return new MongodbCommandExecutor();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user