Source for file GenericSQLQuery.class.php

Documentation is available at GenericSQLQuery.class.php

  1. <?php
  2. /**
  3. * @package harmoni.dbc
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: GenericSQLQuery.class.php,v 1.9 2007/09/05 21:38:59 adamfranco Exp $
  9. */
  10. require_once("GenericSQLQuery.interface.php");
  11.  
  12.  
  13. /**
  14. * A GenericSQLQuery provides a way to specify the SQL string manually. Use this
  15. * query type to execute queries not available through the other Query
  16. * objects (for example, data-definition queries).
  17. *
  18. *
  19. * @package harmoni.dbc
  20. *
  21. * @copyright Copyright &copy; 2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  23. *
  24. * @version $Id: GenericSQLQuery.class.php,v 1.9 2007/09/05 21:38:59 adamfranco Exp $
  25. */
  26.  
  27. class GenericSQLQuery
  28. extends QueryAbstract
  29. implements GenericSQLQueryInterface
  30. {
  31.  
  32.  
  33. /**
  34. * Stores all the SQL queries.
  35. * @var array _sql
  36. * @access private
  37. */
  38. var $_sql;
  39. /**
  40. * This is the constructor for a GenericSQLQuery object.
  41. * @access public
  42. */
  43. function GenericSQLQuery($sql=null) {
  44. $this->reset();
  45. if ($sql)
  46. $this->addSQLQuery($sql);
  47. }
  48.  
  49. /**
  50. * Adds one SQL string to this query.
  51. * @access public
  52. * @param string sql One SQL string,
  53. * @return void
  54. */
  55. function addSQLQuery($sql) {
  56. // ** parameter validation
  57. $stringRule = StringValidatorRule::getRule();
  58. ArgumentValidator::validate($sql, $stringRule, true);
  59. // ** end of parameter validation
  60.  
  61. $this->_sql[] = $sql;
  62. }
  63.  
  64. /**
  65. * Resets the query.
  66. * @access public
  67. */
  68. function reset() {
  69. parent::reset();
  70.  
  71. // an UPDATE query
  72. $this->_type = GENERIC;
  73.  
  74. // default query configuration:
  75. // no table to insert into
  76. $this->_sql = array();
  77. }
  78.  
  79.  
  80. }
  81. ?>

Documentation generated on Wed, 19 Sep 2007 10:23:22 -0400 by phpDocumentor 1.3.0RC3