v5:userguide:portable_sql
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:userguide:portable_sql [2016/03/13 23:52] – [Inserting Records] mnewnham | v5:userguide:portable_sql [2020/12/30 21:32] (current) – [Prepare/Execute] fix obvious variable case typos peterdd | ||
---|---|---|---|
Line 29: | Line 29: | ||
<code php> | <code php> | ||
- | $connection-> | + | $connection-> |
</ | </ | ||
Line 49: | Line 49: | ||
<code php> | <code php> | ||
- | $rs = $db->Execute(" | + | $rs = $db->execute(" |
- | $numrows = $rs->PO_RecordCount(' | + | $numrows = $rs->po_recordCount(' |
</ | </ | ||
Line 60: | Line 60: | ||
<code php> | <code php> | ||
- | $connection-> | + | $connection-> |
- | $connection-> | + | $connection-> |
# some operation | # some operation | ||
- | if ($ok) $connection-> | + | if ($ok) $connection-> |
- | else $connection-> | + | else $connection-> |
</ | </ | ||
Line 107: | Line 107: | ||
<code php> | <code php> | ||
- | $id = $connection-> | + | $id = $connection-> |
- | $connection-> | + | $connection-> |
| | ||
Line 120: | Line 120: | ||
===== Prepare/ | ===== Prepare/ | ||
<code php> | <code php> | ||
- | $stmt = $db->Prepare(' | + | $stmt = $db->prepare(' |
- | $rs = $db->Execute($stmt, array($id,' | + | $rs = $db->execute($stmt, array($id,' |
/* | /* | ||
Oracle uses named bind placeholders, | Oracle uses named bind placeholders, | ||
*/ | */ | ||
- | $sql = ' | + | $sql = ' |
# generates ' | # generates ' | ||
# or ' | # or ' | ||
- | $stmt = $DB->Prepare($sql); | + | $stmt = $db->prepare($sql); |
- | $stmt = $DB->Execute($stmt, | + | $stmt = $db->execute($stmt, array(' |
</ | </ | ||
Line 174: | Line 174: | ||
AGE N(16) DEFAULT 0 | AGE N(16) DEFAULT 0 | ||
"; | "; | ||
- | $sql1 = $datadict-> | + | $sql1 = $datadict-> |
- | $sql2 = $datadict-> | + | $sql2 = $datadict-> |
</ | </ | ||
Line 186: | Line 186: | ||
<code php> | <code php> | ||
- | $date1 = $connection-> | + | $date1 = $connection-> |
- | $date2 = $connection-> | + | $date2 = $connection-> |
</ | </ | ||
We also provide functions to convert database dates to Unix timestamps: | We also provide functions to convert database dates to Unix timestamps: | ||
<code php> | <code php> | ||
- | $unixts = $recordset-> | + | $unixts = $recordset-> |
</ | </ | ||
Line 198: | Line 198: | ||
<code php> | <code php> | ||
- | $sql = ' | + | $sql = ' |
</ | </ | ||
Line 205: | Line 205: | ||
<code php> | <code php> | ||
# for oracle | # for oracle | ||
- | $conn->Execute(' | + | $conn->execute(' |
- | $conn->UpdateBlob(' | + | $conn->updateBlob(' |
# non-oracle databases | # non-oracle databases | ||
- | $conn->Execute(' | + | $conn->execute(' |
- | $conn->UpdateBlob(' | + | $conn->updateBlob(' |
</ | </ | ||
Line 237: | Line 237: | ||
} | } | ||
# @RETVAL = SP_RUNSOMETHING @myid, | # @RETVAL = SP_RUNSOMETHING @myid, | ||
- | $stmt = $db->PrepareSP($sql); | + | $stmt = $db->prepareSP($sql); |
$db-> | $db-> | ||
- | $db->Parameter($stmt, | + | $db->parameter($stmt, |
# true indicates output parameter | # true indicates output parameter | ||
- | $db->Parameter($stmt, | + | $db->parameter($stmt, |
- | $db->Execute($stmt); | + | $db->execute($stmt); |
</ | </ | ||
Line 253: | Line 253: | ||
<code php> | <code php> | ||
$sqlGetPassword = ' | $sqlGetPassword = ' | ||
- | $sqlSearchKeyword = quot;SELECT * FROM articles WHERE match (title, | + | $sqlSearchKeyword = "SELECT * FROM articles WHERE match (title, |
</ | </ | ||
Line 263: | Line 263: | ||
include_once(" | include_once(" | ||
- | $db = NewADOConnection($database); | + | $db = newADOConnection($database); |
- | $db->PConnect(...) or die(' | + | $db->pConnect(...) or die(' |
# search for a keyword $word | # search for a keyword $word | ||
- | $rs = $db->Execute(sprintf($sqlSearchKeyWord, | + | $rs = $db->execute(sprintf($sqlSearchKeyWord, |
</ | </ |
v5/userguide/portable_sql.1457909548.txt.gz · Last modified: 2017/04/21 11:39 (external edit)