@@ -27,7 +27,7 @@ private function Add(int $paramIndex, $value, string $type, $length = NULL): voi
2727 * @param type $value
2828 * @param type $length
2929 */
30- public function setString (int $ paramIndex , string $ value , $ length = NULL ): void
30+ public function setString (int $ paramIndex , ? string $ value , $ length = NULL ): void
3131 {
3232 $ this ->Add ($ paramIndex , $ value , "s " , $ length );
3333 }
@@ -38,7 +38,7 @@ public function setString(int $paramIndex, string $value, $length = NULL): void
3838 * @param type $value
3939 * @param type $length
4040 */
41- public function setInteger (int $ paramIndex , int $ value , $ length = NULL ): void
41+ public function setInteger (int $ paramIndex , ? int $ value , $ length = NULL ): void
4242 {
4343 $ this ->Add ($ paramIndex , $ value , "i " , $ length );
4444 }
@@ -49,7 +49,7 @@ public function setInteger(int $paramIndex, int $value, $length = NULL): void
4949 * @param type $value
5050 * @param type $length
5151 */
52- public function setDouble (int $ paramIndex , float $ value , $ length = NULL ): void
52+ public function setDouble (int $ paramIndex , ? float $ value , $ length = NULL ): void
5353 {
5454 $ this ->Add ($ paramIndex , $ value , "d " , $ length );
5555 }
@@ -65,6 +65,21 @@ public function setBlob(int $paramIndex, $value, $length = NULL): void
6565 $ this ->Add ($ paramIndex , $ value , "b " , $ length );
6666 }
6767
68+ /**
69+ * Adds or sets the current time measured in the number of seconds
70+ * since the Unix Epoch (January 1 1970 00:00:00 GMT).
71+ * This method should be used with DateTime MySql variables.
72+ * @param int $paramIndex
73+ * @param int $secondsSinceUnixEpoch is the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
74+ * @param type $length
75+ * @return void
76+ */
77+ public function setDateTime (int $ paramIndex , ?int $ secondsSinceUnixEpoch ): void
78+ {
79+ $ datetime = ($ secondsSinceUnixEpoch != null ) ? date ("Y-m-d H:i:s " , $ secondsSinceUnixEpoch ) : null ;
80+ $ this ->Add ($ paramIndex , $ datetime , "s " , NULL );
81+ }
82+
6883 /**
6984 * Remove all parameters
7085 */
@@ -77,7 +92,6 @@ public function getParameters(): array
7792 {
7893 return $ this ->fParameters ;
7994 }
80-
8195}
8296
8397?>
0 commit comments