How can MySQL return an empty row matching a given table's schema, given the table name as an input string? How can a query or procedure return an empty copy of a new record?
Ideally suited for objects which are in a transactional allocation process:
It is highly preferable to have authoritative defaults and NULLS for arbitrary tables when constructing new objects() that may-or-may not ultimately be saved to the database.
For example, a CMS user relies on AJAX which calls for a new post() or new product() dynamically. Rather than trusting stored profiles to set values in the scripting language, a blank &quot;instance&quot; of a row would be rather useful.
From a pure database perspective this isn't really possible, unless you made a View that had a single row with the default values you needed that matched the schema of your table.
This question might be better suited on StackOverflow for how to construct a new instance of an entity object in JavaScript or whichever other object-oriented languages you're using.