Esempio n. 1
0
func writeValuesTofile(protocolData *protocol.MetaRequest, stmt *sql.Stmt) {
	fmt.Println("adding one record...")
	if reqType := protocolData.GetType(); reqType == protocol.MetaRequest_REGISTER {
		userInfo := protocolData.GetRegisterInfo()

		UserName := userInfo.GetUsername()
		PassWord := userInfo.GetPassword()
		Email := userInfo.GetEmail()

		fmt.Println(UserName, PassWord)

		if result, err := stmt.Exec(UserName, PassWord, Email); err == nil {
			fmt.Println("one record added to db", result)
		} else {
			fmt.Println("one record failed to add to db..")
		}
	}
}