티스토리 뷰
<%
Class MsSQL
'생성자
Private Sub Class_Initialize()
END Sub
'소멸자
Private Sub Class_Terminate()
END Sub
'Command 실행
'return : 영향을 받은 rows 수
' 영향을 받은 rows 수가 없다면 -1
Public Function executeCommandInput(ByVal connectionString, ByVal storedProcedure, ByVal arrParams)
Dim connectionCommand
Set connectionCommand = Server.CreateObject("ADODB.Connection")
connectionCommand.Open connectionString
Dim command
Set command = Server.CreateObject("ADODB.Command")
command.ActiveConnection = connectionCommand
command.CommandText = storedProcedure
command.CommandType = adCmdStoredProc
Set command = collectParams(command, arrParams)
Dim queryResult : queryResult = empty
command.Execute queryResult, , adExecuteNoRecords
executeCommand = queryResult
If Not connectionCommand Is Nothing Then
If connectionCommand.State = adStateOpen Then connectionCommand.Close
Set connectionCommand = Nothing
End If
If Not command Is Nothing Then
If command.State = adStateOpen Then command.Close
Set command.ActiveConnection = Nothing
Set command = Nothing
End If
End Function
'Command 실행
'return : 영향을 받은 rows 수
' 영향을 받은 rows 수가 없다면 -1
'outputParameter : 쿼리문 실행시 output으로 설정한 값(ex : outputParameter.Parameters(3).Value)
Public Function executeCommandInputOutput(ByVal connectionString, ByVal storedProcedure, ByVal arrParams, ByRef outputParameter)
Dim connectionCommand
Set connectionCommand = Server.CreateObject("ADODB.Connection")
connectionCommand.Open connectionString
Dim command
Set command = Server.CreateObject("ADODB.Command")
command.ActiveConnection = connectionCommand
command.CommandText = storedProcedure
command.CommandType = adCmdStoredProc
Set command = collectParams(command, arrParams)
Dim queryResult : queryResult = empty
command.Execute queryResult, , adExecuteNoRecords
set outputParameter = command
executeCommandInputOutput = queryResult
If Not connectionCommand Is Nothing Then
If connectionCommand.State = adStateOpen Then connectionCommand.Close
Set connectionCommand = Nothing
End If
If Not command Is Nothing Then
If command.State = adStateOpen Then command.Close
Set command.ActiveConnection = Nothing
Set command = Nothing
End If
End Function
'RecordSet 실행
'return : Array
Public Function executeRecordSetArray(connectionString, storedProcedure)
Dim connectionRecordSet : connectionRecordSet = empty
Dim recoredSet : recoredSet = empty
Set connectionRecordSet = Server.CreateObject("ADODB.Connection")
connectionRecordSet.Open connectionString
Set recoredSet = Server.CreateObject("ADODB.RecordSet")
recoredSet.Open storedProcedure, connectionRecordSet
if recoredSet.State = adStateOpen then
if not (recoredSet.bof or recoredSet.eof) then
executeRecordSetArray = recoredSet.GetRows(-1)
end if
else
executeRecordSetArray = empty
end if
If Not connectionRecordSet Is Nothing Then
If connectionRecordSet.State = adStateOpen Then connectionRecordSet.Close
Set connectionRecordSet = Nothing
End If
If Not recoredSet Is Nothing Then
If recoredSet.State = adStateOpen Then recoredSet.Close
Set recoredSet = Nothing
End If
'실행 결과 출력 샘플 - 단수
'if (IsArray(recordSetArray)) then
' Response.Write recordSetArray(0, 0)
'end if
'실행 결과 출력 샘플 - 복수
'if (IsArray(recordSetArray)) then
' Dim iCnt : iCnt = 0
' Do While(iCnt <= UBound(recordSetArray,2))
' Response.Write recordSetArray(0, iCnt)
' iCnt = iCnt + 1
' Loop
'end if
End Function
'파라미터 파싱
Private Function collectParams(ByRef Cmd, ByRef arrParams)
Dim f
Dim startPos, endPos
Dim value
If IsArray(arrParams) Then
startPos = LBound(arrParams)
endPos = UBound(arrParams)
For f = startPos To endPos
If IsArray(arrParams(f)) Then
If UBound(arrParams(f)) = 4 Then
If VarType(arrParams(f)(4)) = vbString Then
If arrParams(f)(4) = "" Then
value = Null
Else
value = Replace(Replace(Replace(Replace(Replace(arrParams(f)(4) _
, "'" , "'") _
, """ , """") _
, ">" , ">") _
, "<" , "<") _
, "&" , "&")
End If
Else
value = arrParams(f)(4)
End If
If Not IsNull(value) Then
Select Case arrParams(f)(1)
Case adChar, adVarchar
If Len(value) > arrParams(f)(3) Then value = Left(value, arrParams(f)(3))
Case adInteger
If CDbl(value) > 2147483647 Then value = 0
Case adBigInt
If CDbl(value) > 9223372036854775807 Then value = 0
End Select
End If
Cmd.Parameters.Append Cmd.CreateParameter(arrParams(f)(0), arrParams(f)(1), arrParams(f)(2), arrParams(f)(3), value)
End If
End If
Next
Set collectParams = Cmd
Exit Function
Else
Set collectParams = Cmd
End If
End Function
'클래스 해제
Public Sub CloseClass(instances)
If Not instances Is Nothing Then Set instances = Nothing
End Sub
End Class
%>
- Total
- Today
- Yesterday
- MainActor
- jstl(java standard tag library)
- 스프링 시큐리티(spring security)
- 인텔리제이(intellij)
- java-개발 환경 설정하기
- REST API
- .submit()
- java 키워드 정리
- 표현 언어(expression language)
- 제품 등록
- java.sql
- nl2br
- 스프링 프레임워크(spring framework)
- system.io
- 스프링 프레임워크(spring framewordk)
- docker
- 메이븐(maven)
- 람다식(lambda expression)
- await
- React
- 특정 문자를 기준으로 자르기
- java web-mvc
- 문자 자르기
- 스프링 시큐리티(spring security)-http basic 인증
- In App Purchase
- error-java
- System.Diagnostics
- jsp 오픈 소스
- 진수 변환
- jstl(java standard tag library)-core
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |