Quantcast
Channel: Active questions tagged vote-to-reopen - Meta Stack Overflow
Viewing all articles
Browse latest Browse all 68

I would like this question to be reopened

$
0
0

I asked a question on using placeholders in MySQL 'cooperative' locking. The question is found here Using placeholders in MySQL 'COOPERATIVE' LOCK queries

Then it got closed. I was directed to a possible duplicate here How to include a PHP variable inside a MySQL statement. I honestly do not think there is sufficient reason to believe that these two questions are essentially the same.

  1. Even though the earlier question has a little similarity to my own, the similarity is not so much as to label it a duplicate. There is a world of difference, as it seems to me. I already looked for a similar question before I asked mine but did not get.
  2. A user gave an answer before the question was closed. I thought the answer was okay and upvoted it. Another user said the answer was "essentially wrong" and therefore was undeserving of an upvote. When I asked for clarification, none was provided. Rather, the question was closed by the same user who insinuated that the answer was "essentially wrong".
  3. In MySQL advisory lock, even though "SELECT" is used, there is no mention of a particular table, just a string. So, it seems unclear to me how that question should be termed a duplicate of another that is explicitly INSERTing rows into a table.
  4. What I really wanted to know in my question was whether advisory lock could use prepared statement in a situation when another the named string is made up of literal string and another input appended to it.
  5. I did not find a single question that mentioned what I wanted to do. I think the question should be allowed to stay for others to learn.
  6. Much as I have struggled to not mention this, I believe the user who closed my question did so, not really because it was a duplicate but because the fellow has the power to single-handedly close the question; And he did so after the exchange of comments, not before. The timeline is there for everyone to see.

Edit:In the question How to include a PHP variable inside a MySQL statement, We have

$query = "INSERT INTO contents (type, reporter, description)          VALUES(?, ?, 'whatever')";$stmt = $pdo->prepare($query);$stmt->execute([$type, $reporter]);

I already understand that.

In my question, we have

//code"SELECT GET_LOCK( 'unique_string', -1 ) AS acquired"// codereturn ( $row['acquired'] == 1);

Now knowing that the first param in GET_LOCK() is a string, I originally thought "SELECT GET_LOCK( 'unique_string'. $year, -1 ) AS acquired" was the way to go, keeping in place the string. So, I wanted to know how the placeholder would fit in.

In fact, while I contemplated another option, namely to do something like $string = unique_string . $year, then do "SELECT GET_LOCK( :string, -1 ) AS acquired", the user who answered the question pointed me in the right direction with unnamed placeholder by using "SELECT GET_LOCK( '?', -1 ) AS acquired" followed by $stmt->execute( array( $string ) );

The thing to keep in mind is that GET_LOCK() requires parameter 1 to be a string with quotes. I thought that would always be the case.


Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>