当前位置: 首页>>代码示例>>PHP>>正文


PHP PropelPDO::lastInsertId方法代码示例

本文整理汇总了PHP中PropelPDO::lastInsertId方法的典型用法代码示例。如果您正苦于以下问题:PHP PropelPDO::lastInsertId方法的具体用法?PHP PropelPDO::lastInsertId怎么用?PHP PropelPDO::lastInsertId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropelPDO的用法示例。


在下文中一共展示了PropelPDO::lastInsertId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = GalleryImageSizePeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . GalleryImageSizePeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(GalleryImageSizePeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::GALLERY_IMAGE_ID)) {
         $modifiedColumns[':p' . $index++] = '`gallery_image_id`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::LOCATION)) {
         $modifiedColumns[':p' . $index++] = '`location`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::WIDTH)) {
         $modifiedColumns[':p' . $index++] = '`width`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::HEIGHT)) {
         $modifiedColumns[':p' . $index++] = '`height`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::FILESIZE)) {
         $modifiedColumns[':p' . $index++] = '`filesize`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(GalleryImageSizePeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     $sql = sprintf('INSERT INTO `gallery_image_size` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`gallery_image_id`':
                     $stmt->bindValue($identifier, $this->gallery_image_id, PDO::PARAM_INT);
                     break;
                 case '`location`':
                     $stmt->bindValue($identifier, $this->location, PDO::PARAM_STR);
                     break;
                 case '`width`':
                     $stmt->bindValue($identifier, $this->width, PDO::PARAM_INT);
                     break;
                 case '`height`':
                     $stmt->bindValue($identifier, $this->height, PDO::PARAM_INT);
                     break;
                 case '`filesize`':
                     $stmt->bindValue($identifier, $this->filesize, PDO::PARAM_INT);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:jorisros,项目名称:sfWidgetCKEditorPlugin,代码行数:85,代码来源:BaseGalleryImageSize.php

示例2: doInsert

 /**
  * Insert the row in the database.
  *
  * @param      PropelPDO $con
  *
  * @throws     PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = afWidgetHelpSettingsPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . afWidgetHelpSettingsPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::USER_ID)) {
         $modifiedColumns[':p' . $index++] = '`USER_ID`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::WIDGET_HELP_IS_ENABLED)) {
         $modifiedColumns[':p' . $index++] = '`WIDGET_HELP_IS_ENABLED`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::POPUP_HELP_IS_ENABLED)) {
         $modifiedColumns[':p' . $index++] = '`POPUP_HELP_IS_ENABLED`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::HELP_TYPE)) {
         $modifiedColumns[':p' . $index++] = '`HELP_TYPE`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`CREATED_AT`';
     }
     if ($this->isColumnModified(afWidgetHelpSettingsPeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
     }
     $sql = sprintf('INSERT INTO `af_widget_help_settings` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`USER_ID`':
                     $stmt->bindValue($identifier, $this->user_id, PDO::PARAM_INT);
                     break;
                 case '`WIDGET_HELP_IS_ENABLED`':
                     $stmt->bindValue($identifier, (int) $this->widget_help_is_enabled, PDO::PARAM_INT);
                     break;
                 case '`POPUP_HELP_IS_ENABLED`':
                     $stmt->bindValue($identifier, (int) $this->popup_help_is_enabled, PDO::PARAM_INT);
                     break;
                 case '`HELP_TYPE`':
                     $stmt->bindValue($identifier, $this->help_type, PDO::PARAM_INT);
                     break;
                 case '`CREATED_AT`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`UPDATED_AT`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:79,代码来源:BaseafWidgetHelpSettings.php

示例3: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = ExpedientehistorialPeer::IDEXPEDIENTEHISTORIAL;
     if (null !== $this->idexpedientehistorial) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ExpedientehistorialPeer::IDEXPEDIENTEHISTORIAL . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ExpedientehistorialPeer::IDEXPEDIENTEHISTORIAL)) {
         $modifiedColumns[':p' . $index++] = '`idexpedientehistorial`';
     }
     if ($this->isColumnModified(ExpedientehistorialPeer::IDEXPEDIENTESERVICIO)) {
         $modifiedColumns[':p' . $index++] = '`idexpedienteservicio`';
     }
     if ($this->isColumnModified(ExpedientehistorialPeer::IDESTADOSERVICIO)) {
         $modifiedColumns[':p' . $index++] = '`idestadoservicio`';
     }
     if ($this->isColumnModified(ExpedientehistorialPeer::EXPEDIENTEHISTORIAL_FECHA)) {
         $modifiedColumns[':p' . $index++] = '`expedientehistorial_fecha`';
     }
     if ($this->isColumnModified(ExpedientehistorialPeer::EXPEDIENTEHISTORIAL_NOTA)) {
         $modifiedColumns[':p' . $index++] = '`expedientehistorial_nota`';
     }
     $sql = sprintf('INSERT INTO `expedientehistorial` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`idexpedientehistorial`':
                     $stmt->bindValue($identifier, $this->idexpedientehistorial, PDO::PARAM_INT);
                     break;
                 case '`idexpedienteservicio`':
                     $stmt->bindValue($identifier, $this->idexpedienteservicio, PDO::PARAM_INT);
                     break;
                 case '`idestadoservicio`':
                     $stmt->bindValue($identifier, $this->idestadoservicio, PDO::PARAM_INT);
                     break;
                 case '`expedientehistorial_fecha`':
                     $stmt->bindValue($identifier, $this->expedientehistorial_fecha, PDO::PARAM_STR);
                     break;
                 case '`expedientehistorial_nota`':
                     $stmt->bindValue($identifier, $this->expedientehistorial_nota, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setIdexpedientehistorial($pk);
     $this->setNew(false);
 }
开发者ID:vicbaporu,项目名称:ITRADE,代码行数:67,代码来源:BaseExpedientehistorial.php

示例4: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = ClientePeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ClientePeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ClientePeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(ClientePeer::NOMBRE)) {
         $modifiedColumns[':p' . $index++] = '`NOMBRE`';
     }
     if ($this->isColumnModified(ClientePeer::CORREO)) {
         $modifiedColumns[':p' . $index++] = '`CORREO`';
     }
     if ($this->isColumnModified(ClientePeer::DIRECCION)) {
         $modifiedColumns[':p' . $index++] = '`DIRECCION`';
     }
     if ($this->isColumnModified(ClientePeer::TELEFONO)) {
         $modifiedColumns[':p' . $index++] = '`TELEFONO`';
     }
     if ($this->isColumnModified(ClientePeer::CIUDAD)) {
         $modifiedColumns[':p' . $index++] = '`CIUDAD`';
     }
     if ($this->isColumnModified(ClientePeer::OBSERVACION)) {
         $modifiedColumns[':p' . $index++] = '`OBSERVACION`';
     }
     if ($this->isColumnModified(ClientePeer::PUNTOS)) {
         $modifiedColumns[':p' . $index++] = '`PUNTOS`';
     }
     if ($this->isColumnModified(ClientePeer::NIT)) {
         $modifiedColumns[':p' . $index++] = '`NIT`';
     }
     $sql = sprintf('INSERT INTO `cliente` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`NOMBRE`':
                     $stmt->bindValue($identifier, $this->nombre, PDO::PARAM_STR);
                     break;
                 case '`CORREO`':
                     $stmt->bindValue($identifier, $this->correo, PDO::PARAM_STR);
                     break;
                 case '`DIRECCION`':
                     $stmt->bindValue($identifier, $this->direccion, PDO::PARAM_STR);
                     break;
                 case '`TELEFONO`':
                     $stmt->bindValue($identifier, $this->telefono, PDO::PARAM_STR);
                     break;
                 case '`CIUDAD`':
                     $stmt->bindValue($identifier, $this->ciudad, PDO::PARAM_STR);
                     break;
                 case '`OBSERVACION`':
                     $stmt->bindValue($identifier, $this->observacion, PDO::PARAM_STR);
                     break;
                 case '`PUNTOS`':
                     $stmt->bindValue($identifier, $this->puntos, PDO::PARAM_INT);
                     break;
                 case '`NIT`':
                     $stmt->bindValue($identifier, $this->nit, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:kcornejo,项目名称:usac,代码行数:91,代码来源:BaseCliente.php

示例5: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = PlayerPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . PlayerPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(PlayerPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(PlayerPeer::LAST_NAME)) {
         $modifiedColumns[':p' . $index++] = '`last_name`';
     }
     if ($this->isColumnModified(PlayerPeer::FIRST_NAME)) {
         $modifiedColumns[':p' . $index++] = '`first_name`';
     }
     if ($this->isColumnModified(PlayerPeer::PHOTO)) {
         $modifiedColumns[':p' . $index++] = '`photo`';
     }
     if ($this->isColumnModified(PlayerPeer::PHONE)) {
         $modifiedColumns[':p' . $index++] = '`phone`';
     }
     if ($this->isColumnModified(PlayerPeer::MOBILE)) {
         $modifiedColumns[':p' . $index++] = '`mobile`';
     }
     if ($this->isColumnModified(PlayerPeer::NOTE)) {
         $modifiedColumns[':p' . $index++] = '`note`';
     }
     $sql = sprintf('INSERT INTO `player` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`last_name`':
                     $stmt->bindValue($identifier, $this->last_name, PDO::PARAM_STR);
                     break;
                 case '`first_name`':
                     $stmt->bindValue($identifier, $this->first_name, PDO::PARAM_STR);
                     break;
                 case '`photo`':
                     $stmt->bindValue($identifier, $this->photo, PDO::PARAM_STR);
                     break;
                 case '`phone`':
                     $stmt->bindValue($identifier, $this->phone, PDO::PARAM_STR);
                     break;
                 case '`mobile`':
                     $stmt->bindValue($identifier, $this->mobile, PDO::PARAM_STR);
                     break;
                 case '`note`':
                     $stmt->bindValue($identifier, $this->note, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:takisp,项目名称:bookingCourt,代码行数:79,代码来源:BasePlayer.php

示例6: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = NewsletterPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . NewsletterPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(NewsletterPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(NewsletterPeer::SUBJECT)) {
         $modifiedColumns[':p' . $index++] = '`subject`';
     }
     if ($this->isColumnModified(NewsletterPeer::NEWSLETTER_BODY)) {
         $modifiedColumns[':p' . $index++] = '`newsletter_body`';
     }
     if ($this->isColumnModified(NewsletterPeer::LANGUAGE_ID)) {
         $modifiedColumns[':p' . $index++] = '`language_id`';
     }
     if ($this->isColumnModified(NewsletterPeer::IS_APPROVED)) {
         $modifiedColumns[':p' . $index++] = '`is_approved`';
     }
     if ($this->isColumnModified(NewsletterPeer::IS_HTML)) {
         $modifiedColumns[':p' . $index++] = '`is_html`';
     }
     if ($this->isColumnModified(NewsletterPeer::TEMPLATE_NAME)) {
         $modifiedColumns[':p' . $index++] = '`template_name`';
     }
     if ($this->isColumnModified(NewsletterPeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(NewsletterPeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     if ($this->isColumnModified(NewsletterPeer::CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`created_by`';
     }
     if ($this->isColumnModified(NewsletterPeer::UPDATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`updated_by`';
     }
     $sql = sprintf('INSERT INTO `newsletters` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`subject`':
                     $stmt->bindValue($identifier, $this->subject, PDO::PARAM_STR);
                     break;
                 case '`newsletter_body`':
                     if (is_resource($this->newsletter_body)) {
                         rewind($this->newsletter_body);
                     }
                     $stmt->bindValue($identifier, $this->newsletter_body, PDO::PARAM_LOB);
                     break;
                 case '`language_id`':
                     $stmt->bindValue($identifier, $this->language_id, PDO::PARAM_STR);
                     break;
                 case '`is_approved`':
                     $stmt->bindValue($identifier, (int) $this->is_approved, PDO::PARAM_INT);
                     break;
                 case '`is_html`':
                     $stmt->bindValue($identifier, (int) $this->is_html, PDO::PARAM_INT);
                     break;
                 case '`template_name`':
                     $stmt->bindValue($identifier, $this->template_name, PDO::PARAM_STR);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
                 case '`created_by`':
                     $stmt->bindValue($identifier, $this->created_by, PDO::PARAM_INT);
                     break;
                 case '`updated_by`':
                     $stmt->bindValue($identifier, $this->updated_by, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
//.........这里部分代码省略.........
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:101,代码来源:BaseNewsletter.php

示例7: doInsert

 /**
  * Insert the row in the database.
  *
  * @param      PropelPDO $con
  *
  * @throws     PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = ClientePeer::ID_CLIE;
     if (null !== $this->id_clie) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ClientePeer::ID_CLIE . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(ClientePeer::ID_CLIE)) {
         $modifiedColumns[':p' . $index++] = '`ID_CLIE`';
     }
     if ($this->isColumnModified(ClientePeer::APELLIDO)) {
         $modifiedColumns[':p' . $index++] = '`APELLIDO`';
     }
     if ($this->isColumnModified(ClientePeer::NOMBRE)) {
         $modifiedColumns[':p' . $index++] = '`NOMBRE`';
     }
     if ($this->isColumnModified(ClientePeer::TELEFONO)) {
         $modifiedColumns[':p' . $index++] = '`TELEFONO`';
     }
     if ($this->isColumnModified(ClientePeer::DIRECCION)) {
         $modifiedColumns[':p' . $index++] = '`DIRECCION`';
     }
     if ($this->isColumnModified(ClientePeer::ID_PROV)) {
         $modifiedColumns[':p' . $index++] = '`ID_PROV`';
     }
     if ($this->isColumnModified(ClientePeer::ID_CIUDAD)) {
         $modifiedColumns[':p' . $index++] = '`ID_CIUDAD`';
     }
     if ($this->isColumnModified(ClientePeer::EMAIL)) {
         $modifiedColumns[':p' . $index++] = '`EMAIL`';
     }
     if ($this->isColumnModified(ClientePeer::USER)) {
         $modifiedColumns[':p' . $index++] = '`USER`';
     }
     if ($this->isColumnModified(ClientePeer::PASS)) {
         $modifiedColumns[':p' . $index++] = '`PASS`';
     }
     $sql = sprintf('INSERT INTO `cliente` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID_CLIE`':
                     $stmt->bindValue($identifier, $this->id_clie, PDO::PARAM_INT);
                     break;
                 case '`APELLIDO`':
                     $stmt->bindValue($identifier, $this->apellido, PDO::PARAM_STR);
                     break;
                 case '`NOMBRE`':
                     $stmt->bindValue($identifier, $this->nombre, PDO::PARAM_STR);
                     break;
                 case '`TELEFONO`':
                     $stmt->bindValue($identifier, $this->telefono, PDO::PARAM_STR);
                     break;
                 case '`DIRECCION`':
                     $stmt->bindValue($identifier, $this->direccion, PDO::PARAM_STR);
                     break;
                 case '`ID_PROV`':
                     $stmt->bindValue($identifier, $this->id_prov, PDO::PARAM_INT);
                     break;
                 case '`ID_CIUDAD`':
                     $stmt->bindValue($identifier, $this->id_ciudad, PDO::PARAM_INT);
                     break;
                 case '`EMAIL`':
                     $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
                     break;
                 case '`USER`':
                     $stmt->bindValue($identifier, $this->user, PDO::PARAM_STR);
                     break;
                 case '`PASS`':
                     $stmt->bindValue($identifier, $this->pass, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setIdClie($pk);
     $this->setNew(false);
 }
开发者ID:nestorfsandoval,项目名称:2012_pw2_tp2,代码行数:97,代码来源:BaseCliente.php

示例8: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = OrdencompraPeer::IDORDENCOMPRA;
     if (null !== $this->idordencompra) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . OrdencompraPeer::IDORDENCOMPRA . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(OrdencompraPeer::IDORDENCOMPRA)) {
         $modifiedColumns[':p' . $index++] = '`idordencompra`';
     }
     if ($this->isColumnModified(OrdencompraPeer::IDPROVEEDOR)) {
         $modifiedColumns[':p' . $index++] = '`idproveedor`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_NOFACTURA)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_nofactura`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_FACTURAPDF)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_facturapdf`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_FECHA)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_fecha`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_IMPORTE)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_importe`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_STATUS)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_status`';
     }
     if ($this->isColumnModified(OrdencompraPeer::ORDENCOMPRA_FECHAAPAGAR)) {
         $modifiedColumns[':p' . $index++] = '`ordencompra_fechaapagar`';
     }
     $sql = sprintf('INSERT INTO `ordencompra` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`idordencompra`':
                     $stmt->bindValue($identifier, $this->idordencompra, PDO::PARAM_INT);
                     break;
                 case '`idproveedor`':
                     $stmt->bindValue($identifier, $this->idproveedor, PDO::PARAM_INT);
                     break;
                 case '`ordencompra_nofactura`':
                     $stmt->bindValue($identifier, $this->ordencompra_nofactura, PDO::PARAM_STR);
                     break;
                 case '`ordencompra_facturapdf`':
                     $stmt->bindValue($identifier, $this->ordencompra_facturapdf, PDO::PARAM_STR);
                     break;
                 case '`ordencompra_fecha`':
                     $stmt->bindValue($identifier, $this->ordencompra_fecha, PDO::PARAM_STR);
                     break;
                 case '`ordencompra_importe`':
                     $stmt->bindValue($identifier, $this->ordencompra_importe, PDO::PARAM_STR);
                     break;
                 case '`ordencompra_status`':
                     $stmt->bindValue($identifier, $this->ordencompra_status, PDO::PARAM_STR);
                     break;
                 case '`ordencompra_fechaapagar`':
                     $stmt->bindValue($identifier, $this->ordencompra_fechaapagar, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setIdordencompra($pk);
     $this->setNew(false);
 }
开发者ID:jalvarez14,项目名称:hva,代码行数:85,代码来源:BaseOrdencompra.php

示例9: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = JournalPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . JournalPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(JournalPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(JournalPeer::NAME)) {
         $modifiedColumns[':p' . $index++] = '`name`';
     }
     if ($this->isColumnModified(JournalPeer::DESCRIPTION)) {
         $modifiedColumns[':p' . $index++] = '`description`';
     }
     if ($this->isColumnModified(JournalPeer::ENABLE_COMMENTS)) {
         $modifiedColumns[':p' . $index++] = '`enable_comments`';
     }
     if ($this->isColumnModified(JournalPeer::NOTIFY_COMMENTS)) {
         $modifiedColumns[':p' . $index++] = '`notify_comments`';
     }
     if ($this->isColumnModified(JournalPeer::USE_CAPTCHA)) {
         $modifiedColumns[':p' . $index++] = '`use_captcha`';
     }
     if ($this->isColumnModified(JournalPeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(JournalPeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     if ($this->isColumnModified(JournalPeer::CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`created_by`';
     }
     if ($this->isColumnModified(JournalPeer::UPDATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`updated_by`';
     }
     $sql = sprintf('INSERT INTO `journals` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`name`':
                     $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
                     break;
                 case '`description`':
                     $stmt->bindValue($identifier, $this->description, PDO::PARAM_STR);
                     break;
                 case '`enable_comments`':
                     $stmt->bindValue($identifier, (int) $this->enable_comments, PDO::PARAM_INT);
                     break;
                 case '`notify_comments`':
                     $stmt->bindValue($identifier, (int) $this->notify_comments, PDO::PARAM_INT);
                     break;
                 case '`use_captcha`':
                     $stmt->bindValue($identifier, (int) $this->use_captcha, PDO::PARAM_INT);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
                 case '`created_by`':
                     $stmt->bindValue($identifier, $this->created_by, PDO::PARAM_INT);
                     break;
                 case '`updated_by`':
                     $stmt->bindValue($identifier, $this->updated_by, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:rapila,项目名称:plugin-journal,代码行数:97,代码来源:BaseJournal.php

示例10: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = BookingPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . BookingPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(BookingPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(BookingPeer::TRANSACTION_ID)) {
         $modifiedColumns[':p' . $index++] = '`transaction_id`';
     }
     if ($this->isColumnModified(BookingPeer::BOOKING_TYPE_ID)) {
         $modifiedColumns[':p' . $index++] = '`booking_type_id`';
     }
     if ($this->isColumnModified(BookingPeer::LABEL)) {
         $modifiedColumns[':p' . $index++] = '`label`';
     }
     if ($this->isColumnModified(BookingPeer::VALUE)) {
         $modifiedColumns[':p' . $index++] = '`value`';
     }
     $sql = sprintf('INSERT INTO `booking` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`transaction_id`':
                     $stmt->bindValue($identifier, $this->transaction_id, PDO::PARAM_INT);
                     break;
                 case '`booking_type_id`':
                     $stmt->bindValue($identifier, $this->booking_type_id, PDO::PARAM_INT);
                     break;
                 case '`label`':
                     $stmt->bindValue($identifier, $this->label, PDO::PARAM_STR);
                     break;
                 case '`value`':
                     $stmt->bindValue($identifier, $this->value, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:dapepe,项目名称:tymio,代码行数:67,代码来源:BaseBooking.php

示例11: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = SupplierPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . SupplierPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(SupplierPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(SupplierPeer::NAMA_SUPPLIER)) {
         $modifiedColumns[':p' . $index++] = '`nama_supplier`';
     }
     if ($this->isColumnModified(SupplierPeer::ALAMAT)) {
         $modifiedColumns[':p' . $index++] = '`alamat`';
     }
     if ($this->isColumnModified(SupplierPeer::ID_KOTA)) {
         $modifiedColumns[':p' . $index++] = '`id_kota`';
     }
     if ($this->isColumnModified(SupplierPeer::TELP)) {
         $modifiedColumns[':p' . $index++] = '`telp`';
     }
     $sql = sprintf('INSERT INTO `supplier` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`nama_supplier`':
                     $stmt->bindValue($identifier, $this->nama_supplier, PDO::PARAM_STR);
                     break;
                 case '`alamat`':
                     $stmt->bindValue($identifier, $this->alamat, PDO::PARAM_STR);
                     break;
                 case '`id_kota`':
                     $stmt->bindValue($identifier, $this->id_kota, PDO::PARAM_INT);
                     break;
                 case '`telp`':
                     $stmt->bindValue($identifier, $this->telp, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:67,代码来源:BaseSupplier.php

示例12: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = SubscriberPeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . SubscriberPeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(SubscriberPeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`id`';
     }
     if ($this->isColumnModified(SubscriberPeer::NAME)) {
         $modifiedColumns[':p' . $index++] = '`name`';
     }
     if ($this->isColumnModified(SubscriberPeer::PREFERRED_LANGUAGE_ID)) {
         $modifiedColumns[':p' . $index++] = '`preferred_language_id`';
     }
     if ($this->isColumnModified(SubscriberPeer::EMAIL)) {
         $modifiedColumns[':p' . $index++] = '`email`';
     }
     if ($this->isColumnModified(SubscriberPeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(SubscriberPeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     if ($this->isColumnModified(SubscriberPeer::CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`created_by`';
     }
     if ($this->isColumnModified(SubscriberPeer::UPDATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`updated_by`';
     }
     $sql = sprintf('INSERT INTO `subscribers` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`name`':
                     $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
                     break;
                 case '`preferred_language_id`':
                     $stmt->bindValue($identifier, $this->preferred_language_id, PDO::PARAM_STR);
                     break;
                 case '`email`':
                     $stmt->bindValue($identifier, $this->email, PDO::PARAM_STR);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
                 case '`created_by`':
                     $stmt->bindValue($identifier, $this->created_by, PDO::PARAM_INT);
                     break;
                 case '`updated_by`':
                     $stmt->bindValue($identifier, $this->updated_by, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:rapila,项目名称:plugin-newsletter,代码行数:85,代码来源:BaseSubscriber.php

示例13: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = FacturaDetallePeer::ID;
     if (null !== $this->id) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . FacturaDetallePeer::ID . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(FacturaDetallePeer::ID)) {
         $modifiedColumns[':p' . $index++] = '`ID`';
     }
     if ($this->isColumnModified(FacturaDetallePeer::FACTURA_ID)) {
         $modifiedColumns[':p' . $index++] = '`FACTURA_ID`';
     }
     if ($this->isColumnModified(FacturaDetallePeer::PRODUCTO_ID)) {
         $modifiedColumns[':p' . $index++] = '`PRODUCTO_ID`';
     }
     if ($this->isColumnModified(FacturaDetallePeer::PROVEEDOR_ID)) {
         $modifiedColumns[':p' . $index++] = '`PROVEEDOR_ID`';
     }
     if ($this->isColumnModified(FacturaDetallePeer::CANTIDAD)) {
         $modifiedColumns[':p' . $index++] = '`CANTIDAD`';
     }
     if ($this->isColumnModified(FacturaDetallePeer::PRECIO_UNITARIO)) {
         $modifiedColumns[':p' . $index++] = '`PRECIO_UNITARIO`';
     }
     $sql = sprintf('INSERT INTO `factura_detalle` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`ID`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`FACTURA_ID`':
                     $stmt->bindValue($identifier, $this->factura_id, PDO::PARAM_INT);
                     break;
                 case '`PRODUCTO_ID`':
                     $stmt->bindValue($identifier, $this->producto_id, PDO::PARAM_INT);
                     break;
                 case '`PROVEEDOR_ID`':
                     $stmt->bindValue($identifier, $this->proveedor_id, PDO::PARAM_INT);
                     break;
                 case '`CANTIDAD`':
                     $stmt->bindValue($identifier, $this->cantidad, PDO::PARAM_INT);
                     break;
                 case '`PRECIO_UNITARIO`':
                     $stmt->bindValue($identifier, $this->precio_unitario, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:kcornejo,项目名称:usac,代码行数:73,代码来源:BaseFacturaDetalle.php

示例14: doInsert


//.........这里部分代码省略.........
         $modifiedColumns[':p' . $index++] = '`is_hidden`';
     }
     if ($this->isColumnModified(PagePeer::IS_PROTECTED)) {
         $modifiedColumns[':p' . $index++] = '`is_protected`';
     }
     if ($this->isColumnModified(PagePeer::CANONICAL_ID)) {
         $modifiedColumns[':p' . $index++] = '`canonical_id`';
     }
     if ($this->isColumnModified(PagePeer::TREE_LEFT)) {
         $modifiedColumns[':p' . $index++] = '`tree_left`';
     }
     if ($this->isColumnModified(PagePeer::TREE_RIGHT)) {
         $modifiedColumns[':p' . $index++] = '`tree_right`';
     }
     if ($this->isColumnModified(PagePeer::TREE_LEVEL)) {
         $modifiedColumns[':p' . $index++] = '`tree_level`';
     }
     if ($this->isColumnModified(PagePeer::CREATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`created_at`';
     }
     if ($this->isColumnModified(PagePeer::UPDATED_AT)) {
         $modifiedColumns[':p' . $index++] = '`updated_at`';
     }
     if ($this->isColumnModified(PagePeer::CREATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`created_by`';
     }
     if ($this->isColumnModified(PagePeer::UPDATED_BY)) {
         $modifiedColumns[':p' . $index++] = '`updated_by`';
     }
     $sql = sprintf('INSERT INTO `pages` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`id`':
                     $stmt->bindValue($identifier, $this->id, PDO::PARAM_INT);
                     break;
                 case '`name`':
                     $stmt->bindValue($identifier, $this->name, PDO::PARAM_STR);
                     break;
                 case '`identifier`':
                     $stmt->bindValue($identifier, $this->identifier, PDO::PARAM_STR);
                     break;
                 case '`page_type`':
                     $stmt->bindValue($identifier, $this->page_type, PDO::PARAM_STR);
                     break;
                 case '`template_name`':
                     $stmt->bindValue($identifier, $this->template_name, PDO::PARAM_STR);
                     break;
                 case '`is_inactive`':
                     $stmt->bindValue($identifier, (int) $this->is_inactive, PDO::PARAM_INT);
                     break;
                 case '`is_folder`':
                     $stmt->bindValue($identifier, (int) $this->is_folder, PDO::PARAM_INT);
                     break;
                 case '`is_hidden`':
                     $stmt->bindValue($identifier, (int) $this->is_hidden, PDO::PARAM_INT);
                     break;
                 case '`is_protected`':
                     $stmt->bindValue($identifier, (int) $this->is_protected, PDO::PARAM_INT);
                     break;
                 case '`canonical_id`':
                     $stmt->bindValue($identifier, $this->canonical_id, PDO::PARAM_INT);
                     break;
                 case '`tree_left`':
                     $stmt->bindValue($identifier, $this->tree_left, PDO::PARAM_INT);
                     break;
                 case '`tree_right`':
                     $stmt->bindValue($identifier, $this->tree_right, PDO::PARAM_INT);
                     break;
                 case '`tree_level`':
                     $stmt->bindValue($identifier, $this->tree_level, PDO::PARAM_INT);
                     break;
                 case '`created_at`':
                     $stmt->bindValue($identifier, $this->created_at, PDO::PARAM_STR);
                     break;
                 case '`updated_at`':
                     $stmt->bindValue($identifier, $this->updated_at, PDO::PARAM_STR);
                     break;
                 case '`created_by`':
                     $stmt->bindValue($identifier, $this->created_by, PDO::PARAM_INT);
                     break;
                 case '`updated_by`':
                     $stmt->bindValue($identifier, $this->updated_by, PDO::PARAM_INT);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setId($pk);
     $this->setNew(false);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:101,代码来源:BasePage.php

示例15: doInsert

 /**
  * Insert the row in the database.
  *
  * @param PropelPDO $con
  *
  * @throws PropelException
  * @see        doSave()
  */
 protected function doInsert(PropelPDO $con)
 {
     $modifiedColumns = array();
     $index = 0;
     $this->modifiedColumns[] = TipoPeer::IDTIPO;
     if (null !== $this->idtipo) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . TipoPeer::IDTIPO . ')');
     }
     // check the columns in natural order for more readable SQL queries
     if ($this->isColumnModified(TipoPeer::IDTIPO)) {
         $modifiedColumns[':p' . $index++] = '`idtipo`';
     }
     if ($this->isColumnModified(TipoPeer::TIPO_NOMBRE)) {
         $modifiedColumns[':p' . $index++] = '`tipo_nombre`';
     }
     if ($this->isColumnModified(TipoPeer::TIPO_DESCRIPCION)) {
         $modifiedColumns[':p' . $index++] = '`tipo_descripcion`';
     }
     $sql = sprintf('INSERT INTO `tipo` (%s) VALUES (%s)', implode(', ', $modifiedColumns), implode(', ', array_keys($modifiedColumns)));
     try {
         $stmt = $con->prepare($sql);
         foreach ($modifiedColumns as $identifier => $columnName) {
             switch ($columnName) {
                 case '`idtipo`':
                     $stmt->bindValue($identifier, $this->idtipo, PDO::PARAM_INT);
                     break;
                 case '`tipo_nombre`':
                     $stmt->bindValue($identifier, $this->tipo_nombre, PDO::PARAM_STR);
                     break;
                 case '`tipo_descripcion`':
                     $stmt->bindValue($identifier, $this->tipo_descripcion, PDO::PARAM_STR);
                     break;
             }
         }
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
     }
     try {
         $pk = $con->lastInsertId();
     } catch (Exception $e) {
         throw new PropelException('Unable to get autoincrement id.', $e);
     }
     $this->setIdtipo($pk);
     $this->setNew(false);
 }
开发者ID:jalvarez14,项目名称:hva,代码行数:55,代码来源:BaseTipo.php


注:本文中的PropelPDO::lastInsertId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。