Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2007, 08:03 PM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default Problem DB->fetchall()

Hi

I am having problems with the above call. Here are the code segments which important plus a clip from the joblog created by the call.

Quote:
30 02/19/07 14:51:21.518832 QSQRUN1 QSYS *STMT QSQRUN1
From user . . . . . . . . . : QTMHHTTP
From module . . . . . . . . : QSQPREP
From procedure . . . . . . : CLEANUP
Statement . . . . . . . . . : 11025
To module . . . . . . . . . : QSQPREP
To procedure . . . . . . . : CLEANUP
Statement . . . . . . . . . : 11025
Message . . . . : Column CHRISH not in specified tables.
Cause . . . . . : CHRISH is not a column of table *N in *N. If the table
*N, CHRISH is not a column of any table or view that can be referenced.
Recovery . . . : Do one of the following and try the request again: --

Here is the code for the call.

Quote:
$params = array(
'host' => 'localhost',
'username' => '',
'password' => '',
'dbname' => 'S1062EBB'
);

try {
$DB = Zend_Db::factory('Db2' , $params);
}
catch (Exception $e) {
die("Failed in factory " . $e->getMessage());
}

$select = $DB->select();
$select->from('SHIELDCRM.USERS', '*');
$select->where('USRNAME = ?', $_POST['username']);
$select->where('PASSWD = ?', $_POST['password']);
$sql = $select->__toString();
echo $sql;

try {
$rowsFound = $DB->fetchAll($select);
}
catch (ErrorException $e){
die("Failed fetchall" . $e->getMessage());
}

if (isset($rowsFound[0]["username"])) {
echo "found row";
$this->_redirect('/');
}

else {
echo "Login information incorrect. Please <a href='/user/login'>try again</a>.";
}
The echo of the statement shows the following..

Quote:
SELECT * FROM SHIELDCRM.USERS WHERE USRNAME = chrish AND PASSWD = password
Warning: db2_prepare() [function.db2-prepare]: Statement Prepare Failed in /www/shieldcrm/library/Zend/Db/Statement/Db2.php on line 258

Warning: db2_stmt_errormsg() expects parameter 1 to be resource, boolean given in /www/shieldcrm/library/Zend/Db/Statement/Db2.php on line 261

Warning: db2_stmt_error() expects parameter 1 to be resource, boolean given in /www/shieldcrm/library/Zend/Db/Statement/Db2.php on line 261
I using a normal login page and the above print shows the POST variables are correctly sent to the SELECT object...

Why is it being converted to show the CHRISH as a column not an entry in the column

here is the DB it should be reading.
Quote:
Display Physical File Member
File . . . . . . : USERS Library . . . . : SHIELDCRM
Member . . . . . : USERS Record . . . . . : 1
Control . . . . . Column . . . . . : 1
Find . . . . . . .
*...+....1....+....2....+....3....+....4....+....5 ....+....6....+....7..
Chris Hird chrish@shield.on.ca
Alison Hird alison@shield.on.ca
.8....+....9....+....0....+....1....+....2....+... .3....+....4....+....5....+.
chrish nopass
alison passwo
These appear to be right and I can update using the DB->insert OK?

Chris..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2007, 10:11 PM
Cristian's Avatar
Administrator
 
Join Date: Feb 2007
Location: Sibiu, Romania
Posts: 101
Default

Mmmmm...

Won't be easy to reply since got no DB2 server for testing...

Added later: only Mysql and Mssql i tested before....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2007, 11:13 PM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

OK So I can help but I dont know where to start looking, I am new to the Framework so I need to know where to start fishing around and see if I cant understand myself and then try to fix. After that I can send a suggested fix to the developers.

Chris...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-20-2007, 01:00 AM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

Here is where I think its going wrong?
Quote:

// split into text and params
$this->_sqlSplit = preg_split(
"/(\?|\:[a-z]+)/",
$sql,
-1,
PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY
);

// map params
$this->_sqlParam = array();
foreach ($this->_sqlSplit as $key => $val) {
if ($val[0] == ':' || $val[0] == '?') {
$this->_sqlParam[] = $val; // key *2 +1 is the parsed position
}
}

// set up for binding
$this->_bindParam = array();
Somehow the Db2 Parms get read in the wrong order? I was wondering if I should just change the order and see what happens?

What do you think?

Chris...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-20-2007, 02:21 AM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

Nope dont think this is the issue! Let me kow what tests you need to do and I will set them up. If you have scripts etc I will happily load them and let you have the output.

Chris...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-24-2007, 02:38 PM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

OK looks like this is not something I can move forward.

Thanks for the help..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-24-2007, 03:02 PM
Cristian's Avatar
Administrator
 
Join Date: Feb 2007
Location: Sibiu, Romania
Posts: 101
Default

Sorry, can't figure the error, no DB2 here too...

Question: did u tried with 0.8.0 ? Maybe was a bug or something...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-24-2007, 03:09 PM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

I will try but I think I will try to add to the bug tracker to see if anyone else can help? I have the tools just dont have the knowledge of the Framework to be able to debug correctly..

If it does get sorted I will post here as well.

Chris..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-24-2007, 03:17 PM
Cristian's Avatar
Administrator
 
Join Date: Feb 2007
Location: Sibiu, Romania
Posts: 101
Default

Please do so...

Were waiting u back here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-27-2007, 09:27 PM
Junior Member
 
Join Date: Feb 2007
Posts: 15
Default

I installed 8.0 and the same problem exists. I dont know why its flipping the Column to content around so if anyone who has intimate knowledge of the Framework can push me to the right section of code where the data is added to the variables or arrays I can start to do some debug of my own. Happy to share what I find of course, I just need to get this resolved so I can move forward on the project.

Chris...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:32 AM.