// Armstrong Dependancies* armstrong_1er_augmentation(Dependancies* param, Line_data* tab_data, int nb_colonnes) { Dependancies* temp = NULL; int j; Dependancies* temp_dep; Dependancies* courant_dep = copieDependance(param); // première itération while (courant_dep != NULL) { for (j=0; j<nb_colonnes; j++) { if ( !are_same_string( attribut(j, tab_data), (courant_dep->determinant)->attribut ) && !are_same_string(attribut(j, tab_data), (courant_dep->soumis)->attribut) ) { temp_dep = (Dependancies*)malloc(sizeof(Dependancies)); temp_dep->determinant = create_cell_chaine(attribut(j, tab_data)); temp_dep->determinant = append_chaine(temp_dep->determinant, courant_dep-> determinant); temp_dep->soumis = copie_chaine(courant_dep->soumis); temp_dep->suiv = NULL; if (temp == NULL) temp = temp_dep; else { if (!hasAnagrammeInDependance(temp, temp_dep)) temp = appendDependance(temp, temp_dep); else free(temp_dep); } } } courant_dep = courant_dep->suiv; } return temp = appendDependance(temp, param); }
ManagerArbre::ManagerArbre(const QString & table, const QMap<int,QString> & att, const QVector<QMap<int,int>> & attUnique) : ManagerSqlArbre(table,att,attUnique) { // Get Parent m_sqlGetParent.append("SELECT "); m_sqlGetParent.append(attribut(Arbre::Parent)); m_sqlGetParent.append(" FROM "); m_sqlGetParent.append(table).append(" WHERE "); m_sqlGetParent.append(attribut(Arbre::Id)); m_sqlGetParent.append("=?"); m_sqlGetParent.squeeze(); }
QString Task::saveToDir() { QString sleepAttr; if (getDaysSleep()>0) sleepAttr = attribut ("date_sleep",date_sleep.toString (Qt::ISODate) ); return singleElement ("task", attribut ("status",getStatusString() ) + attribut ("awake",getAwakeString() ) + attribut ("date_creation",date_creation.toString (Qt::ISODate) ) + attribut ("date_modified",date_modified.toString (Qt::ISODate) ) + sleepAttr ); }
QString AbstractLinkSql::creer(const QMap<int,QPair<bdd::createSql,bool>>& attCaract, const QMap<int, QString> &foreignKey) const { QString sql(wordSqlString(bdd::wordSql::Create)); sql.append(" ").append(m_table).append("(").append(attribut(Entity::Id)).append(" ").append(createSqlString(bdd::createSql::Primary)); for(int i = 1; i != m_nbrAtt; ++i) { sql.append(",").append(attribut(i)).append(" ").append(createSqlString(attCaract.value(i).first)); if(attCaract.value(i).second) sql.append(" ").append(createSqlString(bdd::createSql::NotNull)); } for(QMap<int, QString>::const_iterator i = foreignKey.cbegin(); i != foreignKey.cend(); ++i) sql.append(",").append(createSqlString(bdd::createSql::Foreign)).append("(").append(attribut(i.key())).append(") ") .append(createSqlString(bdd::createSql::Ref)).append(" ").append(i.value()); return sql; }
Set_Of_Attrs* getCombinaisonsAttrs(Combinaison* param, Line_data* tab_data) { Set_Of_Attrs* dump_attr = NULL; Set_Of_Attrs* temp_attr; Combinaison* courant_combi = param; Entier* courant_tuple; Chaine* temp_chaine; Chaine* dump_chaine; while (courant_combi != NULL) { courant_tuple = courant_combi->combi; dump_chaine = NULL; while (courant_tuple != NULL) { temp_chaine = (Chaine*)malloc(sizeof(Chaine)); temp_chaine->attribut = (char*)malloc(sizeof(char)*NMAX); temp_chaine->suiv = NULL; strcpy(temp_chaine->attribut, attribut(courant_tuple->val, tab_data) ); dump_chaine = append_chaine(dump_chaine, temp_chaine); courant_tuple = courant_tuple->suiv; } temp_attr = (Set_Of_Attrs*)malloc(sizeof(Set_Of_Attrs)); temp_attr->attributs = copie_chaine(dump_chaine); temp_attr->suiv = NULL; dump_attr = append_set_of_attrs(dump_attr, temp_attr); courant_combi = courant_combi->suiv; } return dump_attr; }
QString Settings::getDataXML (const QString &fpath) { QString s; int i=0; while (i<pathlist.count()) { if (pathlist.at(i)==fpath) if (!valuelist.at(i).isNull()) s+=singleElement ( "setting", attribut ("key",keylist.at(i)) +attribut ("value",valuelist.at(i).toString()) ); i++; } return s; }
Dependancies* armstrongAugmentation(Dependancies* param, Line_data* tab_data, int nb_colonnes) { int j; Dependancies* courant_dep; Dependancies* temp_dep; Dependancies* temp = NULL; // vérification de la nécessité de de la 1ère augmentation courant_dep = param; while (courant_dep != NULL && taille_chaine(courant_dep->determinant) <= 1) { courant_dep = courant_dep->suiv; } if (courant_dep == NULL) temp = armstrong_1er_augmentation(param, tab_data, nb_colonnes); else temp = param; Chaine* temp_chaine; // autres itérations int peut_continuer = 1; courant_dep = param; while (peut_continuer) { peut_continuer = 0; courant_dep = temp; while (courant_dep != NULL) { for (j=0; j<nb_colonnes; j++) { temp_chaine = create_cell_chaine(attribut(j, tab_data)); if ( !in_linked_string(courant_dep->determinant, temp_chaine) && !in_linked_string(courant_dep->soumis, temp_chaine) ) { temp_dep = (Dependancies*)malloc(sizeof(Dependancies)); temp_dep->determinant = copie_chaine(courant_dep->determinant); temp_dep->determinant = append_chaine(temp_dep->determinant, temp_chaine); temp_dep->soumis = copie_chaine(courant_dep->soumis); temp_dep->suiv = NULL; if (!hasAnagrammeInDependance(temp, temp_dep)) { temp = appendDependance(temp, temp_dep); if (peut_continuer == 0 ) peut_continuer = 1; } } } courant_dep = courant_dep->suiv; } } return temp; }
void afficher_combinaisons_attributs(Combinaison* combinaisons, Line_data* tab_data) { Combinaison* courant = combinaisons; Entier* courant_tuple; printf("*** Combinaisons *** \n"); while (courant != NULL) { courant_tuple = courant->combi; while (courant_tuple != NULL) { printf("%s | ", attribut(courant_tuple->val, tab_data)); courant_tuple = courant_tuple->suiv; } printf("\t**\n"); courant = courant->suiv; } printf("-----------\n"); }
void Parser_XML::attribut_list(std::string& chaine) { const char current_token = read_current_token(chaine); if(current_token == ' ') { std::string str_type, str_attribut; destroy_current_token(chaine, current_token); str_type = type(chaine); destroy_current_token(chaine, '='); destroy_current_token(chaine, '\"'); str_attribut = attribut(chaine); destroy_current_token(chaine, '\"'); this->addAttribut(std::pair< std::string, std::string >(str_type, str_attribut)); attribut_list(chaine); } else if(current_token == '>') { } else { std::cerr << "Error when reading a balise xml." << std::endl; } }
Dependancies* dependances(Set_Of_Attrs* agree, Line_data* tab_data, int nb_lignes, int nb_colonnes) { Dependancies* dump = NULL; Dependancies* temp_dep; Dependancies* param; Set_Of_Attrs* courant_agree = agree; Chaine* courant_chaine; Entier* temp_tuple; Entier* tuples; Couples* couples = NULL; Couples* courant_couple; Chaine* determinant; Chaine* soumis; while (courant_agree != NULL) { courant_chaine = courant_agree->attributs; if (taille_chaine(courant_chaine) >= 2) { tuples = NULL; while (courant_chaine != NULL) { temp_tuple = (Entier*)malloc(sizeof(Entier)); temp_tuple->val = colonne(courant_chaine->attribut, tab_data, nb_colonnes); temp_tuple->suiv = NULL; tuples = append_tuple(tuples, temp_tuple); courant_chaine = courant_chaine->suiv; } couples = getCouplesCombinaisons(tuples); courant_couple = couples; // Pour les dépendances fonctionnelles élémentaires while (courant_couple != NULL) { if (dependanceFonctionnelle(courant_couple->cpl[0], courant_couple->cpl[1], tab_data, nb_lignes) ) { determinant = (Chaine*)malloc(sizeof(Chaine)); determinant->attribut = (char*)malloc(sizeof(char)*NMAX); strcpy( determinant->attribut, attribut(courant_couple->cpl[0], tab_data)); determinant->suiv = NULL; soumis = (Chaine*)malloc(sizeof(Chaine)); soumis->attribut = (char*)malloc(sizeof(char)*NMAX); strcpy( soumis->attribut, attribut(courant_couple->cpl[1], tab_data)); soumis->suiv = NULL; temp_dep = createCellDependance(determinant, soumis); dump = appendDependance(dump, temp_dep); } if (dependanceFonctionnelle(courant_couple->cpl[1], courant_couple->cpl[0], tab_data, nb_lignes) ) { determinant = (Chaine*)malloc(sizeof(Chaine)); determinant->attribut = (char*)malloc(sizeof(char)*NMAX); strcpy( determinant->attribut, attribut(courant_couple->cpl[1], tab_data)); determinant->suiv = NULL; soumis = (Chaine*)malloc(sizeof(Chaine)); soumis->attribut = (char*)malloc(sizeof(char)*NMAX); strcpy( soumis->attribut, attribut(courant_couple->cpl[0], tab_data)); soumis->suiv = NULL; temp_dep = createCellDependance(determinant, soumis); dump = appendDependance(dump, temp_dep); } courant_couple = courant_couple->suiv; } } courant_agree = courant_agree->suiv; } return dump; }