Issue Details (XML | Word | Printable)

Key: DOC-32
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Helen Borrie
Reporter: Konstantin Dombrugov
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Error in example of using new shutdown modes in FB 2

Created: 13/Aug/08 08:38 AM   Updated: 07/Jan/09 03:52 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

 Description  « Hide
Release Notes FB 2.* -> Changes to the Firebird API and ODS -> API (Application Programming Interface) -> 'Accommodation of New Shutdown <state> Parameters' -> Example of Use in C/C++

char dpb_buffer[256], *dpb, *p;
isc_db_handle handle = NULL;
dpb = dpb_buffer;
*dpb++ = isc_dpb_version1;
const char* user_name = "SYSDBA";
const int user_name_length = strlen(user_name);
*dpb++ = isc_dpb_user_name;
*dpb++ = user_name_length;
memcpy(dpb, user_name, user_name_length);
dpb += user_name_length;
const char* user_password = "masterkey";
const int user_password_length = strlen(user_password);
*dpb++ = isc_dpb_password;
*dpb++ = user_password_length;
memcpy(dpb, user_password, user_password_length);
dpb += user_password_length;
// Force an immediate full database shutdown
*dpb++ = isc_dpb_shutdown;

//THERE IT IS!! it's a length of the following value__________________________________________________
*dpb++ = 1;

*dpb++ = isc_dpb_shut_force | isc_dpb_shut_full;
const int dpb_length = dpb - dpb_buffer;
                    0, "employee.db",
                    dpb_length, dpb_buffer);
if (status_vector[0] == 1 && status_vector[1])
  isc_detach_database(status_vector, &handle);

I wasn't familiar with ClumpetWriter, but I am now :( I just wanted to improve delphi component using this example .. 2 hours of 'WTF?!'s till I explored FB source code.

 All   Comments   Change History   Subversion Commits      Sort Order: Descending order - Click to sort in ascending order
Konstantin Dombrugov added a comment - 07/Jan/09 03:52 PM
sorry, I were nervous
there is a mistake in example of using new shutdown modes in release notes to FB 2.*

*dpb++ = isc_dpb_shutdown;
*dpb++ = isc_dpb_shut_force | isc_dpb_shut_full;

must be:
*dpb++ = isc_dpb_shutdown;
*dpb++ = 1;
*dpb++ = isc_dpb_shut_force | isc_dpb_shut_full;

after command (isc_dpb_shutdown) if it has argument (isc_dpb_shut_force | isc_dpb_shut_full) a length of this argument (1 byte) must be placed in buffer before argument.

Helen Borrie added a comment - 25/Dec/08 07:20 PM
Would the OP like to explain what the bug is, please?