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•Ò6 oo4o XV - CreateSql

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

¡CreateSql ‚ł̍XV

  ECreateSql ‚Å‚àƒoƒCƒ“ƒh•Ï”‚ðŽg—p‚µ‚½XV‚ª‚Å‚«‚éB

¡session("OraSQLStmt") ƒƒ\ƒbƒh

  session("OraSQLStmt").Refresh        (ƒŠƒNƒGƒŠ)
  Set session("OraSQLStmt") = Nothing  (session("OraSQLStmt") ”jŠü)

¡session("OraSQLStmt") ƒvƒƒpƒeƒB

  session("OraSQLStmt").RecordCount    (ˆ—Œ”)

¡CreateSql ’萔

  Public Const ORASQL_DEFAULT     = &H0
  Public Const ORASQL_NO_AUTOBIND = &H1
  Public Const ORASQL_FAILEXEC    = &H2

¡Œ»ŽÀ“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

'** ƒ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

'** SQL ì¬
  if isobject(session("OraSQLStmt")) = false then
    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 session("OraDatabase").LastServerErr = 1008 then session("OraDatabase").LastServerErrReset
    if err <> 0 or session("OraDatabase").LastServerErr <> 0 then
      response.write("<P>SQL ì¬‚ÉŽ¸”s‚µ‚Ü‚µ‚½B<BR>" _
        & err & ": " & error & "<BR>" _
        & "oo4o: " & session("OraDatabase").LastServerErrText & "</P>")
    end if
  end if

'** ƒpƒ‰ƒƒ^’ljÁ
  session("OraDatabase").LastServerErrReset
  if isempty(session("Pkey")) then
    session("OraDatabase").Parameters.Add "ƒL[", 0, ORAPARM_INPUT
    session("OraDatabase").Parameters("ƒL[").ServerType = ORATYPE_CHAR
    set session("Pkey") = session("OraDatabase").Parameters("ƒL[")
  end if
  if isempty(session("Pdata1")) then
    session("OraDatabase").Parameters.Add "ƒf[ƒ^1", 0, ORAPARM_INPUT
    session("OraDatabase").Parameters("ƒf[ƒ^1").ServerType = ORATYPE_NUMBER
    set session("Pdata1") = session("OraDatabase").Parameters("ƒf[ƒ^1")
  end if
  if isempty(session("Pdata2")) then
    session("OraDatabase").Parameters.Add "ƒf[ƒ^2", 0, ORAPARM_INPUT
    session("OraDatabase").Parameters("ƒf[ƒ^2").ServerType = ORATYPE_NUMBER
    set session("Pdata2") = session("OraDatabase").Parameters("ƒf[ƒ^2")
  end if
  if isempty(session("Pdata3")) then
    session("OraDatabase").Parameters.Add "ƒf[ƒ^3", 0, ORAPARM_INPUT
    session("OraDatabase").Parameters("ƒf[ƒ^3").ServerType = ORATYPE_NUMBER
    set session("Pdata3") = session("OraDatabase").Parameters("ƒf[ƒ^3")
  end if
  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>")
  end if

'** ƒGƒ‰[ƒgƒ‰ƒbƒvI—¹
  on error goto 0

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

'** RDB ˆ—
  if RdbShori() then
    response.write("<P>-- RDB XV³íI—¹ --</P>")
  end if

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

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

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

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

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

'** RDB ˆ—1
  session("Pkey").Value = "a001"
  session("Pdata1").Value = 10
  session("Pdata2").Value = 20
  session("Pdata3").Value = 30
  session("OraSQLStmt").Refresh
  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

'** RDB ˆ—2
  session("Pkey").Value = "b002"
  session("Pdata1").Value = 100
  session("Pdata2").Value = 200
  session("Pdata3").Value = 300
  session("OraSQLStmt").Refresh
  if err <> 0 or session("OraDatabase").LastServerErr <> 0 then
    session("OraSession").Rollback
    response.write("<P>RDB XV2 ‚ÉŽ¸”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
%>

¡à–¾

  Eif session("OraDatabase").LastServerErr = 1008 then session("OraDatabase").LastServerErrReset
    ‚́ASQL ‚ðì‚邾‚¯‚ÉŽg—p‚µ‚½ CreateSQL ‚̃oƒCƒ“ƒhƒGƒ‰[‚ðƒŠƒZƒbƒgB
    æ‚Ƀpƒ‰ƒƒ^‚ð’ljÁ‚·‚é‚ƃGƒ‰[‚É‚È‚ç‚È‚¢‚ªASQL ‚ªŽÀs‚³‚ê‚Ä‚µ‚Ü‚¤B

  ECreateSql ‚Ì session("OraSQLStmt") ‚́Aisempty() ‚ª set Œã‚à true ‚Å
    ‚ ‚éB]‚Á‚āAif isobject(session("OraSQLStmt")) = false then ‚ŁA
    ‰Šú‘n¬‚𔻒肵‚Ä‚¢‚é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