Hi
Well being a SQL beginner, I think the syntax [ ] or single quotes make it 
possible to ask for a column with spaces, as you suppose.
Can't remeber where I saw this ( [] ).
This, with makearray is really not a problem, more of academic, I agree with 
your conclusion that the column names and order is normally known.
You don't have to think about this anymore :-)
/hex



----- Ursprungligt Meddelande -----
Från: Mark Miesfeld <miesf...@gmail.com>
Till:<hexi...@users.sourceforge.net> , Open Object Rexx Users 
<oorexx-users@lists.sourceforge.net>
Kopia:
Datum: torsdag, 01 november 2012 18:25
Ämne: Re: [Oorexx-users] ooSQLite and OO_STEM_OF_STEMS
On Thu, Nov 1, 2012 at 9:30 AM, hakan <hexi...@users.sourceforge.net> wrote:
It's possible to use column names with embeded space, I believe any char is 
allowed.
the case with makearray I had in mind was like this. But that's how makearray 
works.



Hi,


I'm too dense to understand these more complicated things.


In the below you use: [My Column]  is that SQL syntax for a column name with 
spaces in it?  Or, I suppose, it is to use [] indexing for the stem? 


/* rexx */

tbl = .oosqliteconnection~new("mytest2.db",,.ooSQLite~OO_STEM_OF_STEMS)

sql = "CREATE TABLE TBL (A,B, 'My Column')"
tbl~exec(sql)
sql = "INSERT INTO TBL VALUES('A1','B1','My Col1');"
tbl~exec(sql)
sql = "INSERT INTO TBL VALUES('A2','B2','My Col2');"
tbl~exec(sql)
sql = "INSERT INTO TBL VALUES('A3','B3','My col3');"
tbl~exec(sql)

tblcols = .array~of('[My Column]','B','A')
rows. =tbl~exec("SELECT "tblcols~makestring('L',',') "FROM TBL;",.TRUE) 
do x = 1 to rows.0

mycols = rows.x~makearray -- give me column names, order will not match select 
order above



But, isn't true that any time you use a directory or a stem, you would have to 
know the order in your select statement to know what order the columns should 
be in?


This is why I originally implemented the format now called OO_ARRAY_OF_ARRAYS.  
Because the array at [1] gives the column names in the order of the select 
statement, (and the column names are in the case that the SELECT statement 
returns them in.)


With the OO_CLASSIC_STEM format, I could code this:


tblcols = .array~of('[My Column]','B','A')
say 'SQL is:' "SELECT "tblcols~makestring('L',',') "FROM TBL;"
rows. =tbl~exec("SELECT "tblcols~makestring('L',',') "FROM TBL;",.TRUE)
say 'count:' rows.0
colName = "MY COLUMN"
do x = 1 to rows.0
  say rows.x.colName rows.x.B rows.x.A

end



and get this:


SQL is: SELECT [My Column],B,A FROM TBL;
count: 3
My Col1 B1 A1
My Col2 B2 A2
My col3 B3 A3



So it seems to me that [My Column] is SQL syntax for using a column name with a 
space in it?


Plus, as I said, the only reason the columns are in order is that I know the 
order the select statement uses.


Maybe there is some other point you are bringing up here that I don't see.


--
Mark Miesfeld
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to