Skip to content

Commit

Permalink
Fix mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Sep 15, 2023
1 parent 8131578 commit 08fc569
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion data/class/SC_Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,13 @@ public function getAll($sql, $arrVal = array(), $fetchmode = MDB2_FETCHMODE_ASSO

$sth = $this->prepare($sql);
if (PEAR::isError($sth) && $this->force_run) {
var_dump($sth);
return;
}

$affected = $this->execute($sth, $arrVal);
if (PEAR::isError($affected) && $this->force_run) {
var_dump($affected);
return;
}

Expand Down Expand Up @@ -1092,7 +1094,7 @@ public function traceError($error, $sql = '', $arrVal = false)
$err .= rtrim($error->getUserInfo()) . "\n";

// PEAR::MDB2 内部のスタックトレースを出力する場合、下記のコメントを外す。
// $err .= GC_Utils_Ex::toStringBacktrace($error->getBackTrace());
$err .= GC_Utils_Ex::toStringBacktrace($error->getBackTrace());
return $err;
}

Expand Down
9 changes: 7 additions & 2 deletions tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function test_住所が一件だけヒットする場合_住所データ
)
);
$this->actual = SC_Utils::sfGetAddress('0600041');
var_dump($this->objQuery->select('*', 'mtb_zip', 'zipcode = ?', array('0600041')));

$this->verify('郵便番号検索結果');
}
Expand Down Expand Up @@ -187,8 +188,12 @@ protected function setUpAddress()

$this->objQuery->delete('mtb_zip');
foreach ($address as $item) {
$this->objQuery->insert('mtb_zip', $item);
$r = $this->objQuery->insert('mtb_zip', $item);
if (PEAR::isError($r)) {
var_dump($r);
}
}

var_dump($this->objQuery->select('*', 'mtb_zip'));
}
}

11 changes: 5 additions & 6 deletions tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function tearDown()
/////////////////////////////////////////
public function testSfGetProductClassId_存在する製品IDのみを指定した場合_カテゴリ0の対応する製品クラスが取得できる()
{

$this->expected = '2001';
$this->actual = SC_Utils::sfGetProductClassId('2001');

Expand All @@ -58,7 +58,7 @@ public function testSfGetProductClassId_存在する製品IDのみを指定し

public function testSfGetProductClassId_存在する製品IDのみを指定してカテゴリ0の製品クラスが存在しなければ_nullが返る()
{

$this->expected = null;
$this->actual = SC_Utils::sfGetProductClassId('1001');

Expand All @@ -67,7 +67,7 @@ public function testSfGetProductClassId_存在する製品IDのみを指定し

public function testSfGetProductClassId_存在する製品IDとカテゴリIDを指定した場合_対応する製品クラスが取得できる()
{

$this->expected = '1002';
$this->actual = SC_Utils::sfGetProductClassId('1001', '2');

Expand All @@ -76,7 +76,7 @@ public function testSfGetProductClassId_存在する製品IDとカテゴリIDを

public function testSfGetProductClassId_存在する製品IDと存在しないカテゴリIDを指定した場合_nullが返る()
{

$this->expected = null;
$this->actual = SC_Utils::sfGetProductClassId('1001', '999');

Expand Down Expand Up @@ -126,8 +126,7 @@ protected function setUpProductsClass()
$this->objQuery->delete('dtb_products_class');
foreach ($products_class as $item)
{
$this->objQuery->insert('dtb_products_class', $item);
$this->objQuery->insert('dtb_products_class', $item);
}
}
}

0 comments on commit 08fc569

Please sign in to comment.