php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #29806 passing chained queries through methods doesn't work
Submitted: 2004-08-24 04:00 UTC Modified: 2004-08-24 10:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jamslam at gmail dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: RedHat 9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jamslam at gmail dot com
New email:
PHP Version: OS:

 

 [2004-08-24 04:00 UTC] jamslam at gmail dot com
Description:
------------
Alright, this is a strange bug, but I'll get to the point.

For some odd reason PHP is not letting me pass chained queries in through a method, and from there execute the query successfully. I find that if I use the transactions ('BEGIN;' and 'COMMIT;') no queries will be executed, and if I leave the transactions out, only the first query will be executed.

Now I know this bug exists:

http://bugs.php.net/bug.php?id=28264

And it's virtually identical, except for the fact that I'm passing data through a method first, then executing it (I don't modify the data, as you'll see below).

I have come to the conclusion that this is in fact a bug, as I have ruled out every other possibility.

PHP Info: http://www.webtrickscentral.com/stuff/phpinfo.php

Reproduce code:
---------------
http://www.webtrickscentral.com/stuff/phpBug.phps

Expected result:
----------------
The code should insert two rows of data into table 'cool'.

Actual result:
--------------
It does not do anything- no error messages and it does not insert anything.

* - This is for any type of query, also.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-24 08:45 UTC] derick@php.net
This is not a bug but a very confusing thing. When ever you use the return value to the query() method (like you do with "return") the function will only execute one query in your chained list. In order to fix this you need to use the exec() method (but this one discards the return value).

This definitely needs to be mentions in the documentation though.
 [2004-08-24 10:22 UTC] vrana@php.net
It's already documented:

"SQLite will execute multiple queries separated by semicolons, so you can use it to execute a batch of SQL that you have loaded from a file or have embedded in a script. However, this works only when the result of the function is not used - if it is used, only the first SQL statement would be executed. Function sqlite_exec() will always execute multiple SQL statements.

When executing multiple queries, the return value of this function will be FALSE if the was an error, but undefined otherwise (it might be TRUE for success or it might return a result handle)."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 14:01:28 2024 UTC