Re: [PHP] PROGRESS SQL_CUR_USE_ODBC

2005-10-07 Thread Richard Lynch
On Tue, October 4, 2005 11:47 am, cybermalandro cybermalandro wrote:
 I am connecting to a PROGRESS DB through the MERANT ODBC driver, When
 I have
 the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing
 but
 if I have the 4th parameter as lower case it returns my query results
 but
 with a PHP error complainning
 *Notice*: Use of undefined constant sql_cur_use_odbc - assumed
 'sql_cur_use_odbc'

 Wtf? I don't get it, most of the documentation from people connecting
 to
 PROGRESS do have the 4th parameter uppercase can someone help me out ?

Well, you could put apostrophes or quotes around it and get rid of the
PHP Notice, and that would be syntactically correct for PHP.

What it would mean to MERANT ODBC, though, I dunno...

Though what you currently have, with lower-case, will be THE SAME to
MERANT ODBC as adding the quotes, because that's what PHP is doing for
you, and that's what the Notice is all about.

Translation:
PHP: You were supposed to put quotes on that sql_cur_use_odbc thing,
but you didn't, so I did it for you.


But this is probably NOT going to make things actually work as you
expect.

What happens next is that PHP has to convert your string
sql_cur_use_odbc into a number.  And that number will be 0.

So then MERANT ODBC gets the integer 0 as that 4th argument.

Which is probably NOT the number you want to send it to actually turn
on this SQL CUR USE ODBC thingie, whatever that is.

SQL_CUR_USE_ODBC is almost for sure an integer.

You could see what it is by doing:

echo SQL_CUR_USE_ODBC has the value: , SQL_CUR_USE_ODBC, hr /\n;

in your code.

If it's not 0, then adding quotes to suppress the PHP Notice is only
masking a symptom, not fixing the real problem.

I guess we'd need to know what your queries are, and if I had some
clue what SQL_CUR_USE_ODBC was supposed to be doing, it would help... 
Hopefully somebody else can chime in on this part.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PROGRESS SQL_CUR_USE_ODBC

2005-10-04 Thread cybermalandro cybermalandro
I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I have
the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing but
if I have the 4th parameter as lower case it returns my query results but
with a PHP error complainning
*Notice*: Use of undefined constant sql_cur_use_odbc - assumed
'sql_cur_use_odbc'

Wtf? I don't get it, most of the documentation from people connecting to
PROGRESS do have the 4th parameter uppercase can someone help me out ?

Thanks!


Re: [PHP] PROGRESS SQL_CUR_USE_ODBC

2005-10-04 Thread Kristen G. Thorson

cybermalandro cybermalandro wrote:


I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I have
the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing but
if I have the 4th parameter as lower case it returns my query results but
with a PHP error complainning
*Notice*: Use of undefined constant sql_cur_use_odbc - assumed
'sql_cur_use_odbc'

Wtf? I don't get it, most of the documentation from people connecting to
PROGRESS do have the 4th parameter uppercase can someone help me out ?

Thanks!

 




Using PEAR:DB with this dsn I can connect and get results:

$dsn = 
odbc(Progress_SQL92_Driver)://$username:[EMAIL PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC;




kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PROGRESS SQL_CUR_USE_ODBC

2005-10-04 Thread Kristen G. Thorson

cybermalandro cybermalandro wrote:

Thanks for your prompt response! Are you using the pear DB class 
requiring odbc? I am not very familiar with this class and pear. I was 
trying to do it the old way.  Perhaps you can give me some more 
examples? I really appreciate your help.


Thanks

On 10/4/05, *Kristen G. Thorson* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


cybermalandro cybermalandro wrote:

I am connecting to a PROGRESS DB through the MERANT ODBC driver,
When I have
the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return
nothing but
if I have the 4th parameter as lower case it returns my query
results but
with a PHP error complainning
*Notice*: Use of undefined constant sql_cur_use_odbc - assumed
'sql_cur_use_odbc'

Wtf? I don't get it, most of the documentation from people
connecting to
PROGRESS do have the 4th parameter uppercase can someone help me
out ?

Thanks!





Using PEAR:DB with this dsn I can connect and get results:

$dsn =
odbc(Progress_SQL92_Driver)://$username:[EMAIL 
PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC;




kgt





I think I was using iODBC and the PEAR DB class.  I actually did this a 
long time ago.  I have this script sitting on my hard drive and I know I 
had a working solution at one point in time, so I'm assuming this was 
it.  I don't have the test environment set up anymore, so I can't really 
check.  Following is the script I have to print the contents of the 
Customer table in the Sports database.  It looks like I took a PEAR:DB 
example and just modified it to work with Progress, so I'm certain 
there's much room for improvement.




