Steve Bergman wrote:

Is it possible to dump an SQLite table in a format something like this?

INSERT INTO employee (last_name, first_name, mi, username, id, extension, home_phone, cell_phone, status, email_primary, email_secondary) VALUES ('Jones', 'John', NULL, 'jjones', 6, '108/14', '555-1212', '525-2123', 'a', '[EMAIL PROTECTED]', NULL);

I have a need to move data between DBMS's where the field order may not be known.

Thanks,
Steve Bergman




Steve,

It isn't possible with the standard shell but you could build a modified version of the shell that would. The shell generates an SQL query to dump the table in the function dump_callback() in shell.c. This SQL statement is passed to run_table_dump_query() to generate the insert statements needed to rebuild the table. If you change dump_callback() to add the list of column names to the SQL statement it generates, they would appear on each output line. Note, that dump_callback() already iterates through all the column names in the table to build the select statement used to dump the data, so the column names are readily available.

HTH
Dennis Cote


Reply via email to