void CDlgBulkRegister::SaveData( )
{
    QStringList lstDuplication;
    QStringList lstTotalSql;

    switch ( cardType ) {
    case CommonDataType::MonthlyCard :
        SaveMonthData( lstDuplication, lstTotalSql );
        break;

    case CommonDataType::ValueCard :
        SaveValueData( lstDuplication, lstTotalSql );
        break;

    case CommonDataType::TimeCard :
        SaveTimeData( lstDuplication, lstTotalSql );
        break;
    }

    if ( 0 < lstDuplication.count( ) ) {
        CCommonFunction::MsgBox( NULL, "提示", "下列卡号已存在:\r\n" + lstDuplication.join( "," ),
                                 QMessageBox::Information );
    }

    if ( 0 < lstTotalSql.count( ) ) {
        ExecuteSql( lstTotalSql );
    }
}
void SQLCommandPanel::OnScintilaKeyDown(wxKeyEvent& event)
{
    if ( (event.ControlDown()) && (event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)) {
        ExecuteSql();
    }
    event.Skip();
}
MYSQL_RES * CMyDataBase::OpenRecordset(const char* chSql)
{
	MYSQL_RES *rs = NULL;
	if (ExecuteSql(chSql)) 
	{
		if ((rs = mysql_store_result(dbConn)) == NULL)
		{
		//	g_log.Log(LEVEL_ERROR,"%s,	[%s][%d]","µ÷ÓÃmysql_store_resultº¯Êýʧ°Ü",__FILE__,__LINE__);
			//g_log.Log(LEVEL_ERROR,"%s,	[%s][%d]",mysql_error(&mysql),__FILE__,__LINE__);
		}
	}
	return rs;
}
Exemple #4
0
//======================================================================================================================
DatabaseResult* Database::ExecuteSynchSql(const int8* sql, ...)
{
	int8 message[8192];


	// format our sql string
	va_list args;
	va_start(args, sql);
	int8    localSql[8192];
	/*int32 len = */vsnprintf(localSql, sizeof(localSql), sql, args);

	sprintf(message, "WARNING: SYNCHRONOUS SQL STATEMENT: %s",localSql);
	gLogger->logMsg(message, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | BACKGROUND_RED);

	va_end(args);
	return ExecuteSql(localSql);
}
Exemple #5
0
void CDBStepNC::CreateToolDbTable()
{

    //
    ExecuteSql("DROP TABLE milling_cutter");
    ExecuteSql("DROP TABLE millingtooltype");
    ExecuteSql("DROP TABLE materialtype");

    CString sqlCreateToolTable = "CREATE TABLE milling_cutter( "
                                 "[toolid] SMALLINT NOT NULL, "
                                 "[name] TEXT(50), "
                                 "[tooltypeid] INTEGER, "
                                 "[materialid] INTEGER, "
                                 "[chuckid] INTEGER, "
                                 "[manufacturer] TEXT(50), "
                                 "[sku] TEXT(50), "
                                 "[number_of_teeth] INT, "
                                 "[hand_of_cut]  TEXT(50), "
                                 "[coolant_through_tool] SMALLINT, "
                                 "[cutting_edge_length]  FLOAT, "
                                 "[flute_length]  FLOAT, "
                                 "[overall_length]  FLOAT, "
                                 "[shoulder_length]  FLOAT, "
                                 "[tip_diameter]  FLOAT, "
                                 "[tool_tip_half_angle] FLOAT, "
                                 "[tool_circumference_angle] FLOAT, "
                                 "[tool_holder_diameter_for_spindle_orientation] FLOAT, "
                                 "[arbor_diameter] FLOAT, "
                                 "[pilot_diameter]  FLOAT, "
                                 "[pilot_length]  FLOAT, "
                                 "[edge_radius]  FLOAT, "
                                 "[edge_center_vertical] FLOAT, "
                                 "[edge_center_horizontal] FLOAT, "
                                 "[sfm]  FLOAT, "
                                 "[fpt]  FLOAT, "
                                 "[metric] SMALLINT, "
                                 "[timeunit] SMALLINT, "
                                 "[Image] TEXT(120), "
                                 "[thread_root_diameter]  FLOAT, "
                                 "[thread_angle]  FLOAT, "
                                 "[direction_for_spindle_orientation] INTEGER, "
                                 "[countersink_radius] FLOAT,  "
                                 "[tapered_drill_angle]  FLOAT, "
                                 "[tapered_endmill_angle]  FLOAT, "
                                 "[t_slot_mill_cutting_thickness] FLOAT, "
                                 "[dovetail_mill_included_angle]  FLOAT, "
                                 "[woodruff_keyseat_mill_cutter_width]  FLOAT, "
                                 "[side_mill_cutter_width]  FLOAT, "
                                 "[tapered_tap_angle]  FLOAT, "
                                 "[combined_drill_and_tap_length]  FLOAT,  "
                                 "[tapered_reamer_taper_angle]  FLOAT, "
                                 "[combined_drill_and_reamer_length]  FLOAT, "
                                 "[boring_tool_retract_movement_forbidden] SMALLINT, "
                                 "PRIMARY KEY  (toolid));" ;
#if 1
    ExecuteSql(sqlCreateToolTable);
    //ExecuteSql("INSERT INTO milling_cutter ( toolid , name, tooltypeid, tip_diameter, number_of_teeth, metric) VALUES ( 1, '1/4 END MILL FLAT', 10, 0.25, 2, 0)");
    //ExecuteSql("INSERT INTO milling_cutter ( toolid , name, tooltypeid, tip_diameter, number_of_teeth, metric) VALUES ( 2, '1/2 END MILL FLAT', 10, 0.5, 2, 0)");
    //ExecuteSql("INSERT INTO milling_cutter ( toolid , name, tooltypeid, tip_diameter, number_of_teeth, metric) VALUES ( 3, '1/2 CENTER DRILL', 1, 0.5, 2, 0)");

    CString sqlCreateToolTableType = "CREATE TABLE millingtooltype( "
                                     "[tooltypeid] INTEGER CONSTRAINT PK_ToolType PRIMARY KEY, "
                                     "[description] TEXT(50), "
                                     "[bitmask] SMALLINT "
                                     " );" ;
    ExecuteSql(sqlCreateToolTableType);

    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 1, 'CENTER DRILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 2, 'SPOT')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 3, 'DRILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 4, 'TAP-RH')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 5, 'TAP-LH')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 6, 'REAMER')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 7, 'BORING BAR')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 8, 'COUNTER BORE')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 9, 'COUNTER SINK')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 10, 'END MILL FLAT')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 11, 'END MILL SPHERE')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 12, 'END MILL BULL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 13, 'CHAMFER MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 14, 'FACE MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 15, 'SLOT MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 16, 'CORNER RAD MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 17, 'DOVETAIL MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 18, 'TAPER MILL')");
    ExecuteSql("INSERT INTO millingtooltype ( tooltypeid , description) VALUES ( 19, 'LOLLIPOP MILL')");
#endif
    ExecuteSql("ALTER TABLE milling_cutter ADD CONSTRAINT ToolTypeRelationship FOREIGN KEY (tooltypeid) REFERENCES millingtooltype (tooltypeid))");

    CString sqlCreateMaterialTable = "CREATE TABLE materialtype( "
                                     "[materialid] INTEGER CONSTRAINT PK_MaterialType PRIMARY KEY, "
                                     "[description] TEXT(50), "
                                     "[bitmask] SMALLINT, "
                                     "[hardness] FLOAT "
                                     " );" ;
    ExecuteSql(sqlCreateMaterialTable);
    //tool material (1-HSS, 2-CARBIDE, 3-COATED CAR, 4-CERAMIC, 5-BORZON, 10-UNKNOWN)
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 1, 'HSS')");
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 2, 'CARBIDE')");
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 3, 'COATED CAR')");
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 4, 'CERAMIC')");
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 5, 'BORZON')");
    ExecuteSql("INSERT INTO materialtype ( materialid , description) VALUES ( 10, 'UNKONWN')");


}
void SQLCommandPanel::OnExecuteSQL(wxCommandEvent& e)
{
    wxUnusedVar(e);
    ExecuteSql();
}
void SQLCommandPanel::OnExecuteClick(wxCommandEvent& event)
{
    ExecuteSql();
}