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 XV - ƒoƒbƒ`XV

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

¡CreateSql ‚ł̃oƒbƒ`XV

  ECreateSql ‚ŁAƒoƒCƒ“ƒh”z—ñ(OraParamArray)‚ðŽg—p‚µ‚ăoƒbƒ`XV‚ª
    ‚Å‚«‚é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ƒXAƒ†[ƒUÝ’è
  dbname = ""
  cnuser = "SAK/SAK"
  '// Oracle ƒT[ƒrƒX–¼(•Ê–¼)Aƒ†[ƒUEƒ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ƒvI—¹
  on error goto 0

'=======================================================================
'  ˆ—
'=======================================================================

'** RDB ˆ—
  if RdbShori() then
    response.write("<P>-- RDB XV³í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 XV1 ‚ÉŽ¸”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ƒvI—¹
  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ƒgB
    CreateSql ‚ðŽÀs‚·‚é‚ƁA10 Œ‚̍XV‚ª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 ServletAJSP •ÒŽ‘—¿
¡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-2017 Y.SAK