On Thu, Nov 1, 2012 at 9:30 AM, hakan <hexit34@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