Commit Graph

219 Commits

Author SHA1 Message Date
Sergey Biryukov e65c4190f1 Remove extraneous function parameters in the wpdb class. props rlerdorf. see #24210.
git-svn-id: http://core.svn.wordpress.org/trunk@24121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-29 00:31:56 +00:00
Sergey Biryukov 2bcf4b8802 Only show database errors if WP_DEBUG_DISPLAY is enabled. props cheeserolls, storkontheroof, crazycoders. fixes #22203.
git-svn-id: http://core.svn.wordpress.org/trunk@24027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-18 09:51:02 +00:00
Andrew Nacin e588812a49 Enforce a minimum of two arguments for wpdb::prepare(). The first argument is the query (or fragment thereof), which is required. Additional arguments are values to substitute into placeholders.
This will generate E_WARNINGs for insufficient arguments when prepare() is called with no additional arguments. This should discourage improper uses of prepare() under the guise of safely running a query.

props xknown. fixes #22262.



git-svn-id: http://core.svn.wordpress.org/trunk@22429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-07 19:30:59 +00:00
Andrew Nacin d85554c5f1 When replacing floats in wpdb::prepare(), avoid escaped placeholders (%%f). props SergeyBiryukov. fixes #19861.
git-svn-id: http://core.svn.wordpress.org/trunk@22304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-25 20:52:50 +00:00
Ryan Boren 8ae2c51069 Correct phpdoc for wpdb::bail(). wp_die() is issued when show_errors is true, not false. Props SergeyBiryukov. fixes #22211
git-svn-id: http://core.svn.wordpress.org/trunk@22254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-17 13:11:45 +00:00
Ryan Boren 77518e9c71 Objects no longer need to be explicitly passed by ref to call_user_func*() to be callable. Props wonderboymusic. fixes #21865
git-svn-id: http://core.svn.wordpress.org/trunk@22118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-04 20:00:16 +00:00
Andrew Nacin 1508b46bb4 Call error_log() in wp-db without unnecessary conditionals. fixes #21103.
git-svn-id: http://core.svn.wordpress.org/trunk@21807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-11 01:35:43 +00:00
Andrew Nacin e225c12704 Basic support for the mysql_connect() new_link and client_flags arguments. props Otto42, fixes #19324.
git-svn-id: http://core.svn.wordpress.org/trunk@21609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-24 17:44:21 +00:00
Ryan Boren 7342291b01 Update @since for various wpdb properties. Props SergeyBiryukov. fixes #21582
git-svn-id: http://core.svn.wordpress.org/trunk@21521 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-15 15:32:35 +00:00
Andrew Nacin 2b21b814a1 @since for wpdb's result property. props SergeyBiryukov. see #21533.
git-svn-id: http://core.svn.wordpress.org/trunk@21513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-14 20:34:12 +00:00
Andrew Nacin f965d758fc Add magic set, isset, and unset to wpdb. props pento.
These magic methods allow us to mark properties as protected or private, without breaking compatibility, as they were once accessible. The joys of PHP4.

fixes #18510.



git-svn-id: http://core.svn.wordpress.org/trunk@21512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-14 20:26:04 +00:00
Andrew Nacin c11a4c09e8 Eliminate error suppression for mysql_free_result() and only call it when the result is actually a resource. Depending on the query, mysql_query() can return a boolean rather than a resource, hence the original use of error suppression.
Fixes a warning introduced in [21472] when calling mysql_free_result() was moved to flush().

fixes #20838.



git-svn-id: http://core.svn.wordpress.org/trunk@21511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-14 20:21:10 +00:00
nacin f02bacd9f1 Declare, document, and protect $dbuser, $dbpassword, $dbname, $dbhost and $dbh in wpdb.
These properties, while protected, are still accessible thanks to the magic getter added in [21472].

props pento, nvartolomei, joelhardi. fixes #18510.



git-svn-id: http://core.svn.wordpress.org/trunk@21473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-08 06:28:57 +00:00
nacin 1425762319 Lazy-load column info in wpdb. props pento. fixes #20838.
git-svn-id: http://core.svn.wordpress.org/trunk@21472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-08 06:24:59 +00:00
nacin 4e5fd4de46 Introduce wpdb::get_charset_collate() to return the DEFAULT CHARACTER SET and COLLATE for use in table schemas.
props simonwheatley, pento. fixes #18451.



git-svn-id: http://core.svn.wordpress.org/trunk@21471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-08 06:13:48 +00:00
nacin 73c74cf8f7 Deprecate wpdb::supports_collation() in favor of wpdb::has_cap().
props hakre, pento. fixes #16757.



