Database
[ ]
[ ]
[ ]
[ ]
[ ]
Source for file identifiers.php
Documentation is available at identifiers.php
1. <?php
2. /**
3. * File containing the ezcDbMssqlOption class
4. *
5. * @package Database
6. * @version 1.4
7. * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
8. * @license http://ez.no/licenses/new_bsd New BSD License
9. */
10. /**
11. * Class containing the options for MS SQL Server connections
12. *
13. * @property int $quoteIdentifier
14. * Mode of quoting identifiers.
15. *
16. * @package Database
17. * @version 1.4
18. */
19. class ezcDbMssqlOptions extends ezcBaseOptions
20. {
21. /**
22. * Constant represents mode of identifiers quoting that compliant to SQL92.
23. * Sets QUOTED_IDENTIFIERS ON for MS SQL Server connection.
24. * and treats double quotes as quoting characters for identifiers.
25. *
26. * @access public
27. */
28. const QUOTES_COMPLIANT = 0;
29.
30. /**
31. * Constant represents mode of identifiers quoting that
32. * corresponds to QUOTE_IDENTIFIERS OFF for MS SQL Server connection.
33. * Sets QUOTED_IDENTIFIERS to OFF
34. * and treats '[' and ']' as quoting characters for identifiers.
35. *
36. * @access public
37. */
38. const QUOTES_LEGACY = 1;
39.
40. /**
41. * Recommended ( and default ) mode for identifiers quoting.
42. * Gets current QUOTED_IDENTIFIERS value for MS SQL Server
43. * connection and changes ezcDbMssqlHandler's quoting identifier characters
44. * correspondently if it's necessary. QUOTED_IDENTIFIERS value
45. * for connection will not be changed.
46. *
47. * @access public
48. */
49. const QUOTES_GUESS = 2;
50.
51.
52. /**
53. * Constant represents mode of identifiers quoting that not
54. * touch any settings related to quoting identifiers.
55. * Could be used for minimizing amount of requests
56. * to MS SQL Server and for optimization.
57. *
58. *
59. * @access public
60. */
61. const QUOTES_UNTOUCHED = 3;
62.
63.
64. /**
65. * Creates an ezcDbMssqlOptions object with default option values.
66. *
67. * @param array $options
68. */
69. public function __construct( array $options = array() )
70. {
71. $this->quoteIdentifier = self::QUOTES_GUESS;
72.
73. parent::__construct( $options );
74. }
75.
76. /**
77. * Set an option value
78. *
79. * @param string $propertyName
80. * @param mixed $propertyValue
81. * @throws ezcBasePropertyNotFoundException
82. * If a property is not defined in this class
83. * @throws ezcBaseValueException
84. * If a property is out of range
85. * @ignore
86. */
87. public function __set( $propertyName, $propertyValue )
88. {
89. switch ( $propertyName )
90. {
91. case 'quoteIdentifier':
92. if ( !is_numeric( $propertyValue ) ||
93. ( ( $propertyValue != self::QUOTES_COMPLIANT ) &&
94. ( $propertyValue != self::QUOTES_LEGACY ) &&
95. ( $propertyValue != self::QUOTES_GUESS ) &&
96. ( $propertyValue != self::QUOTES_UNTOUCHED )
97. )
98. )
99. {
100. throw new ezcBaseValueException( $propertyName, $propertyValue,
101. 'one of ezcDbMssqlOptions::QUOTES_COMPLIANT, QUOTES_LEGACY, QUOTES_GUESS, QUOTES_UNTOUCHED constants' );
102. }
103.
104. $this->quoteIdentifier = (int) $propertyValue;
105. break;
106. default:
107. throw new ezcBasePropertyNotFoundException( $propertyName );
108. break;
109. }
110. }
111. }
112.
113. ?>
Last updated: Wed, 18 Jun 2008