Part of the EllisLab Network
   
9 of 90
9
DMZ 1.7.1 (DataMapper OverZealous Edition)
Posted: 22 March 2010 09:08 PM   [ Ignore ]   [ # 81 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

@Frank Liu
Wow, that’s great!  Thanks for the research.

I added a link back to your post on the System Requirements page so that others can find this if they need to.

Hopefully you will be able to upgrade your PHP soon, though!

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 23 March 2010 06:40 PM   [ Ignore ]   [ # 82 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  101
Joined  03-19-2009

Hey Phill,

I have something to show you that I cant send in this forum.

Is there a email where I can send you a message ?

Thanks

Profile
 
 
Posted: 23 March 2010 07:27 PM   [ Ignore ]   [ # 83 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

@PoetaWD
It’s on the troubleshooting page of the manual, in the first gray box.

(I don’t want to publish it on a public forum, obviously.)

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 23 March 2010 10:18 PM   [ Ignore ]   [ # 84 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

Code Theft

I feel the need to write this.  I’ve been contacted by several individuals—in just the last few weeks—who have felt the need to share their pride in copying source code from proprietary and non-free applications.

This is an incredibly misinformed view of the world.  Rationalizing this by saying you are just learning, or something similar, does not take away from the fact that:

  1) It is completely unnecessary.  There is a huge wealth of legally free software, with 100% visible source code to look at.

  2) It damages the entire software industry.  I assume that the majority of people who use CodeIgniter are in the software industry.  When you take from someone else’s hard work, and redistribute it against their will, you are stealing from that person or company.

  3) You don’t learn by doing things right the first time.  You learn by making mistakes.  This is the point of going to class, of practicing, of any skilled trade.  I don’t know how to write code because I saw it written correctly once before—I know how to write code correctly because I’ve written a lot of messed up crap that I had to rewrite many times.

  4) The saddest thing is when you do this, and then brag about it to a person who writes software for a living, that’s like going to an independent film director and bragging about how you download all your favorite movies from bittorrent.  That’s really nice.  Why don’t you spit in their face, too?

Please, if you are trying to learn something, look at the open-source community.  Don’t steal closed-source code.  Just because you can decrypt PHP and JavaScript, doesn’t mean you should.  And don’t steal FOSS code either!  Attribute it, follow the licenses as provided, and be respectful of other software developers.

