00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "onphp.h"
00013 #include "onphp_core.h"
00014
00015 #include "zend_globals.h"
00016 #include "zend_exceptions.h"
00017
00018 #include "core/Exceptions.h"
00019 #include "core/DB/ImaginaryDialect.h"
00020 #include "core/OSQL/QueryIdentification.h"
00021
00022 ONPHP_METHOD(QueryIdentification, getId)
00023 {
00024 zval *out, *hashed;
00025
00026 zend_call_method_with_0_params(
00027 &getThis(),
00028 Z_OBJCE_P(getThis()),
00029 NULL,
00030 "tostring",
00031 &out
00032 );
00033
00034 if (EG(exception)) {
00035 return;
00036 }
00037
00038 zend_call_method_with_1_params(
00039 NULL,
00040 NULL,
00041 NULL,
00042 "sha1",
00043 &hashed,
00044 out
00045 );
00046
00047 ZVAL_FREE(out);
00048
00049 if (EG(exception)) {
00050 return;
00051 }
00052
00053 RETURN_ZVAL(hashed, 1, 1);
00054 }
00055
00056 ONPHP_METHOD(QueryIdentification, toString)
00057 {
00058 zval *out, *imdi;
00059
00060 zend_call_method_with_0_params(
00061 NULL,
00062 onphp_ce_ImaginaryDialect,
00063 NULL,
00064 "me",
00065 &imdi
00066 );
00067
00068 if (EG(exception)) {
00069 return;
00070 }
00071
00072 zend_call_method_with_1_params(
00073 &getThis(),
00074 Z_OBJCE_P(getThis()),
00075 NULL,
00076 "todialectstring",
00077 &out,
00078 imdi
00079 );
00080
00081 ZVAL_FREE(imdi);
00082
00083 if (EG(exception)) {
00084 return;
00085 }
00086
00087 RETURN_ZVAL(out, 1, 1);
00088 }
00089
00090 ONPHP_METHOD(QueryIdentification, setId)
00091 {
00092 zend_throw_exception_ex(
00093 onphp_ce_UnsupportedMethodException,
00094 0 TSRMLS_CC,
00095 NULL
00096 );
00097 }
00098
00099 static ONPHP_ARGINFO_ONE;
00100
00101 zend_function_entry onphp_funcs_QueryIdentification[] = {
00102 ONPHP_ME(QueryIdentification, getId, NULL, ZEND_ACC_PUBLIC)
00103 ONPHP_ME(QueryIdentification, setId, arginfo_one, ZEND_ACC_FINAL | ZEND_ACC_PUBLIC)
00104 ONPHP_ME(QueryIdentification, toString, NULL, ZEND_ACC_PUBLIC)
00105 {NULL, NULL, NULL}
00106 };