static void SetFileEntry( GtkWidget *widget, WidgetData *wdata, _FileEntry *data) { static GHashTable *connectlist = NULL; GtkPandaFileEntry *fentry; GtkWidget *subWidget; WidgetData *subdata; char *longname; char *folder; ENTER_FUNC; SetCommon(widget,wdata); fentry = GTK_PANDA_FILE_ENTRY(widget); g_return_if_fail(data->binary != NULL); longname = (char *)glade_get_widget_long_name(widget); if (connectlist == NULL) { connectlist = NewNameHash(); } if (g_hash_table_lookup(connectlist, longname) == NULL) { g_hash_table_insert(connectlist, longname, longname); g_signal_connect_after(G_OBJECT(widget), "done_action", G_CALLBACK(SavePreviousFolder), NULL); } folder = GetWidgetCache(longname); if (folder == NULL) { folder = ""; } gtk_panda_file_entry_set_folder(fentry, folder); if (LBS_Size(data->binary) > 0) { //download gtk_panda_file_entry_set_mode(fentry, GTK_FILE_CHOOSER_ACTION_SAVE); gtk_panda_file_entry_set_data(fentry, LBS_Size(data->binary), LBS_Body(data->binary)); //set subwidget subdata = GetWidgetData(data->subname); subWidget = GetWidgetByLongName(data->subname); if (subdata != NULL || subWidget != NULL) { SetEntry(subWidget, subdata,(_Entry *)subdata->attrs); } g_signal_emit_by_name(G_OBJECT(widget), "browse_clicked", NULL); } else { //upload gtk_panda_file_entry_set_mode(GTK_PANDA_FILE_ENTRY(widget), GTK_FILE_CHOOSER_ACTION_OPEN); } LEAVE_FUNC; }
static void GL_SendLBS( NETFILE *fp, LargeByteString *lbs) { GL_SendLength(fp,LBS_Size(lbs)); if ( LBS_Size(lbs) > 0 ) { Send(fp,LBS_Body(lbs),LBS_Size(lbs)); if ( !CheckNetFile(fp) ) { GL_Error(); } } }
static ValueStruct * _DBCOMMIT( DBG_Struct *dbg, DBCOMM_CTRL *ctrl) { int rc; char *p , *q; LargeByteString *lbs; ENTER_FUNC; CheckDB_Redirect(dbg); lbs = (LargeByteString *)dbg->process[PROCESS_UPDATE].conn; rc = 0; if (LBS_Size(lbs) > 0){ LBS_EmitEnd(lbs); RewindLBS(lbs); p = (char *)LBS_Body(lbs); while ( ( q = strchr(p,0xFF) ) != NULL ) { *q = 0; rc += DoShell(p); p = q + 1; } rc += DoShell(p); LBS_String(dbg->last_query,p); LBS_Clear(lbs); } CommitDB_Redirect(dbg); if ( ctrl != NULL ) { ctrl->rc = rc; } LEAVE_FUNC; return (NULL); }
static void SetPixmap( GtkWidget *widget, WidgetData *wdata, _Pixmap *data) { ENTER_FUNC; SetCommon(widget,wdata); if ( LBS_Size(data->binary) <= 0) { gtk_widget_hide(widget); } else { gtk_widget_show(widget); gtk_panda_pixmap_set_image(GTK_PANDA_PIXMAP(widget), (gchar*)LBS_Body(data->binary),(gsize)LBS_Size(data->binary)); } LEAVE_FUNC; }
static void SetPandaPreview( GtkWidget *widget, WidgetData *wdata, _PREVIEW *data) { ENTER_FUNC; SetCommon(widget,wdata); gtk_panda_pdf_set(GTK_PANDA_PDF(widget), LBS_Size(data->binary), LBS_Body(data->binary)); LEAVE_FUNC; }
extern PacketDataType RecvStringData( NETFILE *fp, char *str, size_t size) { PacketDataType type; ENTER_FUNC; type = GL_RecvDataType(fp); switch (type) { case GL_TYPE_INT: dbgmsg("int"); sprintf(str,"%d",GL_RecvInt(fp)); break; case GL_TYPE_CHAR: case GL_TYPE_VARCHAR: case GL_TYPE_DBCODE: case GL_TYPE_TEXT: GL_RecvString(fp, size, str); break; case GL_TYPE_BINARY: case GL_TYPE_BYTE: case GL_TYPE_OBJECT: dbgmsg("LBS"); GL_RecvLBS(fp,LargeBuff); if ( LBS_Size(LargeBuff) > 0 ) { memcpy(str,LBS_Body(LargeBuff),LBS_Size(LargeBuff)); str[LBS_Size(LargeBuff)] = 0; } else { *str = 0; } break; } LEAVE_FUNC; return type; }
static void SetDBAudit(DBG_Struct *dbg) { ValueStruct *audit; LargeByteString *lbs; if (dbg->auditlog > 0) { if (ThisEnv->auditrec->value != NULL) { audit = ThisEnv->auditrec->value; SetValueInteger(GetItemLongName(audit, "ticket_id"), dbg->ticket_id); lbs = dbg->last_query; if ((lbs != NULL) && (LBS_Size(lbs) > 0)) { SetValueString(GetItemLongName(audit, "exec_query"), LBS_Body(lbs), dbg->coding); } } } }
static void SetPandaDownload( GtkWidget *widget, WidgetData *wdata, _Download *data) { ENTER_FUNC; SetCommon(widget,wdata); g_return_if_fail(data->binary != NULL); if (LBS_Size(data->binary) > 0) { ShowDownloadDialog(widget, data->filename, data->description, data->binary); } LEAVE_FUNC; }
static Bool SendVeryfyData_Redirect( DBG_Struct *dbg) { Bool rc = FALSE; if ( (dbg->fpLog != NULL) && ( dbg->redirectData != NULL) && ( LBS_Size(dbg->redirectData) > 0 ) ) { LBS_EmitEnd(dbg->checkData); LBS_EmitEnd(dbg->redirectData); SendPacketClass(dbg->fpLog,RED_DATA); ON_IO_ERROR(dbg->fpLog,badio); SendInt(dbg->fpLog, dbg->ticket_id); ON_IO_ERROR(dbg->fpLog,badio); SendLBS(dbg->fpLog,dbg->checkData); ON_IO_ERROR(dbg->fpLog,badio); SendLBS(dbg->fpLog,dbg->redirectData); ON_IO_ERROR(dbg->fpLog,badio); } rc = SendCommit_Redirect(dbg); badio: return rc; }
static void _DumpOps( LargeByteString *sql) { int c; int n; Bool fIntoAster; ENTER_FUNC; RewindLBS(sql); printf("\t\t\t\tlength = %d\n",(int)LBS_Size(sql)); fIntoAster = FALSE; while ( ( c = LBS_FetchByte(sql) ) >= 0 ) { if ( c != SQL_OP_ESC ) { printf("%04d ",(int)LBS_GetPos(sql)-1); do { printf("%c",c); } while ( ( ( c = LBS_FetchByte(sql) ) >= 0 ) && ( c != SQL_OP_ESC ) ); printf("\n"); } printf("%04d ",(int)LBS_GetPos(sql)-1); switch (c = LBS_FetchByte(sql)) { case SQL_OP_INTO: n = LBS_FetchInt(sql); printf("INTO\t%d",n); if ( n > 0 ) { fIntoAster = FALSE; } else { fIntoAster = TRUE; } break; case SQL_OP_STO: if ( !fIntoAster ) { printf("STO\t%p", (ValueStruct *)LBS_FetchPointer(sql)); } else { printf("STO\t*"); } break; case SQL_OP_REF: printf("REF\t%p", (ValueStruct *)LBS_FetchPointer(sql)); break; case SQL_OP_VCHAR: printf("VCHAR");fflush(stdout); break; case SQL_OP_EOL: printf("EOL");fflush(stdout); break; case SQL_OP_LIMIT: printf(" $limit");fflush(stdout); break; default: dbgprintf("[%X]",c); break; } printf("\n"); } LEAVE_FUNC; }
extern void SendLBS(NETFILE *fp, LargeByteString *lbs) { SendLength(fp, LBS_Size(lbs)); if (LBS_Size(lbs) > 0) { Send(fp, LBS_Body(lbs), LBS_Size(lbs)); } }