require_once '/usr/share/pear/DB.php';


// Get the connection variables:
require_once 'dbinfo.php';

$dsn = 
odbc(Progress_SQL92_Driver)://$username:[EMAIL PROTECTED]:$port/$database?cursor=SQL_CUR_USE_ODBC; 




// Creates a database connection object in $db or, a database error 
object if it went wrong.
// The boolean specifies this is a persistent connection like 
mysql_pconnect(), it

// defaults to FALSE.
$db = DB::connect($dsn, TRUE);

// Check whether the object is a connection or
if (DB::isError($db)) {  
  
  
   /*

* This is not what you would really want to do in
* your program.  It merely demonstrates what kinds
* of data you can get back from error objects.
*/
   echo 'Standard Message: ' . $db-getMessage() . br\n;
   echo 'Standard Code: ' . $db-getCode() . br\n;
   echo 'DBMS/User Message: ' . $db-getUserInfo() . br\n;
   echo 'DBMS/Debug Message: ' . $db-getDebugInfo() . br\n;
   exit;
  
   // an error.

   //die($db-getMessage()); // Print out a message and exit if it's
   // an error object.
}

// Get a connection as above

$sql = SELECT * from PUB.Customer;   // Build your SQL query
  
$res = $db-query($sql);

if (DB::isError($res)) {// Check the result object in case there
   die($res-getMessage());// was an error, and handle it here.
}

echo table cellpadding=0 cellspacing=0 border=0;
echo trthCust Num/th;
echo thName/th;
echo thAddress/th;
echo thAddress2/th;
echo thCity/th;
echo thState/th;
echo thCountry/th;
echo thPhone/th;
echo thContact/th;
echo thSales-Rep/th;
echo thComments/th;
echo thCredit-Limit/th;
echo thBalance/th;
echo thTerms/th;
echo thDiscount/th;
echo thPostal-Code/th/tr;

while ($row = $res-fetchRow(DB_FETCHMODE_ASSOC)) {
   // Fetch a row from the result resource object $res.
   // DB_FETCHMODE_OBJECT returns a row with column names as keys.
   // Other possibilities are listed here:
   // http://pear.php.net/manual/en/core.db.tut_fetch.php
  
   if (DB::isError($row)) {

   //fetchRow can return an error object like most PEAR::DB methods
   die($row-getMessage());
   } else {
   echo trtd . $row[Cust-Num] . /td\n;
   echo td . $row[Name] . /td\n;
   echo td . $row[Address] . /td\n;
   echo td . $row[Address2] . /td\n;
   echo td . $row[City] . /td\n;
   echo td . $row[State] . /td\n;
   echo td . $row[Country] . /td\n;
   echo td . $row[Phone] . /td\n;
   echo td . $row[Contact] . /td\n;
   echo td . $row[Sales-Rep] . /td\n;
   echo td . $row[Comments] . /td\n;
   echo td . $row[Credit-Limit] . /td\n;
   echo td . $row[Balance] . /td\n;
   echo td . $row[Terms] . /td\n;
   echo td . $row[Discount] . /td\n;
   echo td . $row[Postal-Code] . /td/tr\n;
   }
}

echo /table;
$res-free();
$db-disconnect();  // Close the connection.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PROGRESS SQL_CUR_USE_ODBC

2005-10-04 Thread Programmer
I don't know if this will help you.

I use an openlink ODBC driver to connect to Progress via PHP like so:


$dbconn  =
odbc_connect(MyDB_ODBC,$username,$password,SQL_CUR_USE_ODBC);
$strQry  = SELECT * FROM mytable WHERE mytable.field = .$somevar;

$rsTable = odbc_do($dbconn, $strQry);

while (odbc_fetch_row($rsTable))
{
// do stuff;
}

Jeremy Schreckhise

-Original Message-
From: cybermalandro cybermalandro [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 04, 2005 11:48 AM
To: php-general@lists.php.net
Subject: [PHP] PROGRESS SQL_CUR_USE_ODBC

I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I
have
the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing
but
if I have the 4th parameter as lower case it returns my query results
but
with a PHP error complainning
*Notice*: Use of undefined constant sql_cur_use_odbc - assumed
'sql_cur_use_odbc'

Wtf? I don't get it, most of the documentation from people connecting to
PROGRESS do have the 4th parameter uppercase can someone help me out ?

Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php