Elxis CMS Forum
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Bug reports and fixes
 
Pages: [1]
  Print  
Author Topic: oracle problem content size  (Read 6889 times)
Ahmad Said
Newbie
*
Offline Offline

Posts: 21


« on: November 21, 2008, 19:03:47 »

hello all
i have a new problem which is :::
on the database the content intro and main text define as clog which can store up to 4 giga of character, but it not work am tray  to store text contain 2345 character and alert of error ora-01744 found

the fix is to store the value by binding them to variable i dont now where to do that
Logged

Ahmad Sai'd
muharihar
Jr. Member
**
Offline Offline

Posts: 77

muharihar


WWW
« Reply #1 on: January 11, 2009, 07:49:28 »

i'm not an oracle expert,
but i think it should no problem if the text content (introtext and maintext) is  < 4000 character.
Check by this query (#__content -> content table):
Code:
SELECT   ID, a.title, DBMS_LOB.getlength (introtext) n_introtext,
         DBMS_LOB.getlength (maintext) n_maintext
    FROM elx_content a
   WHERE DBMS_LOB.getlength (introtext) > 2345
      OR DBMS_LOB.getlength (maintext) > 2345
ORDER BY ID

Result:
ID    |  title                            | n_introtext | n_maintext                               
-----------------------------------------------------------------
27   |   User friendly interface |  527          | 3984                                 

There is a problem if to store > 4000 character.
I thinks it's elxis bug to store CLOB datatype?
[Note: Elxis using ADOdb as their database library, and ADOdb Support to store LOBs (BLOB, CLOB) ]


I found this error on installation process (default data sample):
ERROR:
URI: index.php
Message: ORA-01704: string literal too long


It happen while trying to insert:
Code:
INSERT INTO elx_content VALUES (29, 'Φιλικό περιβάλλον διαχείρισης', 'filiko-perivallon', ' ...
INSERT INTO elx_content VALUES (31, 'Elxis License Guidelines', 'elxis-license-guidelines', ' ...
INSERT INTO elx_content VALUES (32, 'Οδηγίες για την Άδεια Χρήσης του Elxis', 'odigies-adeias-elxis', '...
« Last Edit: January 11, 2009, 08:01:21 by muharihar » Logged

how technology and nature stand together!
---------------------------------------------------
www.OmahIjo.net
datahell
Elxis Team
Hero Member
*****
Offline Offline

Posts: 7592



WWW
« Reply #2 on: January 11, 2009, 11:44:52 »

I know these issues, should be fixed in 2008.2. Oracle support is experimental. If you have a ready-solution send it to us to check it.

Do you have any problem with international character support?
« Last Edit: January 11, 2009, 11:47:28 by datahell » Logged

Ahmad Said
Newbie
*
Offline Offline

Posts: 21


« Reply #3 on: March 25, 2009, 00:19:26 »

i have solve this problem; i have modifay database file as follwing

   public function updateObject( $table, &$object, $keyName, $updateNulls=true ) {
      $fmtsql = "UPDATE $table SET %s WHERE %s";
      $tmp = array();
      
      foreach (get_object_vars( $object ) as $k => $v) {
         if( is_array($v) or is_object($v) or $k[0] == '_' ) { // internal or NA field
            continue;
         }
         if( $k == $keyName ) { // PK not to be updated
            $where = "$keyName='" . $this->getEscaped( $v ) . "'";
            continue;
         }
         if ($v === NULL && !$updateNulls) {
            continue;
         }
         if( $v == '' ) {
            $val = "NULL";
         } else {
            $val = "'".$this->getEscaped( $v )."'"; //ELXIS note: added single quotes for escaping reserved words
         }

         //backticks for escaping reserved words for MySQL, quotes for postgres for lower/uppercase fields
            $dbt = strtolower($this->_resource->databaseType);
            if ( ereg('mysql', $dbt )) {
                $tmp[] = "`$k`=$val";
            } else if ( ereg('postgre', $dbt )) {
                $tmp[] = "\"$k\"=$val";
            } else {
            if(strlen($val)>4000){
               $tmp[] = "$k='temp_data'";
               $parm[] = array("table"=>$this->replacePrefix($table, '#__'), "field"=>$k , "value"=>$this->getEscaped( $v ), "rec_id"=>$where);
            }
                else $tmp[] = "$k=$val";
            }
      }
        $this->setQuery( sprintf( $fmtsql, implode( ",", $tmp ) , $where ) );
      
      return $this->query(array(),$parm);
   }

and >>>>>>>>>>>>>>>>

public function query($params = array(), $parm =array()) {
      if ($this->_debug) {
         $this->_ticker++;
           $this->_log[] = $this->_sql;
      }
      $this->_errorNum = 0;
      $this->_errorMsg = '';
      
        if (( $this->limit != null) || ( $this->offset != null )) {
            $this->_cursor = $this->_resource->SelectLimit( $this->_sql, $this->limit, $this->offset );
        } else {
            $this->_cursor = $this->_resource->Execute( $this->_sql, $params );
         
      $compatDrivers = array ('oci8', 'oci805', 'oci8po', 'oracle');
      if (in_array($this->_resource->databaseType, $compatDrivers)) if($parm ){
            foreach( $parm  as $par){
               $this->_cursor = $this->_resource->UpdateClob($par['table'], $par['field'], $par['value'], $par['rec_id']);
               //echo $par['value'];exit;
            }   
         }
        }

      if (!$this->_cursor) {
         $this->_errorNum = $this->_resource->ErrorNo();
         $this->_errorMsg = $this->_resource->ErrorMsg();
         if ($this->_debug) {
            trigger_error( $this->_resource->ErrorMsg(), E_USER_NOTICE );
            if (function_exists( 'debug_backtrace' )) {
               foreach( debug_backtrace() as $back) {
                   if (@$back['file']) { echo "\n<br />".$back['file'].':'.$back['line']; }
               }
            }
         }
         return false;
      }

      $this->_cursorReplacer();
      return $this->_cursor;
   }
Logged

Ahmad Sai'd
datahell
Elxis Team
Hero Member
*****
Offline Offline

Posts: 7592



WWW
« Reply #4 on: March 25, 2009, 11:58:33 »

It might work but it does n't look so good, we need to make sure that this will work under all circumstances. I will install Oracle again very soon to re-check Oracle compatibility. I made an alternative database.php file to test it later with your fixes but a little modified.
Logged

Ahmad Said
Newbie
*
Offline Offline

Posts: 21


« Reply #5 on: March 26, 2009, 11:18:58 »

Great,

The procedure I am worked on is:

On update:
     Cheek if the database engine is oracle if so if the length of the inter text over 4000 character so we have to use binding blob function on the oracle driver functions ( UpdateClob($'table', $field, $value, $where); ) one time for each clob value.

On add
    cheek if the database engine is oracle if so if the length of the inter text over 4000 character so we have to insert the record without the clob field and after get the id of the record we have to use the same function to update the clob's fields

the attached file contain the modified database.php

* databse.txt (41.14 KB - downloaded 302 times.)
« Last Edit: March 26, 2009, 12:19:11 by ahsq81 » Logged

Ahmad Sai'd
Ahmad Said
Newbie
*
Offline Offline

Posts: 21


« Reply #6 on: April 10, 2009, 09:32:35 »

so i dont have any replay, no one download the file and tray it HuhHuhHuhHuhHuh??
Logged

Ahmad Sai'd
datahell
Elxis Team
Hero Member
*****
Offline Offline

Posts: 7592



WWW
« Reply #7 on: April 10, 2009, 11:46:58 »

I will reply to you once I find the time to check this issue.
I must notice once more that Oracle support is experimental.
Logged

Ahmad Said
Newbie
*
Offline Offline

Posts: 21


« Reply #8 on: May 11, 2009, 23:50:40 »

dear datahell 
 
you don't tell me until now what happend with this issue i plane to use elxis 2009 so dos it accept the contant over 4000 charctre, and what happend with the file i had sended before for solving this issue by binding the large content

am waiting for your...
Logged

Ahmad Sai'd
Pages: [1]
  Print  
 
Jump to: