Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > Database Integration
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

Database Integration How to use MySql, PostgreSQL, MS SQL, Oracle, and most other databases with PHP.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23rd September 2008, 15:12
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default Using Query And Paginator

Im trying to use a dbpaginator to iterate thru records in a ibx database, but I also want to allow a entry box for direct record lookup using query. My data aware entry fields update and work fine with paginator using a datasource component. But how do I update my fields when i use a query which is tied directly to a tablename and not a datasource. Im probably being a newb here... but only way I see to get my datafields to update is by reasigning each datafield->datasource to query... is there a better easier way? Maybe using a filter to find specific record on dbpaginator to act as a query? or can i tie query to datasource somehow?

Thanks...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 23rd September 2008, 16:25
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

yes


Easiest way I can think of would be to have the query replace the table in the first place. Then when you push the find it button (or whatever) just change your query to reflect either that # as a starting point or limit it to just that record.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 23rd September 2008, 20:19
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default Query all the time?

So are you saying just use query all the time? I have tried that and assigned individual buttons for each iteration, like (next, prev, last) and cant seem to get it to work.

something like this, doesnt complain and will fetch a record but not the right one. It still gets the first one.
$this->FetchQuery->SQL = ('SELECT * FROM JOBS');
$this->FetchQuery->open();
$this->FetchQuery->last();

Im flustered and dont understand why they present such methods in the doco, and its non-functioning... aaarg.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 23rd September 2008, 21:06
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

You have to give it more direction to trim it down. Something like:
Select * from jobs where jobid >= 1543

As for next/prev buttons you might have to track your place in the table yourself to know where to move what is visible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 23rd September 2008, 21:47
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default Maybe I'm overcomplicating it

I think I'm making this harder than it should be, just simply want a recordset iterator with specific record lookup capabiltiy. Shouldnt be to difficult... ahem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 24th September 2008, 00:45
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

It isn't.

There are probably 50 ways to do it.

Have you tried setting a filter on the table to equal the record you want to find?


You could probably set the filter, refresh, clear the filter and head back to the browser.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 24th September 2008, 15:39
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default Maybe I'm overcomplicating it

I was looking at that yes, was also looking at ibase_fetch_row to allow iteration through table and to also get users query after using prepare / execute. Is one way better than other as far as overhead, ie result set storage or does it matter all that much?
thanks again!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 24th September 2008, 16:23
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,271
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

I don't think it matters. Just use whatever you find easiest.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 25th September 2008, 12:26
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default

Well I found a way to do it, it implements dbpaginator actions to search the dataset. I feel kinda guilty not using an Actual "QUERY" to do the search, but it works.. and oddly it seems faster to manually look thru dataset..

// search dataset for matching JOB ID, usng Paginator actions to move thru records.
// this makes it sequentially correct to user, after a successfull record search,
// user can then navigate thru dataset from that point...

function FetchButtonClick($sender, $params)
{
$recfound = null;

//start at first record...
$this->DBPaginator1->linkClick('first');

do {
// fetchId is editbox entry user entered...
if ($this->FetchId->Text == $this->FetchQuery->Fields["I_JOBID"])
{$recfound = 1; break;}

// no match at that record.. goto next rec
$this->DBPaginator1->linkClick('next');

} while (!$this->FetchQuery->EOF);

// show warning label if no record / data match.......

if( $recfound != 1 )
{$this->DBPaginator1->linkClick('first');$this->Noidlabel->Visible = true; return false;}

// echo $this->FetchId->Text;
// echo $this->FetchQuery->Fields["I_JOBID"];

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 25th September 2008, 13:46
Jaydog's Avatar
D4PHP User
 
Join Date: Jun 2008
Location: Florida
Posts: 35
Jaydog is on a distinguished road
Default

Its simplistic, but this was all I was trying to do... user didnt want to use a grid list.

http://forums.delphi-php.net/attachm...1&d=1222346724
Attached Images
File Type: jpg dbpage.jpg (55.6 KB, 34 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB 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 +1. The time now is 08:10.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use