git-svn-id: http://core.svn.wordpress.org/trunk@21470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-08-08 06:06:57 +00:00
nacin 3e8fe0e2e0 Correctly identify queries where a line break follows a keyword, rather than a space. props GeertDD, fixes #19467.
git-svn-id: http://core.svn.wordpress.org/trunk@21178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-29 15:08:17 +00:00
nacin 9810e75d46 Handle localized floats in $wpdb->prepare(). props kurtpayne. fixes #19861.
git-svn-id: http://core.svn.wordpress.org/trunk@21161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-06-28 19:57:31 +00:00
nacin 9501ff721d Escape special characters when outputting DB failures. see #13839.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-04-16 21:55:47 +00:00
duck_ a280584422 Correct @since and remove invalid code example in wpdb::delete() documentation. Props GaryJ, scribu. See #18948.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-27 12:00:39 +00:00
nacin 0730535015 Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.
git-svn-id: http://svn.automattic.com/wordpress/trunk@20287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-03-24 15:24:31 +00:00
westi cff0e266a4 Refactor WPDB::get_caller() into wp_debug_backtrace_summary() and improve the functionality to provide enhanced context and a standardised default pretty format. Fixes #19589
git-svn-id: http://svn.automattic.com/wordpress/trunk@19773 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-28 11:56:50 +00:00
nacin 81ed9a7563 Introduce wp_load_translations_early(), which can be used before the locale is properly loaded in order to translate early error strings. Internationalize setup-config.php -- translators no longer have a reason to modify this file. fixes #18180.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-26 20:34:27 +00:00
ryan e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
duck_ a95ad847db Stop quotes being incorrectly added to prepare placeholders in wpdb::_insert_replace_helper(). Fixes #19016.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-05 21:29:57 +00:00
nacin 6424c5b733 Ask for a float from microtime() for timer_start(), timer_stop(). Clarify docs. props solarissmoke, fixes #19157.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-20 21:36:53 +00:00
ryan 07ff8b216b Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: http://svn.automattic.com/wordpress/trunk@19593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-13 23:45:31 +00:00
nacin e39245936f Remove reference to get_last_error(), it doesn't exist. props mitchoyoshitaka, fixes #19002.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19288 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-11-15 00:18:41 +00:00
ryan 31e3ff3fb1 Avoid 'Only variables should be passed by reference' warnings. Props SergeyBiryukov. see #18975
git-svn-id: http://svn.automattic.com/wordpress/trunk@19074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-28 15:48:44 +00:00
nacin 6f9612f45c Introduce ->mysql to allow drop-ins to declare themselves as MySQL and therefore allow minimum version checks to still apply. fixes #18176.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-25 05:29:28 +00:00
ryan 67661f7181 Avoid 'Only variables should be passed by reference' warnings. Reverts [18110]. see #18975
git-svn-id: http://svn.automattic.com/wordpress/trunk@18998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-18 20:44:39 +00:00
duck_ 4a6513185a Documentation fixes. See #18560.
- Add missing parameters
 - Add missing @param data types
 - s/format_where/where_format/


git-svn-id: http://svn.automattic.com/wordpress/trunk@18753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-22 12:02:31 +00:00
dd32 4752a8a1aa Add documentation for floats (%f) to wpdb::prepare() and friends. Props dllh. Fixes #18407
git-svn-id: http://svn.automattic.com/wordpress/trunk@18714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-19 05:15:44 +00:00
duck_ 2f51b9be0d Fix typos in documentation (wp-includes/[i-z]). See #18560.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-05 19:08:15 +00:00
dd32 e91e6de814 Clarify %d is an integer in wpdb documentation. See #18407
git-svn-id: http://svn.automattic.com/wordpress/trunk@18573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-19 15:01:35 +00:00
ryan 08b6aa116e Sanitize sort_column and sort_order in get_pages(). Escape search_term in WP_User_Search. Cast blog_id to int in get_blog_prefix(). Props duck_
git-svn-id: http://svn.automattic.com/wordpress/trunk@18350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-27 20:47:04 +00:00
nacin 30729cc791 Take that, PHP 5.0.5. Good riddens. see #14160.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-01 22:03:36 +00:00
ryan fce00c287b Properly handle return value of DDL statements. Props scribu, marcis20. fixes #11372
git-svn-id: http://svn.automattic.com/wordpress/trunk@18063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-27 15:46:56 +00:00
ryan e4157ae4cd Correct phpdoc for replacing/extending thewpdb class. Props johnbillion. fixes #17533
git-svn-id: http://svn.automattic.com/wordpress/trunk@18011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-05-23 23:37:16 +00:00
ryan b60c345536 Remove PHP4 constructors. Props hakre. see #16768
git-svn-id: http://svn.automattic.com/wordpress/trunk@17604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-04-05 17:25:08 +00:00
ryan c1da7bbb0b Don't die inside db_connect() if connection fails. Let dead_db() handle it. fixes #16640 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-23 19:57:35 +00:00
nacin edaea210a1 Remove dead globals. props mitchoyoshitaka. fixes #16571.
git-svn-id: http://svn.automattic.com/wordpress/trunk@17538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-23 18:39:16 +00:00
ryan f679a75b0c Don't die for failed db connects during install. Props westi. fixes #16640 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@17536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-03-23 17:46:40 +00:00
ryan a96f9d899f @since additions and updates. Props demetris. fixes #15867
git-svn-id: http://svn.automattic.com/wordpress/trunk@17079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-20 12:49:18 +00:00
nacin 35b4860563 Don't improperly whitescreen on incorrect DB credentials during setup-config. Show error message with an opportunity to try again. fixes #15682.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-08 07:12:44 +00:00
ryan 3f72e340d6 Update since phpdoc. Props demetris. fixes #15445
git-svn-id: http://svn.automattic.com/wordpress/trunk@16660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-01 19:24:38 +00:00
westi 00b232ea51 Revert [16320] and [16321] for now. Breaks things
git-svn-id: http://svn.automattic.com/wordpress/trunk@16336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-12 22:44:16 +00:00
nacin 2ad9865886 Only mysql_free_result if we have a valid resource, and remove error suppression there. see #15402.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-12 10:40:43 +00:00
nacin 83fbd4e36b Memory usage and execution improvements in wpdb. Store and work with resources directly, rather than full copies of results. Plugins which incorrectly used wpdb->last_result (a private property) will need to shift to wpdb->get_results() with no \$query. Magic getter is introduced for back compat when using PHP5. props joelhardi, fixes #12257.
git-svn-id: http://svn.automattic.com/wordpress/trunk@16320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-11-12 10:15:18 +00:00
nacin 14ccdbec33 Pruning shears.
git-svn-id: http://svn.automattic.com/wordpress/trunk@15904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-10-21 19:55:28 +00:00