register_post_status – show_in_admin_all_list & show_in_admin_status_list does not affect query

TL;DR: It’s not a bug (as we generally understand it), rather it’s a feature that was never fully implemented in WordPress. Status of register_post_status() register_post_status() function was never fully implemented in WordPress. If you check WordPress Codex entry for register_post_status() function, you’ll see it’s clearly mentioned in a notice: NOTICE: This function does NOT add … Read more

Sorting search results by taxonomy terms

Unfortunately, although WP_Query supports the ‘tax_query’ arg, it does not support ordering based on post terms. So you will need to modify the query SQL, as you are doing now. However, you are constructing the ORDER BY clause incorrectly, and that is why it is ordering by post_date. What you need to do is use … Read more

Use wpdb->prepare for `order by` column name

You can’t use prepare for column names, and you can’t really use it for the sort order either. prepare will always quote the string. You will need to swap in the values yourself. Rather than try to “sanitize” the data, I’d use a white-list approach. $orderby = array( ‘date’ => ‘post_date’, // etc ); $sortorder … Read more

SQL query to extract only the “current” wp_posts?

Rather than constructing query from scratch, it is easier to see what exactly is WordPress querying when API function is used: get_posts(array( ‘numberposts’ => -1, )); var_dump( $wpdb->last_query ); Gives following SQL: SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type=”post” AND (wp_posts.post_status=”publish”) ORDER BY wp_posts.post_date DESC

“This SqlTransaction has completed; it is no longer usable.”… configuration error?

I believe this error message is due to a “zombie transaction”. Look for possible areas where the transacton is being committed twice (or rolled back twice, or rolled back and committed, etc.). Does the .Net code commit the transaction after the SP has already committed it? Does the .Net code roll it back on encountering … Read more

ora-06553 pls-306 wrong number or types of arguments in call to ‘ogc_x’

you’ve used double quotes on “X”. this should be ‘X’. the X object is an function in the MDSYS schema, “ogc_x”, so when you say est.tipo_estatus = “X” instead of the correct est.tipo_estatus = ‘X’ it gets translated (as “” is as an identifier so “X” is the same as just typing X) to est.tipo_estatus = mdsys.ogc_x and of course fails.

What is a postgres superuser

https://www.postgresql.org/docs/current/static/sql-createrole.html These clauses determine whether the new role is a “superuser”, who can override all access restrictions within the database. yes – all privileges in all databases on the specified cluster

What’s the best way to dedupe a table?

SELECT DISTINCT <insert all columns but the PK here> FROM foo. Create a temp table using that query (the syntax varies by RDBMS but there’s typically a SELECT … INTO or CREATE TABLE AS pattern available), then blow away the old table and pump the data from the temp table back into it.

SQL: How to properly check if a record exists

It’s better to use either of the following: The first alternative should give you no result or one result, the second count should be zero or one. How old is the documentation you’re using? Although you’ve read good advice, most query optimizers in recent RDBMS’s optimize SELECT COUNT(*) anyway, so while there is a difference … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)