Problem with DB
| From: | James 'Chip' Kaufman | Date: | Fri, 05 Dec 2003 19:43:27 +0000 |
| Subject: | Problem with DB | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9317@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I have been using PEAR DB for nine months with my Informix database. All
is well. I had a problem recently that is puzzling me.
After conecting to the db and issuing two queries, I come to this code:
// Get status updates
$sql = "select s.*, u.dmm_user_fname, u.dmm_user_lname ";
$sql .= "from dmm_status s, outer dmm_user_master u ";
$sql .= "where dmm_status_master_id=$recordno";
$sql .= " and dmm_status_user_id=dmm_user_id";
$res = $dbh->query($sql);
if (DB::isError($res)) {
die ($res->getDebugInfo() . " at line " . __line__ );
}
// Get the data. Will be 0+ rows.
$status_note = $status_user = $status_date = array();
while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
$status_note[] = $row['dmm_status_notes'];
$status_user[] = $row['dmm_user_fname'] . ' ' .
$row['dmm_user_lname'];
$status_date[] = $row['dmm_status_date'];
}
When the sql is issued by hand, I get back several records almost
immediately. The system never returns from the fetchRow statement.
Here is the definition of the status table:
create table dmm_status(
dmm_status_id serial primary key,
dmm_status_master_id integer,
dmm_status_user_id integer,
dmm_status_date datetime year to minute,
dmm_status_notes lvarchar(1000)
);
I've never seen this behavior before. Could it have anything to do with
the largish lvarchar field? Perhaps lvarchar is not supported? W/o
lvarchar, the largest field I can define is 500 bytes and that is not
enough to hold the historical data.
- --
James 'Chip' Kaufman
jkaufman@wamnetgov.com
952-346-3532
PGP key: 697D43DE
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE/0N/frlGDUWl9Q94RApbZAKCklEz6o2j5770+MSi6TLYaQj5dqACg6CsX
N6NyGWqx+5cSjfTCNqM9sPs=
=kFNT
-----END PGP SIGNATURE-----