As this isn’t the correct forum to discuss this, if you have a response to this message, we can continue the discussion here.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 23 March 2010 10:45 PM   [ Ignore ]   [ # 85 ]  
Summer Student
Total Posts:  14
Joined  08-09-2009

So more Oracle woes…

turns out whenever one tries to do a $o->save() that uses an insert, datamapper needs the following:

// around line 1700 in libraries/datamapper.php
// Create new record
$this->db->insert($this->table, $data);

if( ! $this->_force_save_as_new)
{
  // Assign new ID
  $this->id = $this->db->insert_id(); // UNSUPPORTED for oci8 driver
}

Since the oci8 driver does not support this (Oracle doesn’t support auto incrementing keys), this would raise an error.

To fix this put this around the same area:

$query = $this->db->query(“select {$this->table}_SQ.NEXTVAL ID FROM DUAL”);
$query_result = $query->row();
$data[‘id’] = $query_result->id;

// Create new record
$this->db->insert($this->table, $data);

if( ! $this->_force_save_as_new)
{
  // Assign new ID
  $this->id = $data[‘id’];
}

Note that here we assume, for each table that one creates, there’s a corresponding sequence with the name ($table_name}_SQ.

In addition, make sure that your oci8_result.php also contain the following code:

function field_data()
{
  $retval = array();
  $fieldCount = $this->num_fields();
  for ($c = 1; $c <= $fieldCount; $c++)
  {
      $F         = new stdClass();
      $F->name     = strtolower(ocicolumnname($this->stmt_id, $c)); // IMPORTANT
      $F->type     = ocicolumntype($this->stmt_id, $c);
      $F->max_length = ocicolumnsize($this->stmt_id, $c);

      $retval[] = $F;
  }

  return $retval;
}

Generally, to make sure oci8 works properly, one really needs to change the driver to convert field names to lowercased. I wrote a separate thread in this forum somewhere else that contain some of those fixes.

Anyway, did I mention I hate Oracle?

Profile
 
 
Posted: 23 March 2010 10:53 PM   [ Ignore ]   [ # 86 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008

@Frank Liu
Wow.  I love PostgreSQL more every day tongue wink

I’m glad you solved these problems.  I’m pretty sure there’s no way to integrate this into DMZ in a non-problematic manner.  confused

If you don’t mind posting the link to the other thread, though, I’ll add a link to it to the DMZ docs.

Edit: Corrected poorly written sentence.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 23 March 2010 11:26 PM   [ Ignore ]   [ # 87 ]  
Summer Student
Total Posts:  14
Joined  08-09-2009
OverZealous - 24 March 2010 02:53 AM

@Frank Liu
Wow.  I love PostgreSQL more every day tongue wink

I’m glad you solved these problems.  I’m pretty sure there’s no way to integrate this into DMZ in a non-problematic manner.  confused

If you don’t mind posting the link to the other thread, though, I’ll add a link to it to the DMZ docs.

Edit: Corrected poorly written sentence.

Here’s the link to the other thread. But these are just hacks; one should be careful about using them. Too bad I don’t know CI well enough to write a library. And it seems that CI is written in a way that is difficult to extend the database drivers.

Profile
 
 
Posted: 23 March 2010 11:36 PM   [ Ignore ]   [ # 88 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1041
Joined  10-08-2008
Frank Liu - 24 March 2010 03:26 AM

And it seems that CI is written in a way that is difficult to extend the database drivers.

That is, sadly, the biggest problem I have with CI.  If I could override them, I could easily fix all of my issues with _protect_identifiers.  I rather hate editing the core CI files directly.

One thing: if you are only modifying the Oracle drivers (and not CI_DB, CI_DB_driver, or CI_DB_activerecord), you could try to copy the oracle drivers and give them a new name.  At least this way, upgrading CI wouldn’t override your customizations.  It’s probably not worth the renaming effort, though.

 Signature 

Phil DeJarnett
  OverZealous Creations, LLC

Profile
 
 
Posted: 24 March 2010 12:05 AM   [ Ignore ]   [ # 89 ]  
Summer Student
Total Posts:  14
Joined  08-09-2009
OverZealous - 24 March 2010 03:36 AM
Frank Liu - 24 March 2010 03:26 AM

And it seems that CI is written in a way that is difficult to extend the database drivers.

That is, sadly, the biggest problem I have with CI.  If I could override them, I could easily fix all of my issues with _protect_identifiers.  I rather hate editing the core CI files directly.

One thing: if you are only modifying the Oracle drivers (and not CI_DB, CI_DB_driver, or CI_DB_activerecord), you could try to copy the oracle drivers and give them a new name.  At least this way, upgrading CI wouldn’t override your customizations.  It’s probably not worth the renaming effort, though.

The problem is as far as I know, you do have to change the DB_active_rec.php file. The update and insert query executes a compiled string. This is not enough to properly deal with clob objects.

Profile
 
 
Posted: 24 March 2010 12:37 PM   [ Ignore ]   [ # 90 ]  
Grad Student
Avatar
Rank
Total Posts:  59
Joined  03-04-2008

Hello, DataMapper OverZealous Edition is great for me. But i have a question.
Can i set the primary key field name?. I have a lot of tables that primary key field name is “xxx_id”. And i don’t want to change it to “id”.

I want to do something like this:

class Test extends DataMapper {
    
    
var $table 'testing';
    var 
$pk_filedname 'test_id'//<----

    
function __construct($id NULL)
    
{
        parent
::__construct($id);
    
}

is this possible ?

Thanks.

 Signature 

?

Profile
 
 
   
9 of 90
9
 
‹‹ Twitter Search      Layouts and actions in CI ››