SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2004
    Location
    brazil
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Record Set Object

    Piece of code colected here and there and I got this.
    Critics please, I'm reading a lot of things about Data Access Objects, Record Sets... and zilion of other things.. I'm getting more and more confused instead of finding solutions. HELP ME PEOPLE!!! lol

    PHP Code:
    class mysqlRecordSet {
        var 
    $query;

        function 
    mysqlRecordSet($query) { 
            
    $this->query $query
        } 
        
        function 
    getRowCount () {
            return 
    mysql_num_rows($this->query);
        }

        function 
    close() { 
            
    mysql_free_result($this->resultId); 
            
    $this->resultId NULL
        } 
            
        function 
    getRow() {
            if ( 
    $row=mysql_fetch_array($this->query) )
                return 
    $row;
            else
                return 
    false;
        }
        
        function 
    getField($field) {
            if (
    $row=mysql_fetch_array($this->query))             
                return 
    $row[$field];
            else
                return 
    false;
        }
        
        function 
    reset() {
            if (
    mysql_num_rows($this->query) > 0) {
                
    mysql_data_seek($this->query0);
                return 
    true;
            } else {
                return 
    false;
            }
        }
        
        function 
    first() {
            if (
    mysql_num_rows($this->query) > 0) {
                
    mysql_data_seek($this->query0);
                return 
    true;
            } else {
                return 
    false;
            }        
        }
        
        function 
    last() {
            
    $numRows mysql_num_rows($this->resultId);
            if (
    $numRows 0) {
                
    mysql_data_seek($this->query$numRows 1);
                return 
    true;
            } else {
                return 
    false;
            }
        }
        


  2. #2
    SitePoint Guru
    Join Date
    Dec 2003
    Location
    oz
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    LOL ... wots to criticise looks like all other DB Resultset Iterators. Assuming you have your DB Connectiuon object to go with it, you've got your DB Access wrappers all wrapped up

  3. #3
    SitePoint Member
    Join Date
    Jun 2004
    Location
    brazil
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but...is this all for the result set iterator?
    I mean.. I just get confused cause sometimes I read DAO, sometimes, RS, sometimes Data Space... where can I found some text (maybe a good book) witch will explin the diferences between them all?

    Thanks Lazy.

  4. #4
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to look at the WACT RecordSet page, and also look into PoEAA as a book.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  5. #5
    SitePoint Member
    Join Date
    Jun 2004
    Location
    brazil
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    You might want to look at the WACT RecordSet page, and also look into PoEAA as a book.
    Thanks...
    Ill try the book if I find it in some library arround here. Im in Brazil... itll be a little dificult.

  6. #6
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you find that you can't buy M Fowlers book, borrow, beg or steal a copy

    For me it's a bit difficult to follow as I'm not Java literate yet, but ignoring that point, it is a good book.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •