Welcome Guest, Not a member yet? Register   Sign In
Mysql Database issues
#11

[eluser]Derek Allard[/eluser]
OK, I want to get this fixed up for you guys, could you please provide the code you're using?
#12

[eluser]megabyte[/eluser]
Derek, thanks for your concern. I have to admit thats what I love about this community.

I will trouble shoot and test things as soon as possible and get back to you.
#13

[eluser]James Pax[/eluser]
yay! Thank you Derek Allard!

my code is attached to this post, I tried to get it on here as quickly as possible... I hope it's commented enough

the file is zip I just changed the ".zip" to ".jpg"

edit: ops I don't see any way to grab the .jpg from the post... hopefully your admin privileges can grant you access to it? :long:
#14

[eluser]Derek Allard[/eluser]
I'm sorry, I can't recover that. I'm happy to help though. Could you just cut and paste the most basic, simple example that you can that shows this behaviour? I don't need to see any login code, or anything like that, just the few lines that you are using to create the fields. I'm trying to rule out if this is a dbforge thing, or something else.
#15

[eluser]Seppo[/eluser]
Derek, with this code
Code:
$this->load->database();
        $this->load->dbutil();
        $this->load->dbforge();


        $field['last_name']['type']='varchar';
        $field['last_name']['constraint']='50';
        $field['last_name']['null']=false;
        
        $this->dbforge->add_column('table_name',$field);

I'm getting
Quote:ALTER TABLE `table_name` ADD Array NOT NULL

using MySQLi and
Quote:ALTER TABLE `table_name` ADD `last_name` varchar(50) NOT NULL
using MySQL driver
#16

[eluser]James Pax[/eluser]
thank you seppo... my internet got cut off last night (ugly provider lol) and had problems sending in my code!

anyways...

I'm getting this:

Code:
//get the list of tables
       $tables = $this->db->list_tables();

        //parse the tables
        foreach ($tables as $table)
        {
            
            $data[$table]=array();
        
            //get table field metadata
               $fields = $this->db->field_data($table);
              
            $data[$table]['fields']=array();
            
            //parse fields one by one
            foreach ($fields as $field)
            {
                  
                   //array fields check
                   var_dump($field);

gives me no "type" and probably wrong "max_length" in 'mysqli'
(edit: I don't know about the primary_key it might return the length of the int,the result doesn't change I guess length of FALSE=0 length of TRUE=1 ?? )
var_dump:
Code:
array(1) { ["id"]=>  array(3) { ["type"]=>  string(6) ["max_length"]=>  int(1) ["primary_key"]=>  int(1) } }
(edit: with 'mysql' driver I get the type in the var_dump)

then I get just like seppo:

Code:
ALTER TABLE `users` CHANGE Array NOT NULL
even for modify_column
(edit: by passing an array like the one above)
I'm so happy Derek Allard is going to give a look into it Big Grin


ps: damn had to wait another 5 hours to post this...
#17

[eluser]James Pax[/eluser]
I've got my fingers crossed Smile any news?
#18

[eluser]Derek Allard[/eluser]
I think you're waiting for me? No, I'm sorry, I haven't even read the forums in 3 days unless I got an email notification. I'm just buried. Your issue is on my "to-do", and the debugging by you and Seppo is very helpful, but I probably won't get to turn my attention to CI for another week or two. Apologies, I didn't mean to have you think it'd be an instant fix Wink
#19

[eluser]Seppo[/eluser]
Derek, if I may... Why is the mysqli forge class so different to the mysql? I mean... they both should produce the same SQLs...
In MySQL forge you have a method _process_fields that's used twice, while in mysqli you have a similar code in _create_table and some bug code in _alter_table...
Could you just look at it for a sec trying to copy+paste the mysql forge to mysqli?

Doing that, and replacing the two times MySQL appear seems to fix this issue =)
#20

[eluser]Derek Allard[/eluser]
what the!?!?

That is SUPPOSED to be what the files look like. Ugh. I've made the change, can you grab a new svn and retest.

I need more coffee...

...


... and beer.




Theme © iAndrew 2016 - Forum software by © MyBB