⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Full Compatible Verion With Oracle, Now Available. pheeeew!



tee_porsche
  • profile picture
  • Member

Posted 03 May 2012 - 04:01 AM

This is my humble way of contributing back to the community.

I Honestly Dont Know How Im gonna upload cos its a .rar file containing different modifications

Regards

Tee

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 03 May 2012 - 05:57 AM

I think to this forum .rar is not availbable but with zip files you will not have any problems. If you still have problems with that just send me strait away email to [email="info@grocerycrud.com"]info@grocerycrud.com[/email] to add it to your post.

Thanks by the way.

tee_porsche
  • profile picture
  • Member

Posted 03 May 2012 - 08:35 AM

Okies will do that in a giffy. I'm also looking at the 1-1 feature too and might upload that soon

tee_porsche
  • profile picture
  • Member

Posted 03 May 2012 - 08:38 AM

And Thats It[attachment=159:groceryoracle.zip]


Pls remember to add the following line to the grocery_crud_model.php file at line 70 to enable the datepickers and field work effectively

$this->db->query("alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS'");

rischan
  • profile picture
  • Member

Posted 17 June 2012 - 18:46 PM

please help me about my error..
[b]Fatal error[/b][color=#000000]: Cannot access empty property in [/color][b]D:xxxx\application\libraries\grocery_crud.php[/b][color=#000000] on line [/color][b]1388[/b]

if I made the comment this code

foreach($data->list as $num_row => $row)
{
$data->list[$num_row]->edit_url = $data->edit_url.'/'.$row->{$data->primary_key};
$data->list[$num_row]->delete_url = $data->delete_url.'/'.$row->{$data->primary_key};
}

the data can show but on the action error like this
Edit D
Edit

A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$edit_url

Filename: views/list.php

Line Number: 34

" class="edit_button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" role="button">
Edit
A PHP Error was encountered

Severity: Notice

Message: Undefined property: stdClass::$delete_url

Filename: views/list.php

Line Number: 40

', '0')" href="javascript:void(0)" class="delete_button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary" role="button">
Delete

please help me

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 19 June 2012 - 06:24 AM

[member='rischan'] the problem probably is:
1. You don't get a primary key at application/models/grocery_crud_model.php at around line 523-571 from

function get_primary_key($table_name = null)

2. You don't have a primary key at your table. Make sure that you have at least one primary key at your table

rischan
  • profile picture
  • Member

Posted 20 June 2012 - 02:16 AM

i am sure, i have primary key on my tables..
my feeling the wrong on models/grocary_crud_model.php

if i using mysql database it's no problem, but if i use oracle and use grocery crud for oracle, i get error, this is function get_primary_key on grocary_crud_model.php, any wrong on this line?

please help me johnny thanks alot :-)


function get_primary_key($table_name = null)
{
if($table_name == null)
{
if(empty($this->primary_key))
{
$fields = $this->get_field_types_basic_table();

foreach($fields as $field)
{
if($field->CONSTRAINT_TYPE == 'P')
{
return $field->name;
}
}

return false;
}
else
{
return $this->primary_key;
}
}
else
{
$fields = $this->get_field_types($table_name);


foreach($fields as $field)
{
if($field->CONSTRAINT_TYPE == 'P')
{
return $field->name;
}
}

return false;
}

}

rischan
  • profile picture
  • Member

Posted 20 June 2012 - 02:53 AM

this is my query


CREATE TABLE matkuliah (
id_matkul CHAR(5) NOT NULL,
nm_matkul VARCHAR2(30) NOT NULL,
jml_sks NUMBER(5,2) NOT NULL,
CONSTRAINT pk_matkul PRIMARY KEY(id_matkul)
);
CREATE TABLE mahasiswa(
nim CHAR(8) NOT NULL,
nama VARCHAR2(30) NOT NULL,
alamat VARCHAR2(60) NOT NULL,
id_matkul CHAR(5) NOT NULL,
CONSTRAINT pk_mhs PRIMARY KEY(nim),
CONSTRAINT fk_mhs FOREIGN KEY(id_matkul) REFERENCES matkul(id_matkul)
);


