dblib_driver.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Wez Furlong <wez@php.net> |
  14. | Frank M. Kromann <frank@kromann.info> |
  15. +----------------------------------------------------------------------+
  16. */
  17. #ifdef HAVE_CONFIG_H
  18. # include "config.h"
  19. #endif
  20. #include "php.h"
  21. #include "php_ini.h"
  22. #include "ext/standard/info.h"
  23. #include "pdo/php_pdo.h"
  24. #include "pdo/php_pdo_driver.h"
  25. #include "php_pdo_dblib.h"
  26. #include "php_pdo_dblib_int.h"
  27. #include "zend_exceptions.h"
  28. /* Cache of the server supported datatypes, initialized in handle_factory */
  29. zval* pdo_dblib_datatypes;
  30. static void dblib_fetch_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info)
  31. {
  32. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  33. pdo_dblib_err *einfo = &H->err;
  34. pdo_dblib_stmt *S = NULL;
  35. char *message;
  36. char *msg;
  37. if (stmt) {
  38. S = (pdo_dblib_stmt*)stmt->driver_data;
  39. einfo = &S->err;
  40. }
  41. if (einfo->lastmsg) {
  42. msg = einfo->lastmsg;
  43. } else if (DBLIB_G(err).lastmsg) {
  44. msg = DBLIB_G(err).lastmsg;
  45. DBLIB_G(err).lastmsg = NULL;
  46. } else {
  47. msg = einfo->dberrstr;
  48. }
  49. /* don't return anything if there's nothing to return */
  50. if (msg == NULL && einfo->dberr == 0 && einfo->oserr == 0 && einfo->severity == 0) {
  51. return;
  52. }
  53. spprintf(&message, 0, "%s [%d] (severity %d) [%s]",
  54. msg, einfo->dberr, einfo->severity, stmt ? ZSTR_VAL(stmt->active_query_string) : "");
  55. add_next_index_long(info, einfo->dberr);
  56. add_next_index_string(info, message);
  57. efree(message);
  58. add_next_index_long(info, einfo->oserr);
  59. add_next_index_long(info, einfo->severity);
  60. if (einfo->oserrstr) {
  61. add_next_index_string(info, einfo->oserrstr);
  62. }
  63. }
  64. static void dblib_handle_closer(pdo_dbh_t *dbh)
  65. {
  66. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  67. if (H) {
  68. pdo_dblib_err_dtor(&H->err);
  69. if (H->link) {
  70. dbclose(H->link);
  71. H->link = NULL;
  72. }
  73. if (H->login) {
  74. dbfreelogin(H->login);
  75. H->login = NULL;
  76. }
  77. pefree(H, dbh->is_persistent);
  78. dbh->driver_data = NULL;
  79. }
  80. }
  81. static bool dblib_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, pdo_stmt_t *stmt, zval *driver_options)
  82. {
  83. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  84. pdo_dblib_stmt *S = ecalloc(1, sizeof(*S));
  85. S->H = H;
  86. stmt->driver_data = S;
  87. stmt->methods = &dblib_stmt_methods;
  88. stmt->supports_placeholders = PDO_PLACEHOLDER_NONE;
  89. S->computed_column_name_count = 0;
  90. S->err.sqlstate = stmt->error_code;
  91. return true;
  92. }
  93. static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const zend_string *sql)
  94. {
  95. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  96. RETCODE ret, resret;
  97. dbsetuserdata(H->link, (BYTE*)&H->err);
  98. if (FAIL == dbcmd(H->link, ZSTR_VAL(sql))) {
  99. return -1;
  100. }
  101. if (FAIL == dbsqlexec(H->link)) {
  102. return -1;
  103. }
  104. resret = dbresults(H->link);
  105. if (resret == FAIL) {
  106. return -1;
  107. }
  108. ret = dbnextrow(H->link);
  109. if (ret == FAIL) {
  110. return -1;
  111. }
  112. if (dbnumcols(H->link) <= 0) {
  113. return DBCOUNT(H->link);
  114. }
  115. /* throw away any rows it might have returned */
  116. dbcanquery(H->link);
  117. return DBCOUNT(H->link);
  118. }
  119. static zend_string* dblib_handle_quoter(pdo_dbh_t *dbh, const zend_string *unquoted, enum pdo_param_type paramtype)
  120. {
  121. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  122. bool use_national_character_set = 0;
  123. size_t i;
  124. char *q;
  125. size_t quotedlen = 0;
  126. zend_string *quoted_str;
  127. if (H->assume_national_character_set_strings) {
  128. use_national_character_set = 1;
  129. }
  130. if ((paramtype & PDO_PARAM_STR_NATL) == PDO_PARAM_STR_NATL) {
  131. use_national_character_set = 1;
  132. }
  133. if ((paramtype & PDO_PARAM_STR_CHAR) == PDO_PARAM_STR_CHAR) {
  134. use_national_character_set = 0;
  135. }
  136. /* Detect quoted length, adding extra char for doubled single quotes */
  137. for (i = 0; i < ZSTR_LEN(unquoted); i++) {
  138. if (ZSTR_VAL(unquoted)[i] == '\'') ++quotedlen;
  139. ++quotedlen;
  140. }
  141. quotedlen += 2; /* +2 for opening, closing quotes */
  142. if (use_national_character_set) {
  143. ++quotedlen; /* N prefix */
  144. }
  145. quoted_str = zend_string_alloc(quotedlen, 0);
  146. q = ZSTR_VAL(quoted_str);
  147. if (use_national_character_set) {
  148. *q++ = 'N';
  149. }
  150. *q++ = '\'';
  151. for (i = 0; i < ZSTR_LEN(unquoted); i++) {
  152. if (ZSTR_VAL(unquoted)[i] == '\'') {
  153. *q++ = '\'';
  154. *q++ = '\'';
  155. } else {
  156. *q++ = ZSTR_VAL(unquoted)[i];
  157. }
  158. }
  159. *q++ = '\'';
  160. *q = '\0';
  161. return quoted_str;
  162. }
  163. static bool pdo_dblib_transaction_cmd(const char *cmd, pdo_dbh_t *dbh)
  164. {
  165. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  166. if (FAIL == dbcmd(H->link, cmd)) {
  167. return false;
  168. }
  169. if (FAIL == dbsqlexec(H->link)) {
  170. return false;
  171. }
  172. return true;
  173. }
  174. static bool dblib_handle_begin(pdo_dbh_t *dbh)
  175. {
  176. return pdo_dblib_transaction_cmd("BEGIN TRANSACTION", dbh);
  177. }
  178. static bool dblib_handle_commit(pdo_dbh_t *dbh)
  179. {
  180. return pdo_dblib_transaction_cmd("COMMIT TRANSACTION", dbh);
  181. }
  182. static bool dblib_handle_rollback(pdo_dbh_t *dbh)
  183. {
  184. return pdo_dblib_transaction_cmd("ROLLBACK TRANSACTION", dbh);
  185. }
  186. zend_string *dblib_handle_last_id(pdo_dbh_t *dbh, const zend_string *name)
  187. {
  188. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  189. RETCODE ret;
  190. char *id = NULL;
  191. size_t len;
  192. zend_string *ret_id;
  193. /*
  194. * Would use scope_identity() but it's not implemented on Sybase
  195. */
  196. if (FAIL == dbcmd(H->link, "SELECT @@IDENTITY")) {
  197. return NULL;
  198. }
  199. if (FAIL == dbsqlexec(H->link)) {
  200. return NULL;
  201. }
  202. ret = dbresults(H->link);
  203. if (ret == FAIL || ret == NO_MORE_RESULTS) {
  204. dbcancel(H->link);
  205. return NULL;
  206. }
  207. ret = dbnextrow(H->link);
  208. if (ret == FAIL || ret == NO_MORE_ROWS) {
  209. dbcancel(H->link);
  210. return NULL;
  211. }
  212. if (dbdatlen(H->link, 1) == 0) {
  213. dbcancel(H->link);
  214. return NULL;
  215. }
  216. id = emalloc(32);
  217. len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
  218. dbcancel(H->link);
  219. ret_id = zend_string_init(id, len, 0);
  220. efree(id);
  221. return ret_id;
  222. }
  223. static bool dblib_set_attr(pdo_dbh_t *dbh, zend_long attr, zval *val)
  224. {
  225. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  226. zend_long lval;
  227. bool bval;
  228. switch(attr) {
  229. case PDO_ATTR_DEFAULT_STR_PARAM:
  230. if (!pdo_get_long_param(&lval, val)) {
  231. return false;
  232. }
  233. H->assume_national_character_set_strings = lval == PDO_PARAM_STR_NATL ? 1 : 0;
  234. return true;
  235. case PDO_ATTR_TIMEOUT:
  236. case PDO_DBLIB_ATTR_QUERY_TIMEOUT:
  237. if (!pdo_get_long_param(&lval, val)) {
  238. return false;
  239. }
  240. return SUCCEED == dbsettime(lval);
  241. case PDO_DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER:
  242. if (!pdo_get_long_param(&lval, val)) {
  243. return false;
  244. }
  245. H->stringify_uniqueidentifier = lval;
  246. return true;
  247. case PDO_DBLIB_ATTR_SKIP_EMPTY_ROWSETS:
  248. if (!pdo_get_bool_param(&bval, val)) {
  249. return false;
  250. }
  251. H->skip_empty_rowsets = bval;
  252. return true;
  253. case PDO_DBLIB_ATTR_DATETIME_CONVERT:
  254. if (!pdo_get_long_param(&lval, val)) {
  255. return false;
  256. }
  257. H->datetime_convert = lval;
  258. return true;
  259. default:
  260. return false;
  261. }
  262. }
  263. static void dblib_get_tds_version(zval *return_value, int tds)
  264. {
  265. switch (tds) {
  266. case DBTDS_2_0:
  267. ZVAL_STRING(return_value, "2.0");
  268. break;
  269. case DBTDS_3_4:
  270. ZVAL_STRING(return_value, "3.4");
  271. break;
  272. case DBTDS_4_0:
  273. ZVAL_STRING(return_value, "4.0");
  274. break;
  275. case DBTDS_4_2:
  276. ZVAL_STRING(return_value, "4.2");
  277. break;
  278. case DBTDS_4_6:
  279. ZVAL_STRING(return_value, "4.6");
  280. break;
  281. case DBTDS_4_9_5:
  282. ZVAL_STRING(return_value, "4.9.5");
  283. break;
  284. case DBTDS_5_0:
  285. ZVAL_STRING(return_value, "5.0");
  286. break;
  287. #ifdef DBTDS_7_0
  288. case DBTDS_7_0:
  289. ZVAL_STRING(return_value, "7.0");
  290. break;
  291. #endif
  292. #ifdef DBTDS_7_1
  293. case DBTDS_7_1:
  294. ZVAL_STRING(return_value, "7.1");
  295. break;
  296. #endif
  297. #ifdef DBTDS_7_2
  298. case DBTDS_7_2:
  299. ZVAL_STRING(return_value, "7.2");
  300. break;
  301. #endif
  302. #ifdef DBTDS_7_3
  303. case DBTDS_7_3:
  304. ZVAL_STRING(return_value, "7.3");
  305. break;
  306. #endif
  307. #ifdef DBTDS_7_4
  308. case DBTDS_7_4:
  309. ZVAL_STRING(return_value, "7.4");
  310. break;
  311. #endif
  312. default:
  313. ZVAL_FALSE(return_value);
  314. break;
  315. }
  316. }
  317. static int dblib_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *return_value)
  318. {
  319. pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data;
  320. switch (attr) {
  321. case PDO_ATTR_DEFAULT_STR_PARAM:
  322. ZVAL_LONG(return_value, H->assume_national_character_set_strings ? PDO_PARAM_STR_NATL : PDO_PARAM_STR_CHAR);
  323. break;
  324. case PDO_ATTR_EMULATE_PREPARES:
  325. /* this is the only option available, but expose it so common tests and whatever else can introspect */
  326. ZVAL_TRUE(return_value);
  327. break;
  328. case PDO_DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER:
  329. ZVAL_BOOL(return_value, H->stringify_uniqueidentifier);
  330. break;
  331. case PDO_DBLIB_ATTR_VERSION:
  332. ZVAL_STRING(return_value, dbversion());
  333. break;
  334. case PDO_DBLIB_ATTR_TDS_VERSION:
  335. dblib_get_tds_version(return_value, dbtds(H->link));
  336. break;
  337. case PDO_DBLIB_ATTR_SKIP_EMPTY_ROWSETS:
  338. ZVAL_BOOL(return_value, H->skip_empty_rowsets);
  339. break;
  340. case PDO_DBLIB_ATTR_DATETIME_CONVERT:
  341. ZVAL_BOOL(return_value, H->datetime_convert);
  342. break;
  343. default:
  344. return 0;
  345. }
  346. return 1;
  347. }
  348. static const struct pdo_dbh_methods dblib_methods = {
  349. dblib_handle_closer,
  350. dblib_handle_preparer,
  351. dblib_handle_doer,
  352. dblib_handle_quoter,
  353. dblib_handle_begin, /* begin */
  354. dblib_handle_commit, /* commit */
  355. dblib_handle_rollback, /* rollback */
  356. dblib_set_attr, /*set attr */
  357. dblib_handle_last_id, /* last insert id */
  358. dblib_fetch_error, /* fetch error */
  359. dblib_get_attribute, /* get attr */
  360. NULL, /* check liveness */
  361. NULL, /* get driver methods */
  362. NULL, /* request shutdown */
  363. NULL, /* in transaction, use PDO's internal tracking mechanism */
  364. NULL /* get gc */
  365. };
  366. static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
  367. {
  368. pdo_dblib_db_handle *H;
  369. int i, nvars, nvers, ret = 0;
  370. const pdo_dblib_keyval tdsver[] = {
  371. {"4.2",DBVERSION_42}
  372. ,{"4.6",DBVERSION_46}
  373. ,{"5.0",DBVERSION_70} /* FIXME: This does not work with Sybase, but environ will */
  374. ,{"6.0",DBVERSION_70}
  375. ,{"7.0",DBVERSION_70}
  376. #ifdef DBVERSION_71
  377. ,{"7.1",DBVERSION_71}
  378. #endif
  379. #ifdef DBVERSION_72
  380. ,{"7.2",DBVERSION_72}
  381. ,{"8.0",DBVERSION_72}
  382. #endif
  383. #ifdef DBVERSION_73
  384. ,{"7.3",DBVERSION_73}
  385. #endif
  386. #ifdef DBVERSION_74
  387. ,{"7.4",DBVERSION_74}
  388. #endif
  389. ,{"10.0",DBVERSION_100}
  390. ,{"auto",0} /* Only works with FreeTDS. Other drivers will bork */
  391. };
  392. struct pdo_data_src_parser vars[] = {
  393. { "charset", NULL, 0 }
  394. ,{ "appname", "PHP " PDO_DBLIB_FLAVOUR, 0 }
  395. ,{ "host", "127.0.0.1", 0 }
  396. ,{ "dbname", NULL, 0 }
  397. ,{ "secure", NULL, 0 } /* DBSETLSECURE */
  398. ,{ "version", NULL, 0 } /* DBSETLVERSION */
  399. ,{ "user", NULL, 0 }
  400. ,{ "password", NULL, 0 }
  401. };
  402. nvars = sizeof(vars)/sizeof(vars[0]);
  403. nvers = sizeof(tdsver)/sizeof(tdsver[0]);
  404. php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, nvars);
  405. H = pecalloc(1, sizeof(*H), dbh->is_persistent);
  406. H->login = dblogin();
  407. H->err.sqlstate = dbh->error_code;
  408. H->assume_national_character_set_strings = 0;
  409. H->stringify_uniqueidentifier = 0;
  410. H->skip_empty_rowsets = 0;
  411. H->datetime_convert = 0;
  412. if (!H->login) {
  413. goto cleanup;
  414. }
  415. if (driver_options) {
  416. int connect_timeout = pdo_attr_lval(driver_options, PDO_DBLIB_ATTR_CONNECTION_TIMEOUT, -1);
  417. int query_timeout = pdo_attr_lval(driver_options, PDO_DBLIB_ATTR_QUERY_TIMEOUT, -1);
  418. int timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30);
  419. if (connect_timeout == -1) {
  420. connect_timeout = timeout;
  421. }
  422. if (query_timeout == -1) {
  423. query_timeout = timeout;
  424. }
  425. dbsetlogintime(connect_timeout); /* Connection/Login Timeout */
  426. dbsettime(query_timeout); /* Statement Timeout */
  427. H->assume_national_character_set_strings = pdo_attr_lval(driver_options, PDO_ATTR_DEFAULT_STR_PARAM, 0) == PDO_PARAM_STR_NATL ? 1 : 0;
  428. H->stringify_uniqueidentifier = pdo_attr_lval(driver_options, PDO_DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER, 0);
  429. H->skip_empty_rowsets = pdo_attr_lval(driver_options, PDO_DBLIB_ATTR_SKIP_EMPTY_ROWSETS, 0);
  430. H->datetime_convert = pdo_attr_lval(driver_options, PDO_DBLIB_ATTR_DATETIME_CONVERT, 0);
  431. }
  432. DBERRHANDLE(H->login, (EHANDLEFUNC) pdo_dblib_error_handler);
  433. DBMSGHANDLE(H->login, (MHANDLEFUNC) pdo_dblib_msg_handler);
  434. if(vars[5].optval) {
  435. for(i=0;i<nvers;i++) {
  436. if(strcmp(vars[5].optval,tdsver[i].key) == 0) {
  437. if(FAIL==dbsetlversion(H->login, tdsver[i].value)) {
  438. pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Failed to set version specified in connection string.");
  439. goto cleanup;
  440. }
  441. break;
  442. }
  443. }
  444. if (i==nvers) {
  445. printf("Invalid version '%s'\n", vars[5].optval);
  446. pdo_raise_impl_error(dbh, NULL, "HY000", "PDO_DBLIB: Invalid version specified in connection string.");
  447. goto cleanup; /* unknown version specified */
  448. }
  449. }
  450. if (!dbh->username && vars[6].optval) {
  451. dbh->username = pestrdup(vars[6].optval, dbh->is_persistent);
  452. }
  453. if (dbh->username) {
  454. if(FAIL == DBSETLUSER(H->login, dbh->username)) {
  455. goto cleanup;
  456. }
  457. }
  458. if (!dbh->password && vars[7].optval) {
  459. dbh->password = pestrdup(vars[7].optval, dbh->is_persistent);
  460. }
  461. if (dbh->password) {
  462. if(FAIL == DBSETLPWD(H->login, dbh->password)) {
  463. goto cleanup;
  464. }
  465. }
  466. #ifndef PHP_DBLIB_IS_MSSQL
  467. if (vars[0].optval) {
  468. DBSETLCHARSET(H->login, vars[0].optval);
  469. }
  470. #endif
  471. DBSETLAPP(H->login, vars[1].optval);
  472. /* DBSETLDBNAME is only available in FreeTDS 0.92 or above */
  473. #ifdef DBSETLDBNAME
  474. if (vars[3].optval) {
  475. if(FAIL == DBSETLDBNAME(H->login, vars[3].optval)) goto cleanup;
  476. }
  477. #endif
  478. H->link = dbopen(H->login, vars[2].optval);
  479. if (!H->link) {
  480. goto cleanup;
  481. }
  482. /*
  483. * FreeTDS < 0.92 does not support the DBSETLDBNAME option
  484. * Send use database here after login (Will not work with SQL Azure)
  485. */
  486. #ifndef DBSETLDBNAME
  487. if (vars[3].optval) {
  488. if(FAIL == dbuse(H->link, vars[3].optval)) goto cleanup;
  489. }
  490. #endif
  491. #ifdef PHP_DBLIB_IS_MSSQL
  492. /* dblib do not return more than this length from text/image */
  493. DBSETOPT(H->link, DBTEXTLIMIT, "2147483647");
  494. #endif
  495. /* limit text/image from network */
  496. DBSETOPT(H->link, DBTEXTSIZE, "2147483647");
  497. /* allow double quoted indentifiers */
  498. DBSETOPT(H->link, DBQUOTEDIDENT, "1");
  499. ret = 1;
  500. dbh->max_escaped_char_length = 2;
  501. dbh->alloc_own_columns = 1;
  502. cleanup:
  503. for (i = 0; i < nvars; i++) {
  504. if (vars[i].freeme) {
  505. efree(vars[i].optval);
  506. }
  507. }
  508. dbh->methods = &dblib_methods;
  509. dbh->driver_data = H;
  510. if (!ret) {
  511. zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr,
  512. "SQLSTATE[%s] %s (severity %d)",
  513. DBLIB_G(err).sqlstate,
  514. DBLIB_G(err).dberrstr,
  515. DBLIB_G(err).severity);
  516. }
  517. return ret;
  518. }
  519. const pdo_driver_t pdo_dblib_driver = {
  520. #ifdef PDO_DBLIB_IS_MSSQL
  521. PDO_DRIVER_HEADER(mssql),
  522. #elif defined(PHP_WIN32)
  523. #define PDO_DBLIB_IS_SYBASE
  524. PDO_DRIVER_HEADER(sybase),
  525. #else
  526. PDO_DRIVER_HEADER(dblib),
  527. #endif
  528. pdo_dblib_handle_factory
  529. };