Edit report at https://bugs.php.net/bug.php?id=21082&edit=1
ID: 21082
Comment by: xxdantess at gmail dot com
Reported by: jcdavid at libertysurf dot fr
Summary: odbc_primarykeys Access
Status: Bogus
Type: Bug
Package: ODBC related
Operating System: Win XP
PHP Version: 4.2.0
Block user comment: N
Private report: N
New Comment:
I have the same problem
$conexion = odbc_connect($DSN,"","");
$result = odbc_tables($conexion);
while (odbc_fetch_row($result)){
if(odbc_result($result,"TABLE_TYPE")=="TABLE")
{
$table=odbc_result($result,3);
$owner=odbc_result($result,2);
$qualifiers=odbc_result($result,1);
$pk = odbc_primarykeys( $conexion,$qualifiers,$owner,$table);
}
}
Warning: odbc_primarykeys() [function.odbc-primarykeys]: SQL error: Failed to
fetch error message, SQL state HY000 in SQLPrimaryKey
Please fix the problem
Previous Comments:
------------------------------------------------------------------------
[2004-08-27 16:03:43] user at example dot com
still does not work with PHP 5.0.1 and MS Access (both odbc_primarykeys() and
odbc_statistics()). Please reopen
------------------------------------------------------------------------
[2002-12-18 13:55:27] [email protected]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
I believe this was fixed...
------------------------------------------------------------------------
[2002-12-18 13:28:40] jcdavid at libertysurf dot fr
I cant get the primarykeys, php always return "Warning: SQL error: , SQL state
00000 in SQLPrimaryKeys"
<?php
$dsn = "gerhisto";
$usr = "";
$pwd = "";
$db = "gerhisto";
$con = odbc_connect ($dsn,$usr,$pwd) or die ("Echec de connexion sur ODBC :
$dsn");
$res = odbc_tables ($con) or die ("Pas de tables dans $db de ODBC : $dsn");
$i=0;
while (odbc_fetch_row ($res)) {
if (odbc_result ($res, 4)=="TABLE") {
$qualifiers[$i] = odbc_result ($res, 1);
$owners[$i] = odbc_result ($res, 2);
$tables[$i] = odbc_result ($res, 3);
$types[$i] = odbc_result ($res, 4);
$remarks[$i] = odbc_result ($res, 5);
echo "$i, Table : $tables[$i], Qualifier : $qualifiers[$i],
Owner : $owners[$i], Type : $types[$i], Remarks : $remarks[$i]<br>";
$i++;
}
}
echo "<br>$i tables<br><br>";
for ($j=0;$j<$i;$j++) {
echo "Clefs Primaires de ".$tables[$j];
$res = odbc_primarykeys ($con, $qualifiers[$j], $owners[$j], $tables[$j]);
if ($res)
odbc_result_all ($res);
else
// ==> Warning: SQL error: , SQL state 00000 in SQLPrimaryKeys
echo ("Error : ".odbc_error ($con).": ".odbc_errormsg ($con)."<BR>");
}
odbc_close ($con);
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=21082&edit=1