How to set system file object extension name in PHP via PDO ODBC? (DBMR3280)

~ 0 min
2020-04-23 05:29

Without loading file

$DB = new PDO('odbc:mydb', 'sysadm', '');

 

$filePath = '/tmp/demo.html';

$id = 1;

 

$sth = $DB->prepare("update demo set f = ? where id = ?");

if ($sth == false) {

  var_dump($DB->errorInfo());

}

 

$result = $DB->exec("SET EXTNAME TO 'html'");

echo "affected $result rows\n";

 

$result = $DB->exec("SET INPUT PARAM 1 AS CFILE");

echo "affected $result rows\n";

 

$sth->bindParam(1, $filePath);

$sth->bindParam(2, $id);

 

$result = $sth->execute();

if ($result == false) {

  var_dump($DB->errorInfo());

}

 

With loading file

$DB = new PDO('odbc:mydb', 'sysadm', '');

 

$filePath = '/tmp/demo.html';

$id = 1;

$DB = new PDO('odbc:mydb', 'sysadm', '');

 

$filePath = '/tmp/demo.html';

$id = 1;

 

$sth = $DB->prepare("update demo set f = ? where id = ?");

if ($sth == false) {

  var_dump($DB->errorInfo());

}

 

$result = $DB->exec("SET EXTNAME TO 'html'");

echo "affected $result rows\n";

 

$result = $DB->exec("SET INPUT PARAM 1 AS CFILE");

echo "affected $result rows\n";

 

$sth->bindParam(1, $filePath);

$sth->bindParam(2, $id);

 

$result = $sth->execute();

if ($result == false) {

  var_dump($DB->errorInfo());

}

 

Average rating 0 (0 Votes)

You cannot comment on this entry

Tags