I have this piece of code (based on structure from 11.batch.cpp) and doing 
`batch->execute` crashes the remote server, version 4.0.0.2496. I know it will 
end up in error, because I didn't fix the `project1` for my structure, but 
client should not crash server no matter what, I think.

                att = prov->attachDatabase(&status, "192.168.66.48:test.fdb", 
0, NULL);
                tra = att->startTransaction(&status, 0, NULL);

                FB_MESSAGE(Msg1, ThrowStatusWrapper,
                        (FB_VARCHAR(5), id)
                        (FB_VARCHAR(10), name)
                ) project1(&status, master);
                project1.clear();
                IMessageMetadata* meta = project1.getMetadata();

                unsigned mesAlign = meta->getAlignment(&status);
                unsigned mesLength = meta->getMessageLength(&status);
                unsigned char* streamStart = align(streamBuf, mesAlign);

                pb = utl->getXpbBuilder(&status, IXpbBuilder::BATCH, NULL, 0);
                pb->insertInt(&status, IBatch::TAG_RECORD_COUNTS, 1);

                const char* sqlStmt1 = "insert into batch(i) values(?)";
                /*auto stmt = att->prepare(&status, tra, 0, sqlStmt1, 
SAMPLES_DIALECT, 0);
                auto batch = stmt->createBatch(&status, meta, 
pb->getBufferLength(&status), pb->getBuffer(&status));*/
                batch = att->createBatch(&status, tra, 0, sqlStmt1, 
SAMPLES_DIALECT, meta,
                        pb->getBufferLength(&status), pb->getBuffer(&status));

                project1->id.set("BAT11");
                project1->name.set("SNGL_REC1");
                batch->add(&status, 1, project1.getData());

                project1->id.set("BAT12");
                project1->name.set("SNGL_REC2");
                batch->add(&status, 1, project1.getData());

                cs = batch->execute(&status, tra);
                print_cs(status, cs, utl);

                batch->close(&status);
                batch = NULL;


-- 
Mgr. Jiří Činčura
https://www.tabsoverspaces.com/


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to