Where are display settings for nodes stored in the DB?
With basic Drupal, the db table is field_config_instance, all in the "data" column.

With Display suite, you should also look at ds_fields, ds_field_settings, ds_layout_settings.

(Use drush sqlc for a mysql commandline, and then "describe ds_field_settings;" etc.)

This being said, you really want to look for API functions. Look at:


field_ui_display_overview_form_submit()
For display suite I'm not completely sure where you need to look.. But again, submit handlers are usually a good place to look.