More of an FYI, but it's an interesting idiosyncrasy.
If you have a data connection that inserts records into a SQL table using a stored procedure, and that table uses a field with an IDENTITY (i.e. one that auto-increments), then you might notice that the table skips IDENTITY values (e.g. 1, 3, 5, 6,7, 9 etc.). After looking at the data tables I thought I had a bug in my code somewhere until I realized InfoPath was calling the procedure before any of my code was.
Just FYI: IDENTITY columns are incremented when a record is inserted – even before the transaction completes. If the transaction is cancelled, or a record is deleted, that particular IDENTITY will never be re-used.
I can only assume that InfoPath calls the stored procedure once in a transaction, and then cancels it, before the data connection is executed by the form itself. It may do this to test the output structure – who knows. I’ve given up trying to make sense of how InfoPath behaves in certain circumstances with SQL databases.
It only does this the first time the data connection is executed for a given session. All subsequent executions while the form is open don’t do this.