Exemplo n.º 1
0
func (c *Connection) RdbmsConnect(drivername string, stringConnection string) error {
	if drivername == "hive" {
		connInfo := strings.Split(stringConnection, ",")
		c.Hive = hive.HiveConfig(connInfo[0], connInfo[1], connInfo[2], connInfo[3], connInfo[4], connInfo[5])
		c.Drivername = drivername
		c.Hive.Conn.Open()
		e := c.Hive.Conn.TestConnection()
		if e != nil {
			return err.Error(packageName, modConnection, "Connect", e.Error())
		}
	} else {
		sqlcon, e := sql.Open(drivername, stringConnection)
		if e != nil {
			return err.Error(packageName, modConnection, "Connect", e.Error())
		}
		c.Sql = *sqlcon
		c.Drivername = drivername
		e = sqlcon.Ping()
		if e != nil {
			return err.Error(packageName, modConnection, "Connect", e.Error())
		}
	}
	if c.Info().Settings.Has("dateformat") {
		c.DateFormat = toolkit.ToString(c.Info().Settings.Get("dateformat", ""))
	}

	return nil
}
Exemplo n.º 2
0
func runHive(process colonycore.DataFlow, action colonycore.FlowAction, arguments string) (res []toolkit.M, e error) {
	action_hive := action.Action.(colonycore.ActionHive)
	hivex = hive.HiveConfig(action.Server.Host, "", "Username", "Password", "Path")

	e = hivex.Populate(action_hive.ScriptPath, &res)

	return res, e
}