There are several new DataStore functions and features that developers will like:
jrCore_db_get_datastore_item_count($module) - use this in place of jrCore_db_number_rows($module, 'item');
jrCore_db_run_key_function($module, $key, $function) - this runs a "function" on the value based on a "key" - use this to replace instances where you need to SUM(), MIN(), MAX(), etc. in a query. So this:
jrCore_db_run_key_function('jrAudio', 'audio_rating_1_5', 'sum');
would SUM all the values for the 'audio_rating_1_5' keys in the jrAudio DS
jrCore_db_set_display_order($module, $_ids) - used to set initial display_order keys for a module.
jrCore_db_create_default_key($module, $key, $value) - used to create "default" keys in a DS. So let's say you add a new key to an audio item called "audio_bpm" and you want to add that key to ALL existing audio entries with a default of "120":
jrCore_db_create_default_key('jrAudio', 'audio_bpm', 120);
This will create that key for any audio item that does NOT have it already set.
jrCore_db_update_default_key($module, $key, $value, $default) - this does the same thing but allows you to update the default at a later point - i.e. change 120 to 60:
jrCore_db_create_default_key('jrAudio', 'audio_bpm', 60, 120);
this will update all that are still set at 120 to 60.
There is also a new "UNIQUE" keyword that can be used on {jrCore_list} calls (or in a jrCore_db_search_items() parameter array - i.e.
group_by="_profile_id UNIQUE"
When used in a jrCore_list call would limit the returned results to ONE per profile, so this can easily be used to make lists where you only want 1 results (based on a key) to be returned.
Please let us know if you have any feedback or comments on the new functionality - we hope you enjoy the new release
Thanks!
--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
updated by @brian: 11/09/14 12:36:10PM