SAK }‘ŠÙ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

ASP VB Script oo4o + SQL ‰ž—p•Ò7 oo4o XV - ƒoƒbƒ`XV

oo4o ‚ÍAOracle RDBMS ‚Å‚ÝŽg—p‰Â”\‚Å‚·B

¡CreateSql ‚ł̃oƒbƒ`XV

  ECreateSql ‚ÅAƒoƒCƒ“ƒh”z—ñ(OraParamArray)‚ðŽg—p‚µ‚ăoƒbƒ`XV‚ª
    ‚Å‚«‚éB‚±‚ê‚Í•Ö—˜‚ÉŽg—p‚Å‚«‚éB

¡Œ»ŽÀ“I‚ȃR[ƒh—á

<%@ Language=VBScript %>
<%
'=======================================================================
'  €”õ
'=======================================================================
  Public Const ORADB_DEFAULT   = &H0
  Public Const ORASQL_DEFAULT     = &H0
  Public Const ORASQL_NO_AUTOBIND = &H1
  Public Const ORASQL_FAILEXEC    = &H2
  Public Const ORAPARM_INPUT    = 1
  Public Const ORAPARM_OUTPUT   = 2
  Public Const ORAPARM_BOTH     = 3
  Public Const ORATYPE_VARCHAR2 = 1
  Public Const ORATYPE_NUMBER   = 2
  Public Const ORATYPE_SINT     = 3
  Public Const ORATYPE_FLOAT    = 4
  Public Const ORATYPE_STRING   = 5
  Public Const ORATYPE_VARCHAR  = 9
  Public Const ORATYPE_DATE     = 12
  Public Const ORATYPE_UINT     = 68
  Public Const ORATYPE_CHAR     = 96
  Public Const ORATYPE_CHARZ    = 97
  Public Const ORATYPE_CURSOR   = 102
  dim dbname
  dim cnuser
  dim OraPArray(3)
  dim BachRowMax

'** ƒGƒ‰[ƒgƒ‰ƒbƒvŠJŽn
  on error resume next

'** ƒT[ƒrƒXAƒ†[ƒUÝ’è
  dbname = ""
  cnuser = "SAK/SAK"
  '// Oracle ƒT[ƒrƒX–¼(•Ê–¼)Aƒ†[ƒUEƒpƒXƒ[ƒhŽw’è

'** oo4o Ú‘±
  if isempty(session("OraSession")) then
    Set session("OraSession") = Server.CreateObject("OracleInProcServer.XOraSession")
    if err <> 0 then
      response.write("<P>ƒf[ƒ^ƒx[ƒX‚ÉÚ‘±o—ˆ‚Ü‚¹‚ñB<BR>" _
        & "CreateObject - Oracle oo4o ƒGƒ‰[</P>")
    end if
  end if
  if isempty(session("OraDatabase")) then
    Set session("OraDatabase") = session("OraSession").OpenDatabase(dbname, cnuser, ORADB_DEFAULT)
    if err <> 0 then
      response.write("<P>ƒf[ƒ^ƒx[ƒX‚ÉÚ‘±o—ˆ‚Ü‚¹‚ñB<BR>" _
        & err & ": " & error & "</P>")
    end if
  end if

'** ƒpƒ‰ƒƒ^’ljÁ
  BachRowMax = 10
  if isempty(session("ParaAdd")) then
    session("OraDatabase").Parameters.AddTable "ƒL[", ORAPARM_INPUT, ORATYPE_CHAR, BachRowMax, 4
    session("OraDatabase").Parameters.AddTable "ƒf[ƒ^1", ORAPARM_INPUT, ORATYPE_NUMBER, BachRowMax
    session("OraDatabase").Parameters.AddTable "ƒf[ƒ^2", ORAPARM_INPUT, ORATYPE_NUMBER, BachRowMax
    session("OraDatabase").Parameters.AddTable "ƒf[ƒ^3", ORAPARM_INPUT, ORATYPE_NUMBER, BachRowMax
    if err <> 0 or session("OraDatabase").LastServerErr <> 0 then
      response.write("<P>ƒpƒ‰ƒƒ^’ljÁ‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<BR>" _
        & err & ": " & error & "<BR>" _
        & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>")
    else
      session("ParaAdd") = true
    end if
  end if

'** ƒpƒ‰ƒƒ^”z—ñ€”õ
  set OraPArray(0) = session("OraDatabase").Parameters("ƒL[")
  set OraPArray(1) = session("OraDatabase").Parameters("ƒf[ƒ^1")
  set OraPArray(2) = session("OraDatabase").Parameters("ƒf[ƒ^2")
  set OraPArray(3) = session("OraDatabase").Parameters("ƒf[ƒ^3")

'** ƒGƒ‰[ƒgƒ‰ƒbƒvI—¹
  on error goto 0

'=======================================================================
'  ˆ—
'=======================================================================

'** RDB ˆ—
  if RdbShori() then
    response.write("<P>-- RDB XV³íI—¹ (ˆ—Œ”= " & session("OraSQLStmt").RecordCount & ") --</P>")
  end if

'=======================================================================
'  RDB ˆ—
'=======================================================================
function RdbShori()

  dim i

'** ƒGƒ‰[ƒZƒbƒg
  RdbShori = FALSE

'** ƒGƒ‰[ƒgƒ‰ƒbƒvŠJŽn
  on error resume next

'** oo4o ƒGƒ‰[ƒŠƒZƒbƒg
  session("OraDatabase").LastServerErrReset

'** ƒeƒXƒgƒf[ƒ^ì¬
  for i = 0 to BachRowMax - 1
    OraPArray(0).Put_Value right("0000" & Int(Rnd(1) * 1000), 4), i
    OraPArray(1).Put_Value Int(Rnd(1) * 1000), i
    OraPArray(2).Put_Value Int(Rnd(1) * 1000), i
    OraPArray(3).Put_Value Int(Rnd(1) * 1000), i
  next

'** ƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“ŠJŽn
  session("OraSession").BeginTrans

'** RDB ˆ—1
  Set session("OraSQLStmt") = session("OraDatabase").CreateSql("insert into sak.ƒeƒXƒgm " _
    & "(ƒL[, ƒf[ƒ^1, ƒf[ƒ^2, ƒf[ƒ^3) values " _
    & "(:ƒL[, :ƒf[ƒ^1, :ƒf[ƒ^2, :ƒf[ƒ^3)", ORASQL_DEFAULT)
  if err <> 0 or session("OraDatabase").LastServerErr <> 0 then
    session("OraSession").Rollback
    response.write("<P>RDB XV1 ‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<BR>" _
      & err & ": " & error & "<BR>" _
      & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>")
    exit function
  end if

'** ƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“I—¹
  session("OraSession").CommitTrans

'** ƒGƒ‰[ƒgƒ‰ƒbƒvI—¹
  on error goto 0

'** ³íƒZƒbƒg
  RdbShori = TRUE

end function
%>

¡à–¾

  EParameters.Add ‚Ì‘ã‚í‚è‚É Parameters.AddTable ‚ðŽg—p‚µ‚ÄŽŸŒ³”‚ðŽw’è
    ‚·‚éB‚±‚±‚Å‚ÍABachRowMax = 10 ‚ðŽg—p‚µ‚Ä‚¢‚éB
    OraPArray ‚ÆŠÖ˜A•t‚¯‚ÄAŽÀۂ̃f[ƒ^‚ðƒeƒXƒg‚È‚Ì‚Å—”‚ŃZƒbƒgB
    CreateSql ‚ðŽÀs‚·‚é‚ÆA10 Œ‚ÌXV‚ªs‚í‚ê‚éB

  EOraPArray ‚©‚çA’l‚ðŽQÆ‚·‚é‚É‚ÍAGet_Value ‚ðŽg—p‚·‚éB
    OraPArray.LastErrorText ‚à‚ ‚éB

¡ASP VB Script oo4o + SQL ‰ž—p•ÒŽ‘—¿
¡ASP VB Script ADO + SQL ‰ž—p•ÒŽ‘—¿
¡ASP VB Script Šî‘bŽÀ’n•ÒŽ‘—¿
¡ASP VB Script Šî‘b•ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡Oracle PL/SQL •ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ



Copyright (C) 1999-2024 Y.SAK