What is the D7 equivalent of CCK "content_instance_tablename" in db_query?
Both functions in your code (content_field_tablename() and content_instance_tablename()) just return a string based on the version number of the CCK module.

The Drupal 7 equivalents would be the field_config and field_config_instance tables respectively, as defined in field_schema.

Remember fields can be attached to any entity in Drupal 7 (not just nodes) so you'll need to change your code accordingly.

If you're using this query to get information about the field metadata you might want to use one of the Field Info API functions instead, e.g.

$all_field_instance_data = field_info_instances();


or

$single_field_instance_data = field_info_instance('node', 'field_some_field', 'article');