예제 #1
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOMySQLConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new MySQLPDODriver());

            string fullname = typeof(PDO).Name;
            var    tPDO     = ApplicationContext.Default.GetType(new QualifiedName(new Name(typeof(PDO).FullName)), ref fullname);

            Core.Reflection.PhpMemberAttributes att = Core.Reflection.PhpMemberAttributes.Public | Core.Reflection.PhpMemberAttributes.Static;
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_USE_BUFFERED_QUERY", MySQLPDODriver.MYSQL_ATTR_USE_BUFFERED_QUERY);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_INIT_COMMAND", MySQLPDODriver.MYSQL_ATTR_INIT_COMMAND);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_READ_DEFAULT_FILE", MySQLPDODriver.MYSQL_ATTR_READ_DEFAULT_FILE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_READ_DEFAULT_GROUP", MySQLPDODriver.MYSQL_ATTR_READ_DEFAULT_GROUP);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_MAX_BUFFER_SIZE", MySQLPDODriver.MYSQL_ATTR_MAX_BUFFER_SIZE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_DIRECT_QUERY", MySQLPDODriver.MYSQL_ATTR_DIRECT_QUERY);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_FOUND_ROWS", MySQLPDODriver.MYSQL_ATTR_FOUND_ROWS);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_IGNORE_SPACE", MySQLPDODriver.MYSQL_ATTR_IGNORE_SPACE);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_COMPRESS", MySQLPDODriver.MYSQL_ATTR_COMPRESS);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CA", MySQLPDODriver.MYSQL_ATTR_SSL_CA);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CAPATH", MySQLPDODriver.MYSQL_ATTR_SSL_CAPATH);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_SSL_CERT", MySQLPDODriver.MYSQL_ATTR_SSL_CERT);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_CIPHER", MySQLPDODriver.MYSQL_ATTR_CIPHER);
            ApplicationContext.Default.AddConstantToType(tPDO.TypeDesc, att, "MYSQL_ATTR_KEY", MySQLPDODriver.MYSQL_ATTR_KEY);
        }
예제 #2
0
        /// <summary>
        /// Called by the Core after the library is loaded.
        /// </summary>
        protected override void Loaded(PhpLibraryAttribute assemblyAttribute, LibraryConfigStore configStore)
        {
            base.Loaded(assemblyAttribute, configStore);
            singleton = this;

            PDOSQLiteConfiguration.RegisterLegacyOptions();

            PDOLibraryDescriptor.RegisterProvider(new SQLitePDODriver());

            string fullname = typeof(PDO).Name;
            DType  tPDO     = ApplicationContext.Default.GetType(new QualifiedName(new Name(typeof(PDO).FullName)), ref fullname);

            Core.Reflection.PhpMemberAttributes att = Core.Reflection.PhpMemberAttributes.Public | Core.Reflection.PhpMemberAttributes.Static;
            ApplicationContext.Default.AddMethodToType(tPDO.TypeDesc, att, "sqliteCreateFunction", SQLitePDODriver.PDO_sqliteCreateFunction);
        }