PHP7 PDO_DBLIB uniqueidentifier

时间:2016-07-23 22:04:50

标签: php sql-server pdo uniqueidentifier

我目前在项目中使用pdo_dblib扩展程序。 当我在PHP 5.6FreeTDS Version 7.0 config.设置string时使用此功能时,它会为PHP 7.0.8提供唯一标识符。 当我在SQL下使用相同的脚本时,它只会给我一些乱码。 我不想将其投放到PHP或稍后在PHP 7.0.8转换它。因为有时它可能是结果中的唯一标识符,有时不是。所以我需要通过完整的结果来转换uniqueidentifier。

那么有没有任何解决方案可以像PHP 5.6一样在<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="epiStageDS" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="com.ibm.db2.jcc.DB2Driver"/> <property name="url" value="" /> <property name="username" value="" /> <property name="password" value="" /> </bean> <bean id="epi" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="" /> <property name="username" value="" /> <property name="password" value="" /> </bean> <bean id="eveDS" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" /> <property name="url" value="" /> <property name="username" value="" /> <property name="password" value="" /> </bean> <!-- Session factory for EPI db --> <bean id="episessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="epi" /> <property name="packagesToScan"> <list> <value>edu.eve.model</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql:false}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql:false}</prop> </props> </property> </bean> <!-- EVE DS SESSION FACTORY --> <bean id="eveSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="eveDS" /> <property name="packagesToScan"> <list> <value>edu.eve.model</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql:false}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql:false}</prop> </props> </property> </bean> <!-- Session factory for Stage DS db --> <bean id="stageDsSessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="epiStageDS" /> <property name="packagesToScan"> <list> <value>edu.eve.model</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop> <prop key="hibernate.show_sql">${hibernate.db2.show_sql:false}</prop> <prop key="hibernate.format_sql">${hibernate.db2.format_sql:false}</prop> </props> </property> </bean> <bean id="epiTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="episessionFactory" /> </bean> <bean id="eveTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="eveSessionFactory" /> </bean> <bean id="stageDsTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="stageDsSessionFactory" /> </bean> <bean id="persistenceExceptionTranslationPostProcessor" class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /> 上工作?

2 个答案:

答案 0 :(得分:3)

正如Bojan的答案中提到的pull请求中所解释的那样,PHP 7中此问题的原因是您必须指示PDO将GUID从二进制转换为字符串。

这应该适合任何挣扎于此的人。

var player = new Vimeo.Player($('#player'));

var state = { 
  autoplaying : false,
  apiEnabled : null
};

player.on('play', () => {
  state.autoplaying = true;
  player.off('play');
});
                  
setTimeout(() => {
  if (state.apiEnabled === null) {
    state.apiEnabled = false;  
    // Do something 
  }
}, 100);
                
player.getPaused().then((paused) => {
  state.apiEnabled = true;
  // Do something
});

答案 1 :(得分:0)

看起来这个bug是在PHP7的一些次要版本中引入的。

  • 7.0.4完美无缺。您可以使用phpbrew手动编译它。
  • 7.0.8目前已实施此实施。

此处已经针对此问题提交了错误报告:https://bugs.php.net/bug.php?id=72601

和潜在修复的拉取请求: https://github.com/php/php-src/pull/2001