13
13
| license@php.net so we can mail you a copy immediately. |
14
14
+----------------------------------------------------------------------+
15
15
| Authors: Danny Heijl <Danny.Heijl@cevi.be> : initial cut (ODS 7.2x) |
16
+ | PHP4 port |
16
17
| Christian Cartus <chc@idgruppe.de> : blobs, and IUS 9 |
17
18
| Jouni Ahto <jah@mork.net> : configuration stuff |
18
19
| Based on the MySQL code by: Zeev Suraski <zeev@php.net> |
25
26
* you a very short one
26
27
* -------------------------------------------------------------------
27
28
*/
28
- /*
29
- * I started with the mysql-driver, removed all stuff I did not need,
30
- * and changed all mysql-specific stuff to Informix-ESQL/C.
31
- * I used the X-open way of using ESQL/C (using an SQL descriptor and
32
- * not the Informix-specific way). It is perhaps a little bit slower,
33
- * but more verbose and less prone to coding errors.
34
- * This is the first time in my life I coded ESQL/C, so do not look too
35
- * closely and do not hesitate to point out errors/omissions etc...
36
- * Aug. 8, 1998
37
- * Danny Heijl, Danny.Heijl@cevi.be
38
- */
39
29
40
30
/* TODO:
41
31
*
42
32
* ? Safe mode implementation
43
- *
44
- * Jouni Ahto promised help and already did the configuration stuff
45
- * (Jouni Ahto <jah@mork.net>).
46
- *
47
33
*/
48
34
49
35
50
- /*
51
- Changes: 23.8.1998 (chc@idgruppe.de)
52
- - full blobsupport (TEXT and BYTE)
53
- - new functions: ifx_create_blob, ifx_copy_blob, ifx_free_blob,
54
- ifx_update_blob, ifx_get_blob, ifx_blobinfile_mode
55
- - file and memory-support of blobs
56
- - load TEXT and BYTE in memory by default
57
- (controllable by "ifx.blobinfile" in php3.ini-file)
58
- - update all functions to support blobs (ifx_query, ifx_prepare,
59
- ifx_do, ifx_htmltbl_result, ifx_fetch_row)
60
- - minor bug-fixes
61
- - Test-Page (informix_blob.php3) which tests the blob-support
62
-
63
-
64
- Changes: 11.9.1998 (chc@idgruppe.de)
65
- - ifx_query and ifx_prepare: blob-paramters now as array
66
- - new funtions: ifx_textasvarchar, ifx_byteasvarchar, ifx_nullformat
67
- - new php.ini-variables: ifx.textasvarchar, ifx.byteasvarchar, ifx.nullformat
68
- - update all functions to support blobarray and new functions
69
- (ifx_query, ifx_prepare, ifx_do, ifx_htmltbl_result, ifx_fetch_row)
70
- - minor bug-fixes
71
- - Test-Page (informix_blob.php3) updated
72
- - begin with coding of slob-support
73
- (still deactivated, not yet complete: #undef HAVE_IFX_IUS in php3_ifx.h)
74
- - ifx_fetch_row returns always a blob-id (contains "NULL"-flag or content from db)
75
- (except ifx_textasvarchar, ifx_byteasvarchar set to 1)
76
-
77
- Changes 14.9.1998 (chc@idgruppe.de)
78
- - supports now IUS- serial8,int8,boolean, nchar, nvchar, lvarchar
79
- - still incomplete slob-support
80
-
81
- Changes 25.9.1998 (danny.heijl@cevi.be)
82
- - cursory and non-cursory stored procedures
83
-
84
- Changes 24.10.1998 (chc@idgruppe.de)
85
- - changes the internal structure of IFX_BLOB and IFX_SLOB into one structure.
86
- it is now prepared for general-id-usage.
87
- - fixed a lvarchar-bug (i hate esql/c)
88
-
89
- Changes 12.11.1998 (danny.heijl@cevi.be)
90
- - added proto comments
91
-
92
- Changes 04/03/1999 (danny.heijl@cevi.be)
93
- - added "SET CONNECTION" statement to ifx_fetch_row() so that you can now
94
- fetch rows from different databases simultaneously
95
- (ifx_query() & ifx_prepare() were already OK).
96
-
97
- Changes 05/03/1999 (danny.heijl@cevi.be)
98
- - made all sqlerrd[] fields of sqlca structure available
99
- with ifx_getsqlca($query_id) in a pseudo-row after a
100
- prepare (select statements) or insert/update (non-select statements).
101
- gives access to affected rows and serial insert values
102
- - made all internal functions static
103
-
104
-
105
- Changes 09/03/1999 (danny.heijl@cevi.be)
106
- - suppressed ESQL/C BLOB memory leak fix for ESQL/C 7.24 and higher
107
- this is the same fix as in Perl DBD::Informix
108
- - really free an Ifx_Result now, do not wait for script termination
109
- - code cleanup
110
-
111
- */
112
-
113
-
114
36
#if defined(COMPILE_DL)
115
37
#include " dl/phpdl.h"
116
38
#endif
@@ -250,7 +172,7 @@ php3_module_entry ifx_module_entry = {
250
172
STANDARD_MODULE_PROPERTIES
251
173
};
252
174
253
- #if COMPILE_DL
175
+ #ifdef COMPILE_DL
254
176
DLEXPORT php3_module_entry *get_module (void ) { return &ifx_module_entry; }
255
177
#if 0
256
178
BOOL WINAPI DllMain(HANDLE hModule,
@@ -393,74 +315,47 @@ char *a_result_id;
393
315
return ;
394
316
}
395
317
318
+
319
+ PHP_INI_BEGIN ()
320
+ STD_PHP_INI_ENTRY(" ifx.allow_persistent" , " 1" , PHP_INI_SYSTEM,
321
+ OnUpdateInt, allow_persistent, php_ifx_globals, ifx_globals)
322
+ STD_PHP_INI_ENTRY(" ifx.max_persistent" , " 0" , PHP_INI_SYSTEM,
323
+ OnUpdateInt, max_persistent, php_ifx_globals, ifx_globals)
324
+ STD_PHP_INI_ENTRY(" ifx.max_links" , " 0" , PHP_INI_SYSTEM,
325
+ OnUpdateInt, max_links, php_ifx_globals, ifx_globals)
326
+ STD_PHP_INI_ENTRY(" ifx.default_host" , NULL , PHP_INI_SYSTEM,
327
+ OnUpdateString, default_host, php_ifx_globals, ifx_globals)
328
+ STD_PHP_INI_ENTRY(" ifx.default_user" , NULL , PHP_INI_SYSTEM,
329
+ OnUpdateString, default_user, php_ifx_globals, ifx_globals)
330
+ STD_PHP_INI_ENTRY(" ifx.default_password" , NULL , PHP_INI_SYSTEM,
331
+ OnUpdateString, default_password, php_ifx_globals, ifx_globals)
332
+ STD_PHP_INI_ENTRY(" ifx.blobinfile" , " 1" , PHP_INI_ALL,
333
+ OnUpdateInt, blobinfile, php_ifx_globals, ifx_globals)
334
+ STD_PHP_INI_ENTRY(" ifx.textasvarchar" , " 0" , PHP_INI_ALL,
335
+ OnUpdateInt, textasvarchar, php_ifx_globals, ifx_globals)
336
+ STD_PHP_INI_ENTRY(" ifx.byteasvarchar" , " 0" , PHP_INI_ALL,
337
+ OnUpdateInt, byteasvarchar, php_ifx_globals, ifx_globals)
338
+ STD_PHP_INI_ENTRY(" ifx.charasvarchar" , " 0" , PHP_INI_ALL,
339
+ OnUpdateInt, charasvarchar, php_ifx_globals, ifx_globals)
340
+ STD_PHP_INI_ENTRY(" ifx.nullformat" , " 0" , PHP_INI_ALL,
341
+ OnUpdateInt, nullformat, php_ifx_globals, ifx_globals)
342
+ PHP_INI_END()
343
+
396
344
int php3_minit_ifx(INIT_FUNC_ARGS)
397
345
{
398
346
#ifdef ZTS
399
- ifx_globals_id = ts_allocate_id (sizeof (php_ifx_globals), php_ifx_init_globals, NULL );
347
+ ifx_globals_id = ts_allocate_id (sizeof (php_ifx_globals), php_ifx_init_globals, NULL );
400
348
#else
401
- IFXG (num_persistent)=0 ;
349
+ IFXG (num_persistent)=0 ;
402
350
#endif
403
351
404
-
405
- if (cfg_get_long (" ifx.blobinfile" ,
406
- &IFXG (blobinfile))==FAILURE) {
407
- IFXG (blobinfile)=BLOBINFILE;
408
- }
409
-
410
- if (cfg_get_long (" ifx.textasvarchar" ,
411
- &IFXG (textasvarchar))==FAILURE) {
412
- IFXG (textasvarchar)=0 ;
413
- }
414
-
415
-
416
- if (cfg_get_long (" ifx.byteasvarchar" ,
417
- &IFXG (byteasvarchar))==FAILURE) {
418
- IFXG (byteasvarchar)=0 ;
419
- }
420
-
421
- if (cfg_get_long (" ifx.charasvarchar" ,
422
- &IFXG (charasvarchar))==FAILURE) {
423
- IFXG (charasvarchar)=0 ;
424
- }
425
-
426
- if (cfg_get_long (" ifx.nullformat" ,
427
- &IFXG (nullformat))==FAILURE) {
428
- IFXG (nullformat)=0 ;
429
- }
352
+ REGISTER_INI_ENTRIES ();
430
353
431
354
IFXG (nullvalue) = malloc (1 );
432
355
IFXG (nullvalue)[0 ] = 0 ;
433
356
IFXG (nullstring) = malloc (5 );
434
357
strcpy (IFXG (nullstring), " NULL" );
435
358
436
- if (cfg_get_long (" ifx.allow_persistent" ,
437
- &IFXG (allow_persistent))==FAILURE) {
438
- IFXG (allow_persistent)=1 ;
439
- }
440
- if (cfg_get_long (" ifx.max_persistent" ,
441
- &IFXG (max_persistent))==FAILURE) {
442
- IFXG (max_persistent)=-1 ;
443
- }
444
- if (cfg_get_long (" ifx.max_links" ,
445
- &IFXG (max_links))==FAILURE) {
446
- IFXG (max_links)=-1 ;
447
- }
448
- if (cfg_get_string (" ifx.default_host" ,
449
- &IFXG (default_host))==FAILURE
450
- || IFXG (default_host)[0 ]==0 ) {
451
- IFXG (default_host)=NULL ;
452
- }
453
- if (cfg_get_string (" ifx.default_user" ,
454
- &IFXG (default_user))==FAILURE
455
- || IFXG (default_user)[0 ]==0 ) {
456
- IFXG (default_user)=NULL ;
457
- }
458
- if (cfg_get_string (" ifx.default_password" ,
459
- &IFXG (default_password))==FAILURE
460
- || IFXG (default_password)[0 ]==0 ) {
461
- IFXG (default_password)=NULL ;
462
- }
463
-
464
359
IFXG (num_persistent)=0 ;
465
360
IFXG (sv_sqlcode)=0 ;
466
361
@@ -475,6 +370,7 @@ int php3_minit_ifx(INIT_FUNC_ARGS)
475
370
IFXG(le_link),
476
371
IFXG(le_plink));
477
372
#endif
373
+
478
374
ifx_module_entry.type = type;
479
375
480
376
REGISTER_LONG_CONSTANT (" IFX_SCROLL" , IFX_SCROLL, CONST_CS | CONST_PERSISTENT);
@@ -494,6 +390,7 @@ $endif;
494
390
495
391
int php3_mshutdown_ifx (SHUTDOWN_FUNC_ARGS){
496
392
393
+ UNREGISTER_INI_ENTRIES ();
497
394
return SUCCESS;
498
395
499
396
}
@@ -531,22 +428,11 @@ void php3_info_ifx(ZEND_MODULE_INFO_FUNC_ARGS)
531
428
" <tr><td>Persistent links:</td><td>%d /%s </td></tr>\n "
532
429
" <tr><td>Total links:</td><td>%d /%s </td></tr>\n "
533
430
" <tr><td>Client API version:</td><td>%02.2f </td></tr>\n "
534
- #if !(WIN32|WINNT)
535
- " <tr><td valign=\" top\" >Compilation definitions:</td><td>"
536
- " <tt>IFX_INCLUDE=%s <br>\n "
537
- " IFX_LFLAGS=%s <br>\n "
538
- " IFX_LIBS=%s <br></tt></td></tr>"
539
- #endif
540
431
" </table>\n " ,
541
432
(IFXG (allow_persistent)?" Yes" :" No" ),
542
433
IFXG (num_persistent),maxp,
543
434
IFXG (num_links),maxl,
544
435
(double )(CLIENT_SQLI_VER/100.0 )
545
- #if !(WIN32|WINNT)
546
- ,PHP_IFX_INCLUDE,
547
- PHP_IFX_LFLAGS,
548
- PHP_IFX_LIBS
549
- #endif
550
436
);
551
437
}
552
438
0 commit comments