Ejemplo n.º 1
0
        static stdClass FetchFieldInternal(MySqlResultResource /*!*/ result, int fieldIndex)
        {
            if (!result.CheckFieldIndex(fieldIndex))
            {
                return(null);
            }

            //DataRow info = result.GetSchemaRowInfo(fieldIndex);
            //if (info == null) return null;

            Debug.Assert(result.GetRowCustomData() != null);

            string php_type = result.GetPhpFieldType(fieldIndex);
            //PhpMyDbResult.FieldCustomData data = ((PhpMyDbResult.FieldCustomData[])result.GetRowCustomData())[fieldIndex];
            //ColumnFlags flags = data.Flags;//result.GetFieldFlags(fieldIndex);

            // create an array of runtime fields with specified capacity:
            var objFields = new PhpArray(13);

            // add fields into the hastable directly:
            // no duplicity check, since array is already valid
            objFields.Add("name", result.GetFieldName(fieldIndex));
            //objFields.Add("table", (/*info["BaseTableName"] as string*/data.RealTableName) ?? string.Empty);
            //objFields.Add("def", ""); // TODO
            //objFields.Add("max_length", /*result.GetFieldLength(fieldIndex)*/data.ColumnSize);

            //objFields.Add("not_null", ((flags & ColumnFlags.NOT_NULL) != 0) /*(!(bool)info["AllowDBNull"])*/ ? 1 : 0);
            //objFields.Add("primary_key", ((flags & ColumnFlags.PRIMARY_KEY) != 0) /*((bool)info["IsKey"])*/ ? 1 : 0);
            //objFields.Add("multiple_key", ((flags & ColumnFlags.MULTIPLE_KEY) != 0) /*((bool)info["IsMultipleKey"])*/ ? 1 : 0);
            //objFields.Add("unique_key", ((flags & ColumnFlags.UNIQUE_KEY) != 0) /*((bool)info["IsUnique"])*/ ? 1 : 0);
            //objFields.Add("numeric", result.IsNumericType(php_type) ? 1 : 0);
            //objFields.Add("blob", ((flags & ColumnFlags.BLOB) != 0) /*((bool)info["IsBlob"])*/ ? 1 : 0);

            //objFields.Add("type", php_type);
            //objFields.Add("unsigned", ((flags & ColumnFlags.UNSIGNED) != 0) /*((bool)info["IsUnsigned"])*/ ? 1 : 0);
            //objFields.Add("zerofill", ((flags & ColumnFlags.ZERO_FILL) != 0) /*((bool)info["ZeroFill"])*/ ? 1 : 0);

            // create new stdClass with runtime fields initialized above:
            return((stdClass)objFields.ToClass());
        }