Beispiel #1
0
        public Lazaro.Orm.Data.IConnection GetNewConnection(string ownerName)
        {
            var Res = new Lfx.Data.Connection(this, ownerName);

            switch (Lfx.Data.DatabaseCache.DefaultCache.AccessMode)
            {
            case AccessModes.MySql:
                if (this.Driver == null)
                {
                    this.Driver    = new Lazaro.Orm.Data.Drivers.MySqlDriver();
                    this.Formatter = new qGen.MySqlFormatter();
                    Lfx.Data.DatabaseCache.DefaultCache.OdbcDriver = null;
                    Lfx.Data.DatabaseCache.DefaultCache.Mars       = false;
                    Lfx.Data.DatabaseCache.DefaultCache.SqlMode    = qGen.SqlModes.MySql;
                }
                break;

            case AccessModes.Npgsql:
                throw new NotImplementedException("Soporte PostgreSQL no implementado");

            case AccessModes.MSSql:
                throw new NotImplementedException("Soporte SQL Server no implementado");

            case AccessModes.Odbc:
                throw new NotImplementedException("Soporte ODBC no implementado");
            }

            this.ActiveConnections.Add(Res);

            return(Res);
        }
Beispiel #2
0
                public Tag(Connection dataBase, string tableName, Lfx.Data.Row fromRow)
                {
                        this.DataBase = dataBase;
                        this.TableName = tableName;
                        this.Id = System.Convert.ToInt32(fromRow["id_tag"]);
                        this.FieldName = fromRow["fieldname"].ToString();
                        this.Label = fromRow["label"].ToString();
                        if (fromRow["extra"] != null)
                                this.Extra = fromRow["extra"].ToString();
                        string FldType = fromRow["fieldtype"].ToString();
                        switch(FldType) {
                                case "relation":
                                        this.FieldType = DbTypes.Integer;
                                        string[] RelationFields = this.Extra.Split(new char[] { ',' });
                                        string ReferenceTable = RelationFields[0], ReferenceColumn, DetailColumn;
                                        
                                        if(RelationFields.Length >= 2)
                                                ReferenceColumn = RelationFields[1];
                                        else
                                                ReferenceColumn = dataBase.Tables[ReferenceTable].PrimaryKey;

                                        if(RelationFields.Length >= 3)
                                                DetailColumn = RelationFields[2];
                                        else
                                                DetailColumn = "nombre";

                                        this.Relation = new Relation(this.FieldName, ReferenceTable, ReferenceColumn, DetailColumn);

                                        if (RelationFields.Length >= 4)
                                                LblType = RelationFields[3];
                                        else
                                                LblType = null;
                                        break;
                                default:
                                        this.FieldType = Lfx.Data.Types.FromSqlType(FldType);
                                        break;
                        }

                        if (fromRow["inputtype"] != null && fromRow["inputtype"].ToString() != string.Empty)
                                this.InputFieldType = (Lfx.Data.InputFieldTypes)(Enum.Parse(typeof(Lfx.Data.InputFieldTypes), fromRow["inputtype"].ToString()));
                                                
                        this.Nullable = System.Convert.ToBoolean(fromRow["fieldnullable"]);
                        this.Internal = System.Convert.ToBoolean(fromRow["internal"]);
                        this.Access = System.Convert.ToInt32(fromRow["access"]);
                        this.DefaultValue = fromRow["fielddefault"];
                        if (this.DefaultValue is DBNull)
                                this.DefaultValue = null;

                }
Beispiel #3
0
                public Table(Connection connection, string name)
                {
			this.Connection = connection;
                        this.Name = name;
                }
Beispiel #4
0
 public Transaction(Connection connection, IsolationLevel isolationLevel)
 {
         this.DataConnection = connection;
         this.DbTransaction = connection.DbConnection.BeginTransaction(isolationLevel);
 }