BaseCcShowHostsPeer.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366
  1. <?php
  2. /**
  3. * Base static class for performing query and update operations on the 'cc_show_hosts' table.
  4. *
  5. *
  6. *
  7. * @package propel.generator.airtime.om
  8. */
  9. abstract class BaseCcShowHostsPeer {
  10. /** the default database name for this class */
  11. const DATABASE_NAME = 'airtime';
  12. /** the table name for this class */
  13. const TABLE_NAME = 'cc_show_hosts';
  14. /** the related Propel class for this table */
  15. const OM_CLASS = 'CcShowHosts';
  16. /** A class that can be returned by this peer. */
  17. const CLASS_DEFAULT = 'airtime.CcShowHosts';
  18. /** the related TableMap class for this table */
  19. const TM_CLASS = 'CcShowHostsTableMap';
  20. /** The total number of columns. */
  21. const NUM_COLUMNS = 3;
  22. /** The number of lazy-loaded columns. */
  23. const NUM_LAZY_LOAD_COLUMNS = 0;
  24. /** the column name for the ID field */
  25. const ID = 'cc_show_hosts.ID';
  26. /** the column name for the SHOW_ID field */
  27. const SHOW_ID = 'cc_show_hosts.SHOW_ID';
  28. /** the column name for the SUBJS_ID field */
  29. const SUBJS_ID = 'cc_show_hosts.SUBJS_ID';
  30. /**
  31. * An identiy map to hold any loaded instances of CcShowHosts objects.
  32. * This must be public so that other peer classes can access this when hydrating from JOIN
  33. * queries.
  34. * @var array CcShowHosts[]
  35. */
  36. public static $instances = array();
  37. /**
  38. * holds an array of fieldnames
  39. *
  40. * first dimension keys are the type constants
  41. * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
  42. */
  43. private static $fieldNames = array (
  44. BasePeer::TYPE_PHPNAME => array ('DbId', 'DbShow', 'DbHost', ),
  45. BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbShow', 'dbHost', ),
  46. BasePeer::TYPE_COLNAME => array (self::ID, self::SHOW_ID, self::SUBJS_ID, ),
  47. BasePeer::TYPE_RAW_COLNAME => array ('ID', 'SHOW_ID', 'SUBJS_ID', ),
  48. BasePeer::TYPE_FIELDNAME => array ('id', 'show_id', 'subjs_id', ),
  49. BasePeer::TYPE_NUM => array (0, 1, 2, )
  50. );
  51. /**
  52. * holds an array of keys for quick access to the fieldnames array
  53. *
  54. * first dimension keys are the type constants
  55. * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
  56. */
  57. private static $fieldKeys = array (
  58. BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbShow' => 1, 'DbHost' => 2, ),
  59. BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbShow' => 1, 'dbHost' => 2, ),
  60. BasePeer::TYPE_COLNAME => array (self::ID => 0, self::SHOW_ID => 1, self::SUBJS_ID => 2, ),
  61. BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'SHOW_ID' => 1, 'SUBJS_ID' => 2, ),
  62. BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'show_id' => 1, 'subjs_id' => 2, ),
  63. BasePeer::TYPE_NUM => array (0, 1, 2, )
  64. );
  65. /**
  66. * Translates a fieldname to another type
  67. *
  68. * @param string $name field name
  69. * @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  70. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  71. * @param string $toType One of the class type constants
  72. * @return string translated name of the field.
  73. * @throws PropelException - if the specified name could not be found in the fieldname mappings.
  74. */
  75. static public function translateFieldName($name, $fromType, $toType)
  76. {
  77. $toNames = self::getFieldNames($toType);
  78. $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
  79. if ($key === null) {
  80. throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
  81. }
  82. return $toNames[$key];
  83. }
  84. /**
  85. * Returns an array of field names.
  86. *
  87. * @param string $type The type of fieldnames to return:
  88. * One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  89. * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
  90. * @return array A list of field names
  91. */
  92. static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
  93. {
  94. if (!array_key_exists($type, self::$fieldNames)) {
  95. throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
  96. }
  97. return self::$fieldNames[$type];
  98. }
  99. /**
  100. * Convenience method which changes table.column to alias.column.
  101. *
  102. * Using this method you can maintain SQL abstraction while using column aliases.
  103. * <code>
  104. * $c->addAlias("alias1", TablePeer::TABLE_NAME);
  105. * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
  106. * </code>
  107. * @param string $alias The alias for the current table.
  108. * @param string $column The column name for current table. (i.e. CcShowHostsPeer::COLUMN_NAME).
  109. * @return string
  110. */
  111. public static function alias($alias, $column)
  112. {
  113. return str_replace(CcShowHostsPeer::TABLE_NAME.'.', $alias.'.', $column);
  114. }
  115. /**
  116. * Add all the columns needed to create a new object.
  117. *
  118. * Note: any columns that were marked with lazyLoad="true" in the
  119. * XML schema will not be added to the select list and only loaded
  120. * on demand.
  121. *
  122. * @param Criteria $criteria object containing the columns to add.
  123. * @param string $alias optional table alias
  124. * @throws PropelException Any exceptions caught during processing will be
  125. * rethrown wrapped into a PropelException.
  126. */
  127. public static function addSelectColumns(Criteria $criteria, $alias = null)
  128. {
  129. if (null === $alias) {
  130. $criteria->addSelectColumn(CcShowHostsPeer::ID);
  131. $criteria->addSelectColumn(CcShowHostsPeer::SHOW_ID);
  132. $criteria->addSelectColumn(CcShowHostsPeer::SUBJS_ID);
  133. } else {
  134. $criteria->addSelectColumn($alias . '.ID');
  135. $criteria->addSelectColumn($alias . '.SHOW_ID');
  136. $criteria->addSelectColumn($alias . '.SUBJS_ID');
  137. }
  138. }
  139. /**
  140. * Returns the number of rows matching criteria.
  141. *
  142. * @param Criteria $criteria
  143. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  144. * @param PropelPDO $con
  145. * @return int Number of matching rows.
  146. */
  147. public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
  148. {
  149. // we may modify criteria, so copy it first
  150. $criteria = clone $criteria;
  151. // We need to set the primary table name, since in the case that there are no WHERE columns
  152. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  153. // tables go into the FROM clause.
  154. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  155. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  156. $criteria->setDistinct();
  157. }
  158. if (!$criteria->hasSelectClause()) {
  159. CcShowHostsPeer::addSelectColumns($criteria);
  160. }
  161. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  162. $criteria->setDbName(self::DATABASE_NAME); // Set the correct dbName
  163. if ($con === null) {
  164. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  165. }
  166. // BasePeer returns a PDOStatement
  167. $stmt = BasePeer::doCount($criteria, $con);
  168. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  169. $count = (int) $row[0];
  170. } else {
  171. $count = 0; // no rows returned; we infer that means 0 matches.
  172. }
  173. $stmt->closeCursor();
  174. return $count;
  175. }
  176. /**
  177. * Method to select one object from the DB.
  178. *
  179. * @param Criteria $criteria object used to create the SELECT statement.
  180. * @param PropelPDO $con
  181. * @return CcShowHosts
  182. * @throws PropelException Any exceptions caught during processing will be
  183. * rethrown wrapped into a PropelException.
  184. */
  185. public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
  186. {
  187. $critcopy = clone $criteria;
  188. $critcopy->setLimit(1);
  189. $objects = CcShowHostsPeer::doSelect($critcopy, $con);
  190. if ($objects) {
  191. return $objects[0];
  192. }
  193. return null;
  194. }
  195. /**
  196. * Method to do selects.
  197. *
  198. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  199. * @param PropelPDO $con
  200. * @return array Array of selected Objects
  201. * @throws PropelException Any exceptions caught during processing will be
  202. * rethrown wrapped into a PropelException.
  203. */
  204. public static function doSelect(Criteria $criteria, PropelPDO $con = null)
  205. {
  206. return CcShowHostsPeer::populateObjects(CcShowHostsPeer::doSelectStmt($criteria, $con));
  207. }
  208. /**
  209. * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
  210. *
  211. * Use this method directly if you want to work with an executed statement durirectly (for example
  212. * to perform your own object hydration).
  213. *
  214. * @param Criteria $criteria The Criteria object used to build the SELECT statement.
  215. * @param PropelPDO $con The connection to use
  216. * @throws PropelException Any exceptions caught during processing will be
  217. * rethrown wrapped into a PropelException.
  218. * @return PDOStatement The executed PDOStatement object.
  219. * @see BasePeer::doSelect()
  220. */
  221. public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
  222. {
  223. if ($con === null) {
  224. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  225. }
  226. if (!$criteria->hasSelectClause()) {
  227. $criteria = clone $criteria;
  228. CcShowHostsPeer::addSelectColumns($criteria);
  229. }
  230. // Set the correct dbName
  231. $criteria->setDbName(self::DATABASE_NAME);
  232. // BasePeer returns a PDOStatement
  233. return BasePeer::doSelect($criteria, $con);
  234. }
  235. /**
  236. * Adds an object to the instance pool.
  237. *
  238. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  239. * from the database. In some cases -- especially when you override doSelect*()
  240. * methods in your stub classes -- you may need to explicitly add objects
  241. * to the cache in order to ensure that the same objects are always returned by doSelect*()
  242. * and retrieveByPK*() calls.
  243. *
  244. * @param CcShowHosts $value A CcShowHosts object.
  245. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  246. */
  247. public static function addInstanceToPool(CcShowHosts $obj, $key = null)
  248. {
  249. if (Propel::isInstancePoolingEnabled()) {
  250. if ($key === null) {
  251. $key = (string) $obj->getDbId();
  252. } // if key === null
  253. self::$instances[$key] = $obj;
  254. }
  255. }
  256. /**
  257. * Removes an object from the instance pool.
  258. *
  259. * Propel keeps cached copies of objects in an instance pool when they are retrieved
  260. * from the database. In some cases -- especially when you override doDelete
  261. * methods in your stub classes -- you may need to explicitly remove objects
  262. * from the cache in order to prevent returning objects that no longer exist.
  263. *
  264. * @param mixed $value A CcShowHosts object or a primary key value.
  265. */
  266. public static function removeInstanceFromPool($value)
  267. {
  268. if (Propel::isInstancePoolingEnabled() && $value !== null) {
  269. if (is_object($value) && $value instanceof CcShowHosts) {
  270. $key = (string) $value->getDbId();
  271. } elseif (is_scalar($value)) {
  272. // assume we've been passed a primary key
  273. $key = (string) $value;
  274. } else {
  275. $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or CcShowHosts object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
  276. throw $e;
  277. }
  278. unset(self::$instances[$key]);
  279. }
  280. } // removeInstanceFromPool()
  281. /**
  282. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  283. *
  284. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  285. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  286. *
  287. * @param string $key The key (@see getPrimaryKeyHash()) for this instance.
  288. * @return CcShowHosts Found object or NULL if 1) no instance exists for specified key or 2) instance pooling has been disabled.
  289. * @see getPrimaryKeyHash()
  290. */
  291. public static function getInstanceFromPool($key)
  292. {
  293. if (Propel::isInstancePoolingEnabled()) {
  294. if (isset(self::$instances[$key])) {
  295. return self::$instances[$key];
  296. }
  297. }
  298. return null; // just to be explicit
  299. }
  300. /**
  301. * Clear the instance pool.
  302. *
  303. * @return void
  304. */
  305. public static function clearInstancePool()
  306. {
  307. self::$instances = array();
  308. }
  309. /**
  310. * Method to invalidate the instance pool of all tables related to cc_show_hosts
  311. * by a foreign key with ON DELETE CASCADE
  312. */
  313. public static function clearRelatedInstancePool()
  314. {
  315. }
  316. /**
  317. * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
  318. *
  319. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  320. * a multi-column primary key, a serialize()d version of the primary key will be returned.
  321. *
  322. * @param array $row PropelPDO resultset row.
  323. * @param int $startcol The 0-based offset for reading from the resultset row.
  324. * @return string A string version of PK or NULL if the components of primary key in result array are all null.
  325. */
  326. public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
  327. {
  328. // If the PK cannot be derived from the row, return NULL.
  329. if ($row[$startcol] === null) {
  330. return null;
  331. }
  332. return (string) $row[$startcol];
  333. }
  334. /**
  335. * Retrieves the primary key from the DB resultset row
  336. * For tables with a single-column primary key, that simple pkey value will be returned. For tables with
  337. * a multi-column primary key, an array of the primary key columns will be returned.
  338. *
  339. * @param array $row PropelPDO resultset row.
  340. * @param int $startcol The 0-based offset for reading from the resultset row.
  341. * @return mixed The primary key of the row
  342. */
  343. public static function getPrimaryKeyFromRow($row, $startcol = 0)
  344. {
  345. return (int) $row[$startcol];
  346. }
  347. /**
  348. * The returned array will contain objects of the default type or
  349. * objects that inherit from the default.
  350. *
  351. * @throws PropelException Any exceptions caught during processing will be
  352. * rethrown wrapped into a PropelException.
  353. */
  354. public static function populateObjects(PDOStatement $stmt)
  355. {
  356. $results = array();
  357. // set the class once to avoid overhead in the loop
  358. $cls = CcShowHostsPeer::getOMClass(false);
  359. // populate the object(s)
  360. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  361. $key = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  362. if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool($key))) {
  363. // We no longer rehydrate the object, since this can cause data loss.
  364. // See http://www.propelorm.org/ticket/509
  365. // $obj->hydrate($row, 0, true); // rehydrate
  366. $results[] = $obj;
  367. } else {
  368. $obj = new $cls();
  369. $obj->hydrate($row);
  370. $results[] = $obj;
  371. CcShowHostsPeer::addInstanceToPool($obj, $key);
  372. } // if key exists
  373. }
  374. $stmt->closeCursor();
  375. return $results;
  376. }
  377. /**
  378. * Populates an object of the default type or an object that inherit from the default.
  379. *
  380. * @param array $row PropelPDO resultset row.
  381. * @param int $startcol The 0-based offset for reading from the resultset row.
  382. * @throws PropelException Any exceptions caught during processing will be
  383. * rethrown wrapped into a PropelException.
  384. * @return array (CcShowHosts object, last column rank)
  385. */
  386. public static function populateObject($row, $startcol = 0)
  387. {
  388. $key = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, $startcol);
  389. if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool($key))) {
  390. // We no longer rehydrate the object, since this can cause data loss.
  391. // See http://www.propelorm.org/ticket/509
  392. // $obj->hydrate($row, $startcol, true); // rehydrate
  393. $col = $startcol + CcShowHostsPeer::NUM_COLUMNS;
  394. } else {
  395. $cls = CcShowHostsPeer::OM_CLASS;
  396. $obj = new $cls();
  397. $col = $obj->hydrate($row, $startcol);
  398. CcShowHostsPeer::addInstanceToPool($obj, $key);
  399. }
  400. return array($obj, $col);
  401. }
  402. /**
  403. * Returns the number of rows matching criteria, joining the related CcShow table
  404. *
  405. * @param Criteria $criteria
  406. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  407. * @param PropelPDO $con
  408. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  409. * @return int Number of matching rows.
  410. */
  411. public static function doCountJoinCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  412. {
  413. // we're going to modify criteria, so copy it first
  414. $criteria = clone $criteria;
  415. // We need to set the primary table name, since in the case that there are no WHERE columns
  416. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  417. // tables go into the FROM clause.
  418. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  419. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  420. $criteria->setDistinct();
  421. }
  422. if (!$criteria->hasSelectClause()) {
  423. CcShowHostsPeer::addSelectColumns($criteria);
  424. }
  425. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  426. // Set the correct dbName
  427. $criteria->setDbName(self::DATABASE_NAME);
  428. if ($con === null) {
  429. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  430. }
  431. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  432. $stmt = BasePeer::doCount($criteria, $con);
  433. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  434. $count = (int) $row[0];
  435. } else {
  436. $count = 0; // no rows returned; we infer that means 0 matches.
  437. }
  438. $stmt->closeCursor();
  439. return $count;
  440. }
  441. /**
  442. * Returns the number of rows matching criteria, joining the related CcSubjs table
  443. *
  444. * @param Criteria $criteria
  445. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  446. * @param PropelPDO $con
  447. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  448. * @return int Number of matching rows.
  449. */
  450. public static function doCountJoinCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  451. {
  452. // we're going to modify criteria, so copy it first
  453. $criteria = clone $criteria;
  454. // We need to set the primary table name, since in the case that there are no WHERE columns
  455. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  456. // tables go into the FROM clause.
  457. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  458. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  459. $criteria->setDistinct();
  460. }
  461. if (!$criteria->hasSelectClause()) {
  462. CcShowHostsPeer::addSelectColumns($criteria);
  463. }
  464. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  465. // Set the correct dbName
  466. $criteria->setDbName(self::DATABASE_NAME);
  467. if ($con === null) {
  468. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  469. }
  470. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  471. $stmt = BasePeer::doCount($criteria, $con);
  472. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  473. $count = (int) $row[0];
  474. } else {
  475. $count = 0; // no rows returned; we infer that means 0 matches.
  476. }
  477. $stmt->closeCursor();
  478. return $count;
  479. }
  480. /**
  481. * Selects a collection of CcShowHosts objects pre-filled with their CcShow objects.
  482. * @param Criteria $criteria
  483. * @param PropelPDO $con
  484. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  485. * @return array Array of CcShowHosts objects.
  486. * @throws PropelException Any exceptions caught during processing will be
  487. * rethrown wrapped into a PropelException.
  488. */
  489. public static function doSelectJoinCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  490. {
  491. $criteria = clone $criteria;
  492. // Set the correct dbName if it has not been overridden
  493. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  494. $criteria->setDbName(self::DATABASE_NAME);
  495. }
  496. CcShowHostsPeer::addSelectColumns($criteria);
  497. $startcol = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS);
  498. CcShowPeer::addSelectColumns($criteria);
  499. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  500. $stmt = BasePeer::doSelect($criteria, $con);
  501. $results = array();
  502. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  503. $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  504. if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) {
  505. // We no longer rehydrate the object, since this can cause data loss.
  506. // See http://www.propelorm.org/ticket/509
  507. // $obj1->hydrate($row, 0, true); // rehydrate
  508. } else {
  509. $cls = CcShowHostsPeer::getOMClass(false);
  510. $obj1 = new $cls();
  511. $obj1->hydrate($row);
  512. CcShowHostsPeer::addInstanceToPool($obj1, $key1);
  513. } // if $obj1 already loaded
  514. $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol);
  515. if ($key2 !== null) {
  516. $obj2 = CcShowPeer::getInstanceFromPool($key2);
  517. if (!$obj2) {
  518. $cls = CcShowPeer::getOMClass(false);
  519. $obj2 = new $cls();
  520. $obj2->hydrate($row, $startcol);
  521. CcShowPeer::addInstanceToPool($obj2, $key2);
  522. } // if obj2 already loaded
  523. // Add the $obj1 (CcShowHosts) to $obj2 (CcShow)
  524. $obj2->addCcShowHosts($obj1);
  525. } // if joined row was not null
  526. $results[] = $obj1;
  527. }
  528. $stmt->closeCursor();
  529. return $results;
  530. }
  531. /**
  532. * Selects a collection of CcShowHosts objects pre-filled with their CcSubjs objects.
  533. * @param Criteria $criteria
  534. * @param PropelPDO $con
  535. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  536. * @return array Array of CcShowHosts objects.
  537. * @throws PropelException Any exceptions caught during processing will be
  538. * rethrown wrapped into a PropelException.
  539. */
  540. public static function doSelectJoinCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  541. {
  542. $criteria = clone $criteria;
  543. // Set the correct dbName if it has not been overridden
  544. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  545. $criteria->setDbName(self::DATABASE_NAME);
  546. }
  547. CcShowHostsPeer::addSelectColumns($criteria);
  548. $startcol = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS);
  549. CcSubjsPeer::addSelectColumns($criteria);
  550. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  551. $stmt = BasePeer::doSelect($criteria, $con);
  552. $results = array();
  553. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  554. $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  555. if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) {
  556. // We no longer rehydrate the object, since this can cause data loss.
  557. // See http://www.propelorm.org/ticket/509
  558. // $obj1->hydrate($row, 0, true); // rehydrate
  559. } else {
  560. $cls = CcShowHostsPeer::getOMClass(false);
  561. $obj1 = new $cls();
  562. $obj1->hydrate($row);
  563. CcShowHostsPeer::addInstanceToPool($obj1, $key1);
  564. } // if $obj1 already loaded
  565. $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol);
  566. if ($key2 !== null) {
  567. $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
  568. if (!$obj2) {
  569. $cls = CcSubjsPeer::getOMClass(false);
  570. $obj2 = new $cls();
  571. $obj2->hydrate($row, $startcol);
  572. CcSubjsPeer::addInstanceToPool($obj2, $key2);
  573. } // if obj2 already loaded
  574. // Add the $obj1 (CcShowHosts) to $obj2 (CcSubjs)
  575. $obj2->addCcShowHosts($obj1);
  576. } // if joined row was not null
  577. $results[] = $obj1;
  578. }
  579. $stmt->closeCursor();
  580. return $results;
  581. }
  582. /**
  583. * Returns the number of rows matching criteria, joining all related tables
  584. *
  585. * @param Criteria $criteria
  586. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  587. * @param PropelPDO $con
  588. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  589. * @return int Number of matching rows.
  590. */
  591. public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  592. {
  593. // we're going to modify criteria, so copy it first
  594. $criteria = clone $criteria;
  595. // We need to set the primary table name, since in the case that there are no WHERE columns
  596. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  597. // tables go into the FROM clause.
  598. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  599. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  600. $criteria->setDistinct();
  601. }
  602. if (!$criteria->hasSelectClause()) {
  603. CcShowHostsPeer::addSelectColumns($criteria);
  604. }
  605. $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
  606. // Set the correct dbName
  607. $criteria->setDbName(self::DATABASE_NAME);
  608. if ($con === null) {
  609. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  610. }
  611. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  612. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  613. $stmt = BasePeer::doCount($criteria, $con);
  614. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  615. $count = (int) $row[0];
  616. } else {
  617. $count = 0; // no rows returned; we infer that means 0 matches.
  618. }
  619. $stmt->closeCursor();
  620. return $count;
  621. }
  622. /**
  623. * Selects a collection of CcShowHosts objects pre-filled with all related objects.
  624. *
  625. * @param Criteria $criteria
  626. * @param PropelPDO $con
  627. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  628. * @return array Array of CcShowHosts objects.
  629. * @throws PropelException Any exceptions caught during processing will be
  630. * rethrown wrapped into a PropelException.
  631. */
  632. public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  633. {
  634. $criteria = clone $criteria;
  635. // Set the correct dbName if it has not been overridden
  636. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  637. $criteria->setDbName(self::DATABASE_NAME);
  638. }
  639. CcShowHostsPeer::addSelectColumns($criteria);
  640. $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS);
  641. CcShowPeer::addSelectColumns($criteria);
  642. $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS);
  643. CcSubjsPeer::addSelectColumns($criteria);
  644. $startcol4 = $startcol3 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
  645. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  646. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  647. $stmt = BasePeer::doSelect($criteria, $con);
  648. $results = array();
  649. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  650. $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  651. if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) {
  652. // We no longer rehydrate the object, since this can cause data loss.
  653. // See http://www.propelorm.org/ticket/509
  654. // $obj1->hydrate($row, 0, true); // rehydrate
  655. } else {
  656. $cls = CcShowHostsPeer::getOMClass(false);
  657. $obj1 = new $cls();
  658. $obj1->hydrate($row);
  659. CcShowHostsPeer::addInstanceToPool($obj1, $key1);
  660. } // if obj1 already loaded
  661. // Add objects for joined CcShow rows
  662. $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  663. if ($key2 !== null) {
  664. $obj2 = CcShowPeer::getInstanceFromPool($key2);
  665. if (!$obj2) {
  666. $cls = CcShowPeer::getOMClass(false);
  667. $obj2 = new $cls();
  668. $obj2->hydrate($row, $startcol2);
  669. CcShowPeer::addInstanceToPool($obj2, $key2);
  670. } // if obj2 loaded
  671. // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcShow)
  672. $obj2->addCcShowHosts($obj1);
  673. } // if joined row not null
  674. // Add objects for joined CcSubjs rows
  675. $key3 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol3);
  676. if ($key3 !== null) {
  677. $obj3 = CcSubjsPeer::getInstanceFromPool($key3);
  678. if (!$obj3) {
  679. $cls = CcSubjsPeer::getOMClass(false);
  680. $obj3 = new $cls();
  681. $obj3->hydrate($row, $startcol3);
  682. CcSubjsPeer::addInstanceToPool($obj3, $key3);
  683. } // if obj3 loaded
  684. // Add the $obj1 (CcShowHosts) to the collection in $obj3 (CcSubjs)
  685. $obj3->addCcShowHosts($obj1);
  686. } // if joined row not null
  687. $results[] = $obj1;
  688. }
  689. $stmt->closeCursor();
  690. return $results;
  691. }
  692. /**
  693. * Returns the number of rows matching criteria, joining the related CcShow table
  694. *
  695. * @param Criteria $criteria
  696. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  697. * @param PropelPDO $con
  698. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  699. * @return int Number of matching rows.
  700. */
  701. public static function doCountJoinAllExceptCcShow(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  702. {
  703. // we're going to modify criteria, so copy it first
  704. $criteria = clone $criteria;
  705. // We need to set the primary table name, since in the case that there are no WHERE columns
  706. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  707. // tables go into the FROM clause.
  708. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  709. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  710. $criteria->setDistinct();
  711. }
  712. if (!$criteria->hasSelectClause()) {
  713. CcShowHostsPeer::addSelectColumns($criteria);
  714. }
  715. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  716. // Set the correct dbName
  717. $criteria->setDbName(self::DATABASE_NAME);
  718. if ($con === null) {
  719. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  720. }
  721. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  722. $stmt = BasePeer::doCount($criteria, $con);
  723. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  724. $count = (int) $row[0];
  725. } else {
  726. $count = 0; // no rows returned; we infer that means 0 matches.
  727. }
  728. $stmt->closeCursor();
  729. return $count;
  730. }
  731. /**
  732. * Returns the number of rows matching criteria, joining the related CcSubjs table
  733. *
  734. * @param Criteria $criteria
  735. * @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
  736. * @param PropelPDO $con
  737. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  738. * @return int Number of matching rows.
  739. */
  740. public static function doCountJoinAllExceptCcSubjs(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
  741. {
  742. // we're going to modify criteria, so copy it first
  743. $criteria = clone $criteria;
  744. // We need to set the primary table name, since in the case that there are no WHERE columns
  745. // it will be impossible for the BasePeer::createSelectSql() method to determine which
  746. // tables go into the FROM clause.
  747. $criteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  748. if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
  749. $criteria->setDistinct();
  750. }
  751. if (!$criteria->hasSelectClause()) {
  752. CcShowHostsPeer::addSelectColumns($criteria);
  753. }
  754. $criteria->clearOrderByColumns(); // ORDER BY should not affect count
  755. // Set the correct dbName
  756. $criteria->setDbName(self::DATABASE_NAME);
  757. if ($con === null) {
  758. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  759. }
  760. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  761. $stmt = BasePeer::doCount($criteria, $con);
  762. if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  763. $count = (int) $row[0];
  764. } else {
  765. $count = 0; // no rows returned; we infer that means 0 matches.
  766. }
  767. $stmt->closeCursor();
  768. return $count;
  769. }
  770. /**
  771. * Selects a collection of CcShowHosts objects pre-filled with all related objects except CcShow.
  772. *
  773. * @param Criteria $criteria
  774. * @param PropelPDO $con
  775. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  776. * @return array Array of CcShowHosts objects.
  777. * @throws PropelException Any exceptions caught during processing will be
  778. * rethrown wrapped into a PropelException.
  779. */
  780. public static function doSelectJoinAllExceptCcShow(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  781. {
  782. $criteria = clone $criteria;
  783. // Set the correct dbName if it has not been overridden
  784. // $criteria->getDbName() will return the same object if not set to another value
  785. // so == check is okay and faster
  786. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  787. $criteria->setDbName(self::DATABASE_NAME);
  788. }
  789. CcShowHostsPeer::addSelectColumns($criteria);
  790. $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS);
  791. CcSubjsPeer::addSelectColumns($criteria);
  792. $startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
  793. $criteria->addJoin(CcShowHostsPeer::SUBJS_ID, CcSubjsPeer::ID, $join_behavior);
  794. $stmt = BasePeer::doSelect($criteria, $con);
  795. $results = array();
  796. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  797. $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  798. if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) {
  799. // We no longer rehydrate the object, since this can cause data loss.
  800. // See http://www.propelorm.org/ticket/509
  801. // $obj1->hydrate($row, 0, true); // rehydrate
  802. } else {
  803. $cls = CcShowHostsPeer::getOMClass(false);
  804. $obj1 = new $cls();
  805. $obj1->hydrate($row);
  806. CcShowHostsPeer::addInstanceToPool($obj1, $key1);
  807. } // if obj1 already loaded
  808. // Add objects for joined CcSubjs rows
  809. $key2 = CcSubjsPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  810. if ($key2 !== null) {
  811. $obj2 = CcSubjsPeer::getInstanceFromPool($key2);
  812. if (!$obj2) {
  813. $cls = CcSubjsPeer::getOMClass(false);
  814. $obj2 = new $cls();
  815. $obj2->hydrate($row, $startcol2);
  816. CcSubjsPeer::addInstanceToPool($obj2, $key2);
  817. } // if $obj2 already loaded
  818. // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcSubjs)
  819. $obj2->addCcShowHosts($obj1);
  820. } // if joined row is not null
  821. $results[] = $obj1;
  822. }
  823. $stmt->closeCursor();
  824. return $results;
  825. }
  826. /**
  827. * Selects a collection of CcShowHosts objects pre-filled with all related objects except CcSubjs.
  828. *
  829. * @param Criteria $criteria
  830. * @param PropelPDO $con
  831. * @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  832. * @return array Array of CcShowHosts objects.
  833. * @throws PropelException Any exceptions caught during processing will be
  834. * rethrown wrapped into a PropelException.
  835. */
  836. public static function doSelectJoinAllExceptCcSubjs(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
  837. {
  838. $criteria = clone $criteria;
  839. // Set the correct dbName if it has not been overridden
  840. // $criteria->getDbName() will return the same object if not set to another value
  841. // so == check is okay and faster
  842. if ($criteria->getDbName() == Propel::getDefaultDB()) {
  843. $criteria->setDbName(self::DATABASE_NAME);
  844. }
  845. CcShowHostsPeer::addSelectColumns($criteria);
  846. $startcol2 = (CcShowHostsPeer::NUM_COLUMNS - CcShowHostsPeer::NUM_LAZY_LOAD_COLUMNS);
  847. CcShowPeer::addSelectColumns($criteria);
  848. $startcol3 = $startcol2 + (CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS);
  849. $criteria->addJoin(CcShowHostsPeer::SHOW_ID, CcShowPeer::ID, $join_behavior);
  850. $stmt = BasePeer::doSelect($criteria, $con);
  851. $results = array();
  852. while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
  853. $key1 = CcShowHostsPeer::getPrimaryKeyHashFromRow($row, 0);
  854. if (null !== ($obj1 = CcShowHostsPeer::getInstanceFromPool($key1))) {
  855. // We no longer rehydrate the object, since this can cause data loss.
  856. // See http://www.propelorm.org/ticket/509
  857. // $obj1->hydrate($row, 0, true); // rehydrate
  858. } else {
  859. $cls = CcShowHostsPeer::getOMClass(false);
  860. $obj1 = new $cls();
  861. $obj1->hydrate($row);
  862. CcShowHostsPeer::addInstanceToPool($obj1, $key1);
  863. } // if obj1 already loaded
  864. // Add objects for joined CcShow rows
  865. $key2 = CcShowPeer::getPrimaryKeyHashFromRow($row, $startcol2);
  866. if ($key2 !== null) {
  867. $obj2 = CcShowPeer::getInstanceFromPool($key2);
  868. if (!$obj2) {
  869. $cls = CcShowPeer::getOMClass(false);
  870. $obj2 = new $cls();
  871. $obj2->hydrate($row, $startcol2);
  872. CcShowPeer::addInstanceToPool($obj2, $key2);
  873. } // if $obj2 already loaded
  874. // Add the $obj1 (CcShowHosts) to the collection in $obj2 (CcShow)
  875. $obj2->addCcShowHosts($obj1);
  876. } // if joined row is not null
  877. $results[] = $obj1;
  878. }
  879. $stmt->closeCursor();
  880. return $results;
  881. }
  882. /**
  883. * Returns the TableMap related to this peer.
  884. * This method is not needed for general use but a specific application could have a need.
  885. * @return TableMap
  886. * @throws PropelException Any exceptions caught during processing will be
  887. * rethrown wrapped into a PropelException.
  888. */
  889. public static function getTableMap()
  890. {
  891. return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
  892. }
  893. /**
  894. * Add a TableMap instance to the database for this peer class.
  895. */
  896. public static function buildTableMap()
  897. {
  898. $dbMap = Propel::getDatabaseMap(BaseCcShowHostsPeer::DATABASE_NAME);
  899. if (!$dbMap->hasTable(BaseCcShowHostsPeer::TABLE_NAME))
  900. {
  901. $dbMap->addTableObject(new CcShowHostsTableMap());
  902. }
  903. }
  904. /**
  905. * The class that the Peer will make instances of.
  906. *
  907. * If $withPrefix is true, the returned path
  908. * uses a dot-path notation which is tranalted into a path
  909. * relative to a location on the PHP include_path.
  910. * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
  911. *
  912. * @param boolean $withPrefix Whether or not to return the path with the class name
  913. * @return string path.to.ClassName
  914. */
  915. public static function getOMClass($withPrefix = true)
  916. {
  917. return $withPrefix ? CcShowHostsPeer::CLASS_DEFAULT : CcShowHostsPeer::OM_CLASS;
  918. }
  919. /**
  920. * Method perform an INSERT on the database, given a CcShowHosts or Criteria object.
  921. *
  922. * @param mixed $values Criteria or CcShowHosts object containing data that is used to create the INSERT statement.
  923. * @param PropelPDO $con the PropelPDO connection to use
  924. * @return mixed The new primary key.
  925. * @throws PropelException Any exceptions caught during processing will be
  926. * rethrown wrapped into a PropelException.
  927. */
  928. public static function doInsert($values, PropelPDO $con = null)
  929. {
  930. if ($con === null) {
  931. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  932. }
  933. if ($values instanceof Criteria) {
  934. $criteria = clone $values; // rename for clarity
  935. } else {
  936. $criteria = $values->buildCriteria(); // build Criteria from CcShowHosts object
  937. }
  938. if ($criteria->containsKey(CcShowHostsPeer::ID) && $criteria->keyContainsValue(CcShowHostsPeer::ID) ) {
  939. throw new PropelException('Cannot insert a value for auto-increment primary key ('.CcShowHostsPeer::ID.')');
  940. }
  941. // Set the correct dbName
  942. $criteria->setDbName(self::DATABASE_NAME);
  943. try {
  944. // use transaction because $criteria could contain info
  945. // for more than one table (I guess, conceivably)
  946. $con->beginTransaction();
  947. $pk = BasePeer::doInsert($criteria, $con);
  948. $con->commit();
  949. } catch(PropelException $e) {
  950. $con->rollBack();
  951. throw $e;
  952. }
  953. return $pk;
  954. }
  955. /**
  956. * Method perform an UPDATE on the database, given a CcShowHosts or Criteria object.
  957. *
  958. * @param mixed $values Criteria or CcShowHosts object containing data that is used to create the UPDATE statement.
  959. * @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
  960. * @return int The number of affected rows (if supported by underlying database driver).
  961. * @throws PropelException Any exceptions caught during processing will be
  962. * rethrown wrapped into a PropelException.
  963. */
  964. public static function doUpdate($values, PropelPDO $con = null)
  965. {
  966. if ($con === null) {
  967. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  968. }
  969. $selectCriteria = new Criteria(self::DATABASE_NAME);
  970. if ($values instanceof Criteria) {
  971. $criteria = clone $values; // rename for clarity
  972. $comparison = $criteria->getComparison(CcShowHostsPeer::ID);
  973. $value = $criteria->remove(CcShowHostsPeer::ID);
  974. if ($value) {
  975. $selectCriteria->add(CcShowHostsPeer::ID, $value, $comparison);
  976. } else {
  977. $selectCriteria->setPrimaryTableName(CcShowHostsPeer::TABLE_NAME);
  978. }
  979. } else { // $values is CcShowHosts object
  980. $criteria = $values->buildCriteria(); // gets full criteria
  981. $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
  982. }
  983. // set the correct dbName
  984. $criteria->setDbName(self::DATABASE_NAME);
  985. return BasePeer::doUpdate($selectCriteria, $criteria, $con);
  986. }
  987. /**
  988. * Method to DELETE all rows from the cc_show_hosts table.
  989. *
  990. * @return int The number of affected rows (if supported by underlying database driver).
  991. */
  992. public static function doDeleteAll($con = null)
  993. {
  994. if ($con === null) {
  995. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  996. }
  997. $affectedRows = 0; // initialize var to track total num of affected rows
  998. try {
  999. // use transaction because $criteria could contain info
  1000. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1001. $con->beginTransaction();
  1002. $affectedRows += BasePeer::doDeleteAll(CcShowHostsPeer::TABLE_NAME, $con, CcShowHostsPeer::DATABASE_NAME);
  1003. // Because this db requires some delete cascade/set null emulation, we have to
  1004. // clear the cached instance *after* the emulation has happened (since
  1005. // instances get re-added by the select statement contained therein).
  1006. CcShowHostsPeer::clearInstancePool();
  1007. CcShowHostsPeer::clearRelatedInstancePool();
  1008. $con->commit();
  1009. return $affectedRows;
  1010. } catch (PropelException $e) {
  1011. $con->rollBack();
  1012. throw $e;
  1013. }
  1014. }
  1015. /**
  1016. * Method perform a DELETE on the database, given a CcShowHosts or Criteria object OR a primary key value.
  1017. *
  1018. * @param mixed $values Criteria or CcShowHosts object or primary key or array of primary keys
  1019. * which is used to create the DELETE statement
  1020. * @param PropelPDO $con the connection to use
  1021. * @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
  1022. * if supported by native driver or if emulated using Propel.
  1023. * @throws PropelException Any exceptions caught during processing will be
  1024. * rethrown wrapped into a PropelException.
  1025. */
  1026. public static function doDelete($values, PropelPDO $con = null)
  1027. {
  1028. if ($con === null) {
  1029. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
  1030. }
  1031. if ($values instanceof Criteria) {
  1032. // invalidate the cache for all objects of this type, since we have no
  1033. // way of knowing (without running a query) what objects should be invalidated
  1034. // from the cache based on this Criteria.
  1035. CcShowHostsPeer::clearInstancePool();
  1036. // rename for clarity
  1037. $criteria = clone $values;
  1038. } elseif ($values instanceof CcShowHosts) { // it's a model object
  1039. // invalidate the cache for this single object
  1040. CcShowHostsPeer::removeInstanceFromPool($values);
  1041. // create criteria based on pk values
  1042. $criteria = $values->buildPkeyCriteria();
  1043. } else { // it's a primary key, or an array of pks
  1044. $criteria = new Criteria(self::DATABASE_NAME);
  1045. $criteria->add(CcShowHostsPeer::ID, (array) $values, Criteria::IN);
  1046. // invalidate the cache for this object(s)
  1047. foreach ((array) $values as $singleval) {
  1048. CcShowHostsPeer::removeInstanceFromPool($singleval);
  1049. }
  1050. }
  1051. // Set the correct dbName
  1052. $criteria->setDbName(self::DATABASE_NAME);
  1053. $affectedRows = 0; // initialize var to track total num of affected rows
  1054. try {
  1055. // use transaction because $criteria could contain info
  1056. // for more than one table or we could emulating ON DELETE CASCADE, etc.
  1057. $con->beginTransaction();
  1058. $affectedRows += BasePeer::doDelete($criteria, $con);
  1059. CcShowHostsPeer::clearRelatedInstancePool();
  1060. $con->commit();
  1061. return $affectedRows;
  1062. } catch (PropelException $e) {
  1063. $con->rollBack();
  1064. throw $e;
  1065. }
  1066. }
  1067. /**
  1068. * Validates all modified columns of given CcShowHosts object.
  1069. * If parameter $columns is either a single column name or an array of column names
  1070. * than only those columns are validated.
  1071. *
  1072. * NOTICE: This does not apply to primary or foreign keys for now.
  1073. *
  1074. * @param CcShowHosts $obj The object to validate.
  1075. * @param mixed $cols Column name or array of column names.
  1076. *
  1077. * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
  1078. */
  1079. public static function doValidate(CcShowHosts $obj, $cols = null)
  1080. {
  1081. $columns = array();
  1082. if ($cols) {
  1083. $dbMap = Propel::getDatabaseMap(CcShowHostsPeer::DATABASE_NAME);
  1084. $tableMap = $dbMap->getTable(CcShowHostsPeer::TABLE_NAME);
  1085. if (! is_array($cols)) {
  1086. $cols = array($cols);
  1087. }
  1088. foreach ($cols as $colName) {
  1089. if ($tableMap->containsColumn($colName)) {
  1090. $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
  1091. $columns[$colName] = $obj->$get();
  1092. }
  1093. }
  1094. } else {
  1095. }
  1096. return BasePeer::doValidate(CcShowHostsPeer::DATABASE_NAME, CcShowHostsPeer::TABLE_NAME, $columns);
  1097. }
  1098. /**
  1099. * Retrieve a single object by pkey.
  1100. *
  1101. * @param int $pk the primary key.
  1102. * @param PropelPDO $con the connection to use
  1103. * @return CcShowHosts
  1104. */
  1105. public static function retrieveByPK($pk, PropelPDO $con = null)
  1106. {
  1107. if (null !== ($obj = CcShowHostsPeer::getInstanceFromPool((string) $pk))) {
  1108. return $obj;
  1109. }
  1110. if ($con === null) {
  1111. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1112. }
  1113. $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME);
  1114. $criteria->add(CcShowHostsPeer::ID, $pk);
  1115. $v = CcShowHostsPeer::doSelect($criteria, $con);
  1116. return !empty($v) > 0 ? $v[0] : null;
  1117. }
  1118. /**
  1119. * Retrieve multiple objects by pkey.
  1120. *
  1121. * @param array $pks List of primary keys
  1122. * @param PropelPDO $con the connection to use
  1123. * @throws PropelException Any exceptions caught during processing will be
  1124. * rethrown wrapped into a PropelException.
  1125. */
  1126. public static function retrieveByPKs($pks, PropelPDO $con = null)
  1127. {
  1128. if ($con === null) {
  1129. $con = Propel::getConnection(CcShowHostsPeer::DATABASE_NAME, Propel::CONNECTION_READ);
  1130. }
  1131. $objs = null;
  1132. if (empty($pks)) {
  1133. $objs = array();
  1134. } else {
  1135. $criteria = new Criteria(CcShowHostsPeer::DATABASE_NAME);
  1136. $criteria->add(CcShowHostsPeer::ID, $pks, Criteria::IN);
  1137. $objs = CcShowHostsPeer::doSelect($criteria, $con);
  1138. }
  1139. return $objs;
  1140. }
  1141. } // BaseCcShowHostsPeer
  1142. // This is the static code needed to register the TableMap for this table with the main Propel class.
  1143. //
  1144. BaseCcShowHostsPeer::buildTableMap();