1

I am a new beginner in JOOQ and I have a curious question. I need to generate insert statements and dump the records to a file in the below format:

INSERT INTO table_name (column_list)
VALUES
    (value_list_1),
    (value_list_2),
    ...
    (value_list_n);

And another option is also to delete statements in this format::

DELETE FROM table WHERE (col1,col2) IN ((1,2),(3,4),(5,6))

I am just trying to find out if this works in JOOQ and how to do it. A quick hint or link which could lead me to a solution would be highly appreciated.

I understand JOOQ has CSV/ XML exportability. My preference would be XML however, the import is NOT yet implemented.

String csv = create.selectFrom(BOOK).fetch().formatCSV(';');
or 
String csv = create.selectFrom(BOOK).fetch().formatCSV(';', "{null}");

Thanks for the responses in advance.

  • How must the XML look like? – Simon Martinelli Mar 11 '21 at 08:47
  • @SimonMartinelli thanks for concern. i am not talking about XML i need a dump in sql as described here: DELETE FROM table WHERE (col1,col2) IN ((1,2),(3,4),(5,6)). Thanks in advance. – Noel Alex Makumuli Mar 11 '21 at 14:30
  • I'm not quite sure how your three parts of the question relate to each other. Are they really related, or do you have 3 separate questions? In the latter case, asking separate questions will give you better answers... – Lukas Eder Mar 11 '21 at 19:06
  • @LukasEder thanks for concern. Thanks for the advice on how to ask a question. I just to know how i can create an export of multiple rows in format: INSERT INTO table_name (column_list) VALUES (value_list_1),(value_list_2),(value_list_n); I would appreciate any leads to achieve my solution. – Noel Alex Makumuli Mar 12 '21 at 06:43
  • I'm sorry, I don't really know what you're asking... That `DELETE` statement is very confusing. What does that have to do with an export? Also, if you want to export `INSERT` statements (I'm assuming using `Result.formatInsert()`? Or something else?), then why do you suddenly have a "preference" for XML? I think the problem here is a classic http://xyproblem.info. You want to achieve X, but instead of asking about X, you're asking about Y... – Lukas Eder Mar 12 '21 at 07:35
  • Hello @LukasEder, thanks for your time. – Noel Alex Makumuli Mar 15 '21 at 05:35

0 Answers0