please help me johnny :( .. i upload my source on http://android.developers.or.id/cinta2.zip because filesize 1 Mb.
thanks alot

luisaocaroca
  • profile picture
  • Member

Posted 21 June 2012 - 17:18 PM

Hi
I had the same problem, and i realised that the query used for the model to find the columns and its features (for example if it is a primary key) was with problems.


Then, the funcion get_field_types_basic_table() on "grocery_crud_model.php" dosen't find if the column is Primary Key, becose the column CONSTRAINT_TYPE was empty.

(you can print the query on the line 322 on grocery_crud_model.php and test it on the database).

Then i find that the problem was the name of the user database defined in config/database.php ($db['default']['username']) was in lowercase,
The solution was to change the name of the user to uppercase.

i hope you can fix the problem
Bye

rischan
  • profile picture
  • Member

Posted 23 June 2012 - 06:41 AM

sorry luisaocaroca, iam newbie on php and codeigniter, can you show or give me your code grocery_croud__model ?

tee_porsche
  • profile picture
  • Member

Posted 26 June 2012 - 11:58 AM

you can find my latest version here [attachment=211:groceryoracle.zip] .... but remember to use sequences
{TABLENAME}_SEQ to mimic autonumbers in mysql which was my little dirty hack to allow the insert functionality work on oracle

that is FILMS table would have FILMS_SEQ as its sequence in oracle
i've modified the oci drivers to reflect updates too.

Happy coding y'all

tee_porsche
  • profile picture
  • Member

Posted 12 July 2012 - 08:45 AM

Please update the db_relation_n_n_update function in the grocery_crud_model of the last zip attachment in order for the realation_n_n functionality to work.



function db_relation_n_n_update($field_info, $post_data ,$main_primary_key)
{







$this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key);




if(!empty($post_data))
$this->db->where_not_in($field_info->primary_key_alias_to_selection_table , $post_data);
$this->db->delete($field_info->relation_table);

$counter = 0;


if(!empty($post_data))
{

/**ob_start();
var_dump($post_data);
$xxx = ob_get_clean();
$xxx .= '<br/>primary_key_alias_to_this_table:'.$field_info->primary_key_alias_to_this_table;
$xxx .= '<br/>primary_key_alias_to_selection_table:'.$field_info->primary_key_alias_to_selection_table;
$xxx .= '<br/>main_primary_key:'. $main_primary_key;
var_dump($where_array);
$xxx .= ob_get_clean();
$xxx .= '<br/>relation_table:'. $field_info->relation_table;
$xxx .= '<br/>priority_field_relation_table:'. $field_info->priority_field_relation_table;
$xxx .= '<br/>Count:'. $count;
if ( ! write_file(@'./debug.txt', $xxx))
{
// echo 'Unable to write the file';
}
else
{
// echo 'File written!';
}

**/
foreach($post_data as $primary_key_value)
{
$where_array = array(
$field_info->primary_key_alias_to_this_table => $main_primary_key,
$field_info->primary_key_alias_to_selection_table => $primary_key_value,
);

$this->db->where($where_array);
$count = $this->db->from($field_info->relation_table)->count_all_results();


if($count == 0)
{


if(!empty($field_info->priority_field_relation_table))
$where_array[$field_info->priority_field_relation_table] = $counter;



$sql = "select {$field_info->relation_table}_SEQ.nextval AS NEXTID from dual";
$query = $this->db->query($sql);
$row = $query->row();
$newid= $row->NEXTID;
$pkfield = $this->get_primary_key("{$field_info->relation_table}");
$where_array[$pkfield] = $newid;



$this->db->insert($field_info->relation_table, $where_array);


}elseif($count >= 1 && !empty($field_info->priority_field_relation_table))
{
$this->db->update( $field_info->relation_table, array($field_info->priority_field_relation_table => $counter) , $where_array);
}

$counter++;
}





}
}


orochimaru
  • profile picture
  • Member

Posted 13 December 2012 - 06:52 AM

hi there
i need to switch to oracle and i tried you lib
it's not working anymore and it's an old version
can you update your lib
or guide me to
how or where in library to modify

tee_porsche
  • profile picture
  • Member

Posted 30 December 2012 - 20:18 PM

hi All, I've made a lot of changes to the oracle gcrud library ..This should make it compatible with previous version. for now I'm trying to keep up with the latest changes ....would upload the changes as soon as I'm done.

Sorry for the late response been working with other projects.

Regards

Moon Brain
  • profile picture
  • Member

Posted 02 December 2013 - 10:49 AM

Hello tee_porche,

 

I am attempting to use your Oracle version with Grocery CRUD 1.4.1 and CodeIgniter 2.1.4 but I am getting errors which I think is because I am trying to use your modifications with the wrong version. Can you tell me which version of Grocery CRUD and CodeIgniter your modifications are for? 

 

Many thanks,

MoonBrain


fdoperezr
  • profile picture
  • Member

Posted 11 April 2017 - 17:55 PM

hi All, I've made a lot of changes to the oracle gcrud library ..This should make it compatible with previous version. for now I'm trying to keep up with the latest changes ....would upload the changes as soon as I'm done.

Sorry for the late response been working with other projects.

Regards

 

Hi, you really helped me but I got the next message error:

A PHP Error was encountered

Severity: Error

Message: Cannot access empty property

Filename: libraries/Grocery_CRUD.php

Line Number: 1612

Backtrace:

How can I fix it?