Can you create a script (example) to use this class in a other file
please.

You can create a lib directorie and bin directorie.
In lib you put your class and in bin you put the example.

In your functions can you return the exit code. For example if the table
is correctly created or not.

See below

Le vendredi 02 mars 2007 à 16:57 +0100, The Stupid User a écrit :
> Update in /var/git/else/pfe.git/refs/heads/eugenie
> http://git.else-projects.org/?p=else/pfe.git;a=summary
> http://git.else-projects.org/?p=else/pfe.git;a=commit;h=a62759d041accc8b9808c1b999aa8ec1adbbb09b
> 
> Commit:  a62759d041accc8b9808c1b999aa8ec1adbbb09b
> Author: Christophe Claude (Kryz) <[EMAIL PROTECTED]>
> Date:   Fri Mar 2 16:57:39 2007 +0100
> 
>     Add begin of insert function with 2 dimension tab
> 
> ---
> 
>  rimelse/kryz_stuff/Connector.rb |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/rimelse/kryz_stuff/Connector.rb b/rimelse/kryz_stuff/Connector.rb
> index d72ab55..d9293fb 100644
> --- a/rimelse/kryz_stuff/Connector.rb
> +++ b/rimelse/kryz_stuff/Connector.rb
> @@ -50,6 +50,20 @@ class Connectors
>               end
>               @db.execute(sql)
>       end
> +     def InsertIntoTable(dim,tab)
> +             i = 0
> +             puts "-> inserting into " + tab[i]
> +             sql = "insert into " + tab[0] + "values ("
> +             while tab[i]
> +                     if tab[i+1] == "end"
> +                             sql = sql + tab[i] + ")"
> +                             i = i + 2
> +                     else
> +                             sql = sql + tab[i] + ","
> +                             i = i + 1
> +                     end
> +             end
> +             puts sql
Where is the end  of this function? :)
I think this function is so dirty, I don't like how it was make.

For exemple if I have a table:

        id auto-increment
        name varchar (255) default 'eric'
        age int (11) default 43
        adresse varchar (255) default 'out there'
        city varchar (255) default 'here'

And if I want to insert in this table I can't make a sql query like
this:

INSERT INTO mytable (name , adresse) VALUES ('BOB' , '07 bickam
street' );

I have oblige to create a tab like this :
tab = ['mytable' , '' , 'BOB' , 43 , '07 bickam street' , 'here' ,
'end']

Why you don't create a hash like this:
hash = {'db_table' => 'mytable' , 'name' => 'BOB' , 'adresse' => '07
bickam street'}


And so I don't like your while structure it's so dirty.
I think you can make:
for x in tab
        puts x  
end

But if I were you I use a hash table.

If you want we can discuss about this tomorrow.



>       #close the current database
>       def closeDB()
>               @db.close
> 
> Reports bugs or strange things to [EMAIL PROTECTED]
> 
> --
> [email protected]
> Unsubscribe: [EMAIL PROTECTED]
> Archives: http://lists.else-projects.org/archives/commits
> Jabber-MUC: [EMAIL PROTECTED]
> 


--
[email protected]
Unsubscribe: [EMAIL PROTECTED]
Archives: http://lists.else-projects.org/archives/devel
Jabber-MUC: [EMAIL PROTECTED]

Reply via email to