示例#1
0
        protected virtual string GetDeclarationChamp_TypeAndLength(CInfoChampTable champ)
        {
            string strType = DataBaseTypesMappeur.GetStringDBTypeFromType(champ.TypeDonnee);

            if (champ.TypeDonnee == typeof(string))
            {
                if (champ.IsLongString || (champ.Longueur > DataBaseTypesMappeur.MaxDBStringLength && AutoAdaptLongString))
                {
                    strType = DataBaseTypesMappeur.DBLongStringDefinition;
                }
                else
                {
                    strType += "(";

                    if (champ.Longueur > DataBaseTypesMappeur.MaxDBStringLength)
                    {
                        strType += DataBaseTypesMappeur.MaxDBStringLength.ToString();
                    }
                    else
                    {
                        strType += champ.Longueur.ToString();
                    }

                    strType += ")";
                }
            }
            return(strType);
        }
示例#2
0
        protected virtual string GetDeclarationChampIdForCreateTable(CStructureTable structure)
        {
            string strResult = "";

            if (structure.HasChampIdAuto)
            {
                strResult += GetNewNomClefPrimaire(structure.ChampsId) + " ";
                strResult += DataBaseTypesMappeur.GetStringDBTypeFromType(structure.ChampsId[0].TypeDonnee);
                strResult += " NOT NULL";
            }
            return(strResult);
        }
        public override CResultAErreur InitialiserDataBase()
        {
            CResultAErreur result = base.InitialiserDataBase();

            //Creation de la table de synchronisation
            if (result)
            {
                DeleteTable("SC2I_SYNC_LOG");
            }

            //Creation de la table
            if (result)
            {
                result = Connection.RunStatement(
                    "Create table SC2I_SYNC_LOG (" +
                    "SSL_ID " + DataBaseTypesMappeur.GetStringDBTypeFromType(typeof(Int32)) + " NOT NULL, " +
                    "SSL_TABLE " + DataBaseTypesMappeur.GetStringDBTypeFromType(typeof(String)) + "(255) not null," +
                    "SSL_ELT_ID " + DataBaseTypesMappeur.GetStringDBTypeFromType(typeof(Int32)) + " not null," +
                    "SSL_TYPE " + DataBaseTypesMappeur.GetStringDBTypeFromType(typeof(Int32)) + " not null," +
                    CSc2iDataConst.c_champIdSynchro + " " + DataBaseTypesMappeur.GetStringDBTypeFromType(typeof(Int32)) + " not null)");
            }

            //Creation des sequences de numérotation
            if (result)
            {
                result = CreerSequencesNumerotationTable("SC2I_SYNC_LOG");
            }

            //Clef Primaire
            if (result)
            {
                result = Connection.RunStatement(GetRequeteCreateClefPrimaire("SC2I_SYNC_LOG", "SSL_ID"));
            }

            //Création de l'index pour synchro
            if (result)
            {
                result = CreateIndex("SC2I_SYNC_LOG", false, "SC2I_SYNC_SESSION");
            }

            //Création d'un champ auto incrémenté
            if (result)
            {
                result = CreerSystemeAutoIncremente("SC2I_SYNC_LOG", "SSL_ID");
            }

            //if (result && FinCreationOuMAJTable != null)
            //    FinCreationOuMAJTable(this, new ArgumentsEvenementOperationTable("SC2I_SYNC_LOG"));

            return(result);
        }