Re: ODBC, PHP and a lack of understanding.

From: evilbreadbin (phil_at_openaccess.tv)
Date: 07/27/04


Date: 27 Jul 2004 03:02:00 -0700

phil@openaccess.tv (evilbreadbin) wrote in message news:<a9ec01dd.0407260328.1ab97764@posting.google.com>...
> Greetings,
>
> My problem consists of two parts, the first of which I imagine is only
> a matter of syntax whilst the second might very well be impossible.
>
> I'm not sure if it is of consequence but PHP is running on a Win2000
> machine and the ODBC connection in question links to an MS-Access
> database.
>
> 1/ I am trying to get my head around odbc_columns(). When using the
> function in its simple case -- just providing a ODBC link -- all is
> fine and it returns a dataset of all the columns in all the tables
> fine. The problem is that I cannot ask it to list _all_ the columns
> each time and I would like to be able to inspect just one table's
> columns. (A major reason for this is that the target database
> contains hundreds of tables and so odbc_columns() takes a long time to
> complete.)
>
> Trouble is I don't posses enough knowledge of DB systems to understand
> what is meant by the qualifier and schema parameters, anyone had any
> success in this area?
>
> 2/ I grant that this doesn't seem to have a solution but I thought
> I'd ask just in case... basically I'm looking for an equivalent of
> mysql_field_table() but for ODBC. Either that or some way of
> determining the source table of a given field from a resultset or even
> the original SQL statement.
>
> Any help would be greatly appreciated.
>
> --Phil

For anybody having similar problems I have now managed to get the
first part of this working. Here is a working example:

<?php
  $conn_ODBC = odbc_connect("peopledb", "Admin", "") or die;
  $result = odbc_columns($conn_ODBC, "peopledb", "", "people");
  odbc_result_all($result);
?>

Where the second param of odbc_columns() is the DNS ODBC link, the
third a zero length string and the forth the table name.

Still don't have a solution to the second part, I'm thinking of doing
a simplistic SQL parser to pull the information directly from the SQL
Statement -- clearly not a preferred solution but it is the only one I
see. Therefore I'd be grateful for any other advice on the matter.

--Phil



Relevant Pages

  • Re: Interesting article: In the Beginning: An RDBMS history
    ... For that matter, I don't know what the sql standard would mean by "table". ... Without those differences, I imagine an sql table still couldn't stand for any relation we choose because at least when I was using it ten or more years ago a row-column intersection contained only a single value, ie. some relations can't be expressed as one table. ... For example pi21(supply{project, supplier}) appear to be ...
    (comp.databases.theory)
  • Connection.Errors only contains ONE error
    ... No matter how many low-severity errors I put ... VB Err object (yes, I'm aware of the MSDN articles about ... but I still only get the first error. ... I've run my SQL raw ...
    (microsoft.public.data.ado)
  • Connection.Errors only contains ONE error
    ... No matter how many low-severity errors I put ... VB Err object (yes, I'm aware of the MSDN articles about ... but I still only get the first error. ... I've run my SQL raw ...
    (microsoft.public.vb.database.ado)
  • Re: ASP.NET IIS6 Impersonation - Explanation needed for this situa
    ... the impersonation setting does matter and the reason why is because ... the User isn't logging in with the SQL account which would be passed to SQL, ... Impersonation would not be a factor if the User's ...
    (microsoft.public.dotnet.security)