The following warnings occurred: | ||||||||||||||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
DB.php patch - error handling, flexible WHERE clauses, fix bug - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29) +--- Thread: DB.php patch - error handling, flexible WHERE clauses, fix bug (/showthread.php?tid=233) Pages:
1
2
|
DB.php patch - error handling, flexible WHERE clauses, fix bug - faguss - 06-06-2017 Found incompatibility - passing empty array will make ERROR: w=Array ( ) appear on the screen. Fix: Code: if ($wcount==0) return ""; That's line 112 in my paste. DB.php patch - error handling, flexible WHERE clauses, fix bug - faguss - 06-14-2017 I wanted to use LIKE for comparing floats so I added it to the Code: $valid_ops Lines 102-110, 131-155, 293-299 in my paste. Examples: https://pastebin.com/mWvUsNAh DB.php patch - error handling, flexible WHERE clauses, fix bug - picassoo - 06-18-2017 nice faguss, can you make all the function for all ??? like UPDATE ADD DELETE and other ? DB.php patch - error handling, flexible WHERE clauses, fix bug - faguss - 06-18-2017 I'm not sure what you mean because UserSpice already has functions Code: update() Code: insert() Code: delete() It's not called ADD but INSERT and it doesn't have a WHERE clause. See SQL tutorial. === With this patch you can already use nested triads for Code: delete() Code: $db->delete("Products", ["or", ["Stock","<=",0], ["Legal","=",false]]); I've noticed that the query is still being run even if the argument was incorrect. This is also the case with the original DB.php. For example: Code: delete("Products",NULL) Passing empty array is now prohibited (line 195). === Statement UPDATE uses WHERE clause so I might as well implement triads. Lines 239-253 in my paste. Now you can do this: Code: $db->update("Suppliers", ["Country","=","Greece"], ["Currency"=>"GRD"]); DB.php patch - error handling, flexible WHERE clauses, fix bug - mudmin - 08-14-2017 @faguss Do you have the latest version of your db class? I'll shoot you an email. |