QueryIdentification.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2007 by Konstantin V. Arkhipov                     *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU Lesser General Public License as        *
00006  *   published by the Free Software Foundation; either version 3 of the    *
00007  *   License, or (at your option) any later version.                       *
00008  *                                                                         *
00009  ***************************************************************************/
00010 /* $Id: QueryIdentification.c 4687 2007-12-09 18:57:18Z voxus $ */
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 };

Generated on Sun Dec 9 21:56:23 2007 for onPHP by  doxygen 1.5.4