diff --git a/chain.go b/chain.go index 27153be..66f99dc 100644 --- a/chain.go +++ b/chain.go @@ -197,6 +197,7 @@ func (this *Query) Clean() *Query { this.save_data = this.save_data[0:0] this.upd_field = this.upd_field[0:0] this.having = "" + this.alias = "" return this } @@ -266,6 +267,11 @@ func (this *Query) GetTableInfo(table string) (map[string]interface{}, error) { }, nil } +// 返回表名 +func (this *Query) GetTableName(table string) string { + return getTableName(this.dbname, table) +} + // 构造子查询 func (this *Query) BuildSelectSql() (map[string]interface{}, error) { if this.dbname == "" && this.table == "" { diff --git a/transaction_chain.go b/transaction_chain.go index 2cc5f2d..11d273a 100644 --- a/transaction_chain.go +++ b/transaction_chain.go @@ -197,9 +197,15 @@ func (this *TxQuery) Clean() *TxQuery { this.save_data = this.save_data[0:0] this.upd_field = this.upd_field[0:0] this.having = "" + this.alias = "" return this } +// 返回表名 +func (this *TxQuery) GetTableName(table string) string { + return getTableName(this.dbname, table) +} + // 构造子查询 func (this *TxQuery) BuildSelectSql() (map[string]interface{}, error) { if this.dbname == "" && this.table == "" {