php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21082 odbc_primarykeys Access
Submitted: 2002-12-18 13:28 UTC Modified: 2002-12-18 13:55 UTC
From: jcdavid at libertysurf dot fr Assigned:
Status: Not a bug Package: ODBC related
PHP Version: 4.2.0 OS: Win XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jcdavid at libertysurf dot fr
New email:
PHP Version: OS:

 

 [2002-12-18 13:28 UTC] 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);
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-18 13:55 UTC] kalowsky@php.net
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...
 [2004-08-27 16:03 UTC] 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
 [2011-11-29 09:40 UTC] xxdantess at gmail dot com
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC