RB: row order by RB database 
Author Message
 RB: row order by RB database

Hello,

I'am a little befor to jump out of my windw ... the probem:

I have created a RB database by:
sqlexecute create table people (number varchar, firstname varchar,
lastname varchar)
OK

As netx I have filled the database by:
insert into people  (number, firstname, lastname) values
("1234","Hans","Miller")
OK

But if I ask the database, I becomes back:
select * from people ... results:
1234 Miller Hans

Arrrg! Firstname and lastname are _everytimes_ changed! What a {*filter*}. I
have checked my code more and more, but there is no bug (but I cant find
them) ... is this a bug in the RB database??? Please help!

Frank



Sun, 20 Feb 2005 20:06:37 GMT  
 RB: row order by RB database
Hello, Frank,

as far as I understand your problem you are a bit nervous that your input
for firstname and lastnames is mixed.

If it is like that, you may expclicitly call the fields with

"Select number, firstName, lastName from people" instead of  "Select * from
people".

Did you try to ask the database with "TableSchema"? Youll get a view inside
the structure of the database you just created.

Besides, dont jump - this can hurt...

yours

Jens



Quote:
> Hello,

> I'am a little befor to jump out of my windw ... the probem:

> I have created a RB database by:
> sqlexecute create table people (number varchar, firstname varchar,
> lastname varchar)
> OK

> As netx I have filled the database by:
> insert into people  (number, firstname, lastname) values
> ("1234","Hans","Miller")
> OK

> But if I ask the database, I becomes back:
> select * from people ... results:
> 1234 Miller Hans

> Arrrg! Firstname and lastname are _everytimes_ changed! What a {*filter*}. I
> have checked my code more and more, but there is no bug (but I cant find
> them) ... is this a bug in the RB database??? Please help!

> Frank



Sun, 20 Feb 2005 22:22:05 GMT  
 RB: row order by RB database


Quote:
> But if I ask the database, I becomes back:
> select * from people ... results:
> 1234 Miller Hans

> Arrrg! Firstname and lastname are _everytimes_ changed!

Well, when you select all fields with '*' the order is undefined.  That
means it may not be what you want.  Solution: Don't do that.  (Select
the fields you want in the order you want them instead.)

,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Sun, 20 Feb 2005 22:39:18 GMT  
 RB: row order by RB database
Hi Frank,

Quote:

> I'am a little befor to jump out of my windw

Beachte: Nur sinnvoll bei hohen Geb?uden, ansonsten droht
berlebensgefahr.

Quote:
> them) ... is this a bug in the RB database??? Please help!

I don't think so. Perhaps oyu have a small bug in the sequence of
reading the db fields.

Have a lokk at s1 and s2. These are strings with different ways of
reading a from the db.

s1 will contain (Hans, Miller, 1234)
s2 will contain (1234, Hans, Miller)  

Code:

   Dim db as Database
    Dim dbCursor as DatabaseCursor
    Dim s1, s2 as String

    db.SQLExecute("Create table People (number varchar, firstname
varchar, lastname varchar)")

    db.SQLExecute("Insert into People (number, firstname, lastname)
values (1234, Hans, Miller)")

    dbCursor = db.SQLSelect("select * from people where people.lastname
like '%'")

    s1 = dbCursor.idxField(1).getString + " " +
dbCursor.idxField(2).getString + " " + dbCursor.idxField(3).getString

    s2 = dbCursor.Field("number").getString + " " +
dbCursor.Field("firstname").getString + " " +
dbCursor.Field("lastname").getString

Gru?
Andreas



Sun, 20 Feb 2005 23:24:47 GMT  
 RB: row order by RB database
I jumped not out of the window, I have found the reason: RB database sorts
the column alphabetical by column title, if I ask only by "select * ...".
Now I use this statment with calling all column titles, that works.

(in german is firstname "Vorname" and lastname "Familienname", F is ordered
before V ...)

Thanks for help, Frank



Mon, 21 Feb 2005 15:16:35 GMT  
 RB: row order by RB database
Oh, I have seen in this moment - there is a mistake in the subject: I mean
the column order. Sorry.


Mon, 21 Feb 2005 15:18:32 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. RB QuickStart Guider from RB

2. launching an RB app from another RB app - appleevents

3. RB Entwickler gesucht / RB Developers wanted

4. protocol.rb http.rb 1.1.24

5. replace setup.rb/install.rb with builtin module

6. install.rb/setup.rb question

7. Bugs corrected in DBD/ODBC/ODBC.rb and DBD/Proxy/Proxy.rb

8. RB+PostgreSQL: Retreiving a newly added row

9. RB for Dummies database prob

10. Databases and RB CGIs

11. Long binary field in RB database

12. RB Databases and VirtualBasic

 

 
Powered by phpBB® Forum Software