public string insertRow(parametrosInsert insert) { try { MariaConnect db = new MariaConnect("localhost", "TEST", "prueba", "prueba", "3306"); //int row_id = Guid.NewGuid().GetHashCode(); string row_id = generateID(); foreach (valueXcolum valorXcolumna in insert.valueXcolumn) { var data_id = db.GetValueFunction("add_tupla('" + row_id + "', '" + valorXcolumna.column + "');"); string procedure = "get_connection(" + valorXcolumna.column + ");"; List <Dictionary <string, object> > conexion = db.CallProcedure(procedure); switch (conexion[0]["database_type"].ToString()) { case "mariaDB": insertMaria(conexion[0], valorXcolumna.value, data_id); break; case "SQLServer": insertServer(conexion[0], valorXcolumna.value, data_id); break; case "mongoDB": insertMongo(conexion[0], valorXcolumna.value, data_id); break; } } return("{\"message\": \"" + "SE INSERTO LA FILA EXITOSAMENTE!" + "\"}"); } catch (Exception ex) { return("{\"messageError\": \"" + ex.ToString() + "\"}"); } }
public string createTable(parametrosCreateTable createTable) { try { MariaConnect db = new MariaConnect("localhost", "TEST", "prueba", "prueba", "3306"); var id_table = db.GetValueFunction("add_table('" + createTable.table_name + "'," + "" + createTable.database_id + ");"); foreach (parametrosColumn column in createTable.columns) { db.NonQuery("CALL add_Column(" + id_table + "," + "'" + column.DB_alias + "'," + "'" + column.column_name + "'," + "'" + column.Type + "'," + "'" + column.Null + "'" + ");"); } return("{\"message\": \"" + "SE CREO LA TABLA EXITOSAMENTE!" + "\"}"); } catch (Exception ex) { return("{\"messageError\": \"" + ex.ToString() + "\"}"); } }