All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bixuebihui.r2dbc.sql.AbstractBaseDao Maven / Gradle / Ivy

package com.bixuebihui.r2dbc.sql;

import com.bixuebihui.DbException;
import io.r2dbc.spi.Row;
import reactor.core.publisher.Mono;

import java.sql.SQLException;

import static com.bixuebihui.db.Dialect.ORACLE;

/**
 * 

AbstractBaseDao class.

* * @author xingwx * @version $Id: $Id */ public class AbstractBaseDao extends BaseDao { /** *

Constructor for AbstractBaseDao.

* * @param db a {@link IDbHelper} object. */ public AbstractBaseDao(IDbHelper db) { this.dbHelper = db; } /** {@inheritDoc} */ @Override public Object mapRow(Row rs) { throw new DbException("not implement!"); } /** *

insertDummy.

* * @return a boolean. * @throws SQLException if any. */ @Override public Mono insertDummy() throws SQLException { throw new SQLException("not implement!"); } /** {@inheritDoc} */ @Override public Long getId(Object info) { return 0L; } /** *

setId.

* * @param info a {@link Object} object. * @param id a {@link Long} object. */ @Override public void setId(Object info, Long id) { //must override if the table has a primary key! } /** {@inheritDoc} */ @Override public String getTableName() { throw new DbException("not provided a tableName"); } /** {@inheritDoc} */ @Override public String getKeyName() { throw new DbException("not provided a keyName"); } @Override protected Mono setIdLong(Object info, Mono id) { return Mono.empty(); } /** *

getDummySql.

* * @return a {@link String} object. */ public Mono getDummySql() { return this.getDbType().map(type -> { if ( type == ORACLE){ return " from dual"; } return ""; }); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy