Bug 219661

Summary: databases/mysql-server: mysqli_store_result fails on even toy datasets
Product: Ports & Packages Reporter: MMacD <scratch65535>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Open ---    
Severity: Affects Many People CC: brnrd, w.schwarzenfeld
Priority: ---    
Version: Latest   
Hardware: amd64   
OS: Any   

Description MMacD 2017-05-30 17:33:59 UTC
10.3, 2017Q2  

(I'm actually using MariaDB 10.1.22, not MySQL)

I need to use mysqli_data_seek, and so have to use mysqli_store_result, which didn't exist before the change to mysqli and so I don't know anything about it.

Store_result fails in this toy program: (the table keys_used is just strings from the OSM database, 1 string per record, no string over 48 chars)

    $q = 'SELECT * from keys_used limit 10' ;
    echo 'Getting 10 records from keys_used'.cBR ;
    if ( mysqli_query($link,$q) )            // the query does work
        $dset = mysqli_store_result($link) ; // but the store_result does not. 
    if ( $dset) echo mysqli_num_rows($dset).' stored'.cBR ;
    else echo 'Store failed'.cBR ;
    die() ;

As far as I can tell from the Very Meager documentation available, it should work.  But it doesn't, even with so small a result set.  I'll be quite happy if I've simply misunderstood something.
Comment 1 MMacD 2017-05-30 17:49:59 UTC
I forgot to mention that the call doesn't return an error message, and mysqli_field_count() returns non-zero, both of which should be signs of success, but dset is nevertheless a zero.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2017-05-30 21:10:41 UTC
To exactly which port does this PR apply?
Comment 3 MMacD 2017-05-30 21:31:59 UTC
(In reply to Mark Linimon from comment #2)
I thought it was probably mysql rather than php, but it turned out to be misleading docs, not a  bug in the code, so I'm going to delete it and complain about the docs instead.
Comment 4 MMacD 2017-05-31 20:27:02 UTC
I shouldn't have closed this, because there *is* a problem. Either the software is broken or the docs are, since mysqli_store_result doesn't even work on a toy dataset.  

My interest was only because, being confused by the poorly-written docs, I thought that a successful store_result call was now required in order to use data_seek.  But it's not, and so I lost interest and closed this bug report.  But there really is some kind of bug, so I should have left it open even though it doesn't seem to affect my project.

Unfortunately, I've no clue about where the bug is located because the mysqli API is not well-reflected in SQL.  There's no equivalent of store_result in the SQL that I can see, so I couldn't test to narrow it down.  So it could be in MySQL and thus MariaDB, or the result of some change to MariaDB that's not in MySQL, or in the mysqli API, or only the PHP port of the API, or even just in the documentation.  Sorry for not being able to be more clear.
Comment 5 Mahdi Mokhtari freebsd_committer freebsd_triage 2018-03-11 08:35:26 UTC
Adding brnrd@ to CC (since it was produced on MariaDB) in hope he can help to produce it in MySQL `:)
Comment 6 Rene Ladan freebsd_committer 2020-12-07 19:59:30 UTC
Assignee reset.