Example #1
0
func GetMobileClientId(db autorc.Conn, sqlstr string) int {

	println(sqlstr)

	var cliID int

	if stmt, err := db.Prepare(sqlstr); err != nil {

		println(err.Error())

	} else {

		if rows, res, err := stmt.Exec(); err != nil {

			println(err.Error())

		} else {

			for _, row := range rows {

				cliID = row.Int(res.Map("id"))

			}

		}

	}

	println(cliID)

	return cliID

}
Example #2
0
func GetMapAclients(db autorc.Conn, sqlstr string, makeFlag string, golog syslog.Writer) []d.Aclient {

	var aclientsmap []d.Aclient

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {

		if rows, res, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		} else {

			aclientsmap = make([]d.Aclient, len(rows))

			for i, row := range rows {

				aclientsmap[i].Id = row.Int(res.Map("id"))
				aclientsmap[i].Phone = row.Str(res.Map("phone"))
				aclientsmap[i].Opcode = row.Str(res.Map("opcode"))
				aclientsmap[i].Nmake = makeFlag
				aclientsmap[i].Nupdatemake = row.Localtime(res.Map("nupdate_make"))

			}

		}
	}

	return aclientsmap

}
Example #3
0
func CheckAclientSql(db autorc.Conn, sqlstr string) []d.AclientCheck {

	fmt.Println(sqlstr)

	var aclientCheck []d.AclientCheck
	if stmt, err := db.Prepare(sqlstr); err != nil {

		fmt.Println(err.Error())
	} else {

		if rows, res, err := stmt.Exec(); err != nil {
			fmt.Println(err.Error())

		} else {

			aclientCheck = make([]d.AclientCheck, len(rows))

			for i, row := range rows {

				aclientCheck[i].Block = row.Int(res.Map("block"))
				aclientCheck[i].Calls = row.Int(res.Map("calls"))
				aclientCheck[i].Ennu = row.Int(res.Map("ennu"))
				aclientCheck[i].Sulje = row.Int(res.Map("sulje"))

			}

		}

	}
	return aclientCheck
}
Example #4
0
func InsertSmsRecord(db autorc.Conn, sqlstr string, golog syslog.Writer) {

	if stmt, err := db.Prepare(sqlstr); err != nil {

		golog.Err(err.Error())

	} else {
		if _, _, err := stmt.Exec(); err != nil {

			golog.Err(err.Error())

		}

	}

}
Example #5
0
func InsertMobileClient(db autorc.Conn, sqlstr string) {

	if stmt, err := db.Prepare(sqlstr); err != nil {

		println(err.Error())

	} else {

		if _, _, err := stmt.Exec(); err != nil {

			println(err.Error())

		} else {

			println("New Client arrived!!!")

		}

	}

}