Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing batch crashes server 4.0.0.2496 and 4.0.1.2692 #7080

Closed
cincuranet opened this issue Dec 21, 2021 · 0 comments
Closed

Executing batch crashes server 4.0.0.2496 and 4.0.1.2692 #7080

cincuranet opened this issue Dec 21, 2021 · 0 comments

Comments

@cincuranet
Copy link
Member

This piece of code (based on structure from 11.batch.cpp) and doing batch->execute crashes the remote server, version 4.0.0.2496 and 4.0.1.2692.

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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants