int converter_core::exec_stmt(const template_info& info) const { #if 0 std::cout << "executing " << info.insert_text_ << "\n" << "with binding : " << format_binding(info.binding_) << "\n"; #endif if (sqlite3_step(info.insert_stmt_) == SQLITE_DONE) { sqlite3_reset(info.insert_stmt_); int rowid = sqlite3_last_insert_rowid(db_); return rowid; } std::string saved_reason=sqlite3_errmsg(db_); if (info.find_key_stmt_) { #if 0 std::cout << "executing " << info.find_key_text_ << "\n" << "with binding : " << format_binding(info.binding_) << "\n"; #endif int ret = sqlite3_step(info.find_key_stmt_); if (ret == SQLITE_ROW) { int result = sqlite3_column_int(info.find_key_stmt_, 0); #if 0 std::cout << "rowid found at " << result << "\n"; #endif sqlite3_reset(info.insert_stmt_); sqlite3_reset(info.find_key_stmt_); return result; } } BOOST_THROW_EXCEPTION(sqlite3_error(db_, "sqlite3_step") << statement_info(info.insert_text_) << binding_info(info.binding_) << reason_info(saved_reason) ); }
/* if both is true, produce an additional line for the corresponding uppercase key if its binding is different. - kw */ static void print_binding(HTStream *target, int i, int both) { char *buf; LYKeymap_t lac1 = LYK_UNKNOWN; /* 0 */ #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) if (prev_lynx_edit_mode && !no_dired_support && (lac1 = key_override[i]) != LYK_UNKNOWN) { if ((buf = format_binding(key_override, i)) != 0) { PUTS(buf); FREE(buf); } } else #endif /* DIRED_SUPPORT && OK_OVERRIDE */ if ((buf = format_binding(keymap, i)) != 0) { lac1 = keymap[i]; PUTS(buf); FREE(buf); } if (!both) return; i -= ' '; /* corresponding uppercase key */ #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE) if (prev_lynx_edit_mode && !no_dired_support && key_override[i]) { if (key_override[i] != lac1 && (buf = format_binding(key_override, i)) != 0) { PUTS(buf); FREE(buf); } } else #endif /* DIRED_SUPPORT && OK_OVERRIDE */ if (keymap[i] != lac1 && (buf = format_binding(keymap, i)) != 0) { PUTS(buf); FREE(buf); } }
void print_binding( HTStream *target, int i, BOOLEAN both ) { char *buf; LYKeymapCode lac1 = LYK_UNKNOWN; if ( prev_lynx_edit_mode && no_dired_support == 0 ) { lac1 = key_override[ i ]; if ( lac1 ) { buf = format_binding( key_override, i ); if ( buf ) { ebx( target, buf, strlen( buf ) ); if ( buf ) { free( buf ); buf = 0; if ( both ) { i += -32; if ( prev_lynx_edit_mode && !no_dired_support && ( key_override[ i ] & 65535 ) ) { if ( key_override[ i ] != lac1 ) { buf = format_binding( key_override, i ); if ( buf ) { ebx( target, buf, strlen( buf ) ); if ( buf ) { free( buf ); buf = 0; } } } } else if ( keymap[ i ] != lac1 ) { buf = format_binding( keymap, i ); if ( buf ) { ebx( target, buf, strlen( buf ) ); if ( buf ) { free( buf ); buf = 0; } } } } return; } } } } buf = format_binding( keymap, i ); if ( buf ) { lac1 = keymap[ i ]; ebx( target, buf, strlen( buf ) ); if ( buf ) { free( buf ); buf = 0; } } }