블로그는 나의 힘!
[ Game ]/시뮬레이션2025. 9. 27. 03:41

최해산

홍길동


삼국지11 그외 신규장수 2

Posted by Mister_Q
[ Programing ]/Database2025. 8. 13. 11:19

C++ 환경에서 MySQL ODBC 8.0 (64bit) 설치 시 나타난 이슈 정리.


- ODBC 드라이버는 내부적으로 문자열 escape 처리, charset 인코딩, prepared query 등을 수행.
  MySQL 서버 측에서 경고 또는 정보 메시지를 반환하면 암묵적인 결과 집합이 생김.
  닫지 않으면 커서가 남아 트랜잭션에서 충돌

- 문자열 처리에 문제가 있음. 
  단일 쿼리 처리는 이슈 없으나 복수의 쿼리는 이슈. ( INSERT ...; INSERT ...; )

해결1- 단일을 반복으로 실행.
해결2- 복수 쿼리에 트랜잭션으로 묶음을 삭제. (단, 오류시 전체 롤백이 안되는 이슈 있음)
해결3- 다른 버전 설치. 8.0 고유 문제.


 

Posted by Mister_Q
[ Programing ]/Lua Scirpt2025. 7. 7. 17:10

g_CurrentTime = os.time()

local TIME_MIN = 60
local TIME_HOUR = TIME_MIN * 60
local TIME_DAY = TIME_HOUR * 24
local TIME_WEEK = TIME_DAY * 7

--!< 시간 확인
function GetTargetDay(tmTime, standHour, standMinute)
      return os.date("%Y%m%d", tmTime - (standHour * TIME_HOUR) - (standMinute * TIME_MIN))
end

--!< 경과 일
function BetweenDay(baseTime, targetTime)
      local outputDay = math.floor((targetTime - baseTime) / TIME_DAY)
      return outputDay
end

--!< 날짜 변환 (yyyymmdd)
function ConvertTime(targetDate)
      local targetValue = targetDate

      local targetYear = math.floor(targetValue / (100 * 100))

      targetValue = math.floor(targetValue % (100 * 100))
      local targetMonth = math.floor(targetValue / 100)
      targetValue = math.floor(targetValue % 100)
      local targetDay = targetValue

      local targetTime = os.time{
            year = targetYear,
            month = targetMonth,
            day = targetDay,
            hour = 0,
            min = 0,
            sec = 0,
      }

      return tonumber(targetTime)
end

--!< 매주 초기화 시간 계산 -다음 종료 시간
function GetNextWeekTime(nTargetDay)
      local targetTime = ConvertTime(nTargetDay)     --!< YYYYMMDD -> time (EX : 20250626 -> 1750863600)
      local currentWeek = tonumber(os.date("%w", targetTime))       --!< 0:일, ~ 6:토
      local everyWeek = 2       --!< 매주 초기화 대상 요일
      local MaxWeek = 6 + 1

      --!< 다음 초기화 날짜 계산
      local addDay = 0
      if (currentWeek > everyWeek) then       --!< 현재가 요일보다 초과 시
            addDay = MaxWeek - currentWeek + everyWeek
      elseif (currentWeek < everyWeek) then       --!< 현재가 요일보다 미만 시
            addDay = everyWeek - currentWeek
      else
            addDay = MaxWeek       --!< 동일하면 일주일 가산 +7
      end

     return targetTime + (addDay * TIME_DAY)
end


--!< Main ...
--!< YYYYMMDD (EX : 20250626)

local strTargetDay = GetTargetDay(g_CurrTime, 6, 0)
local nTargetDay = tonumber(strTargetDay)

--!< 매주 초기화 시간 계산
local nextTime = GetNextTime(nTargetDay)
local nextDate = tonumber(os.date("%Y%m%d", nextTime))

--!< 경과 일일 계산 (현재일 - 시작일)
local nStartTime = ConvertTime(20250530)
local nPassDay = BetweenDay(nStartTime, ConvertTime(nTargetDay))



 

'[ Programing ] > Lua Scirpt' 카테고리의 다른 글

[Lua] os date / os time  (0) 2025.06.26
[Lua] 문자 합치기.  (0) 2024.07.10
[LUA] Bit Flag  (0) 2023.05.02
[Lua] Bit Flag  (0) 2023.02.28
[Lua] os Time  (0) 2023.02.28
Posted by Mister_Q