View previous topic :: View next topic |
Author |
Message |
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Sat Jan 27, 2007 1:37 pm Post subject: Getting the length value from a Row |
|
|
Greetings.
how do I read the contents of a Row? I mean, I know that I could do, row[0], row[2], etc. But, there is no length property or count. For example, I have sent this command to an sqlite db,
Code: | Rows = db.queryFetchAll("SELECT * FROM sqlite_master WHERE type='table' AND name='LSOpenJobs'"); |
to read the column headers. When I do,
Code: |
Rows = db.queryFetchAll("SELECT * FROM sqlite_master WHERE type='table' AND name='LSOpenJobs'");
foreach(Row row; Rows)
foreach (char str; row)
writefln(str);
|
I get,
Code: | OpenJobs.d(903): Error: no property 'opApply' for type 'dbi.Row.Row'
OpenJobs.d(903): Error: function expected before (), not 1 of type int |
but when I do,
Code: |
foreach(Row row; Rows)
for (int i=0; i<6; i++)
writefln(row[i]);
|
that prints the values, but then I run out of with,
Quote: |
ArrayBoundsError Row(81)
|
Yes, I know we are working on the Row future, but right now, how do I know what is the last value of a Row or what size is the row?
thanks. |
|
Back to top |
|
|
jpelcis
Joined: 09 Mar 2006 Posts: 40
|
Posted: Fri Feb 02, 2007 8:09 pm Post subject: Re: Getting the length value from a Row |
|
|
Hello.
jicman wrote: | how do I read the contents of a Row? I mean, I know that I could do, row[0], row[2], etc. But, there is no length property or count. For example, I have sent this command to an sqlite db,
[snip]
Yes, I know we are working on the Row future, but right now, how do I know what is the last value of a Row or what size is the row? |
There currently is no way to do so, but putting
Code: | size_t length () {
return fieldTypes.length;
}
|
somewhere in the class should solve the problem for you in the short term. |
|
Back to top |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Tue Aug 28, 2007 3:11 pm Post subject: |
|
|
thanks. |
|
Back to top |
|
|
stonecobra
Joined: 25 May 2004 Posts: 48 Location: Rough and Ready, CA
|
Posted: Sun Sep 09, 2007 12:12 pm Post subject: Re: Getting the length value from a Row |
|
|
jicman wrote: | When I do,
Code: |
Rows = db.queryFetchAll("SELECT * FROM sqlite_master WHERE type='table' AND name='LSOpenJobs'");
foreach(Row row; Rows)
foreach (char str; row)
writefln(str);
|
I get,
Code: | OpenJobs.d(903): Error: no property 'opApply' for type 'dbi.Row.Row'
OpenJobs.d(903): Error: function expected before (), not 1 of type int |
|
This is now supported in svn trunk. Simple foreach of a row will give you each field in turn. |
|
Back to top |
|
|
stonecobra
Joined: 25 May 2004 Posts: 48 Location: Rough and Ready, CA
|
Posted: Sun Sep 09, 2007 12:20 pm Post subject: Re: Getting the length value from a Row |
|
|
jpelcis wrote: |
There currently is no way to do so, but putting
Code: | size_t length () {
return fieldTypes.length;
}
|
somewhere in the class should solve the problem for you in the short term. |
This has been added to trunk in revision 73. |
|
Back to top |
|
|
jicman
Joined: 22 Dec 2004 Posts: 298 Location: Rochester, NY
|
Posted: Sun Sep 09, 2007 5:02 pm Post subject: Re: Getting the length value from a Row |
|
|
stonecobra wrote: |
This has been added to trunk in revision 73. |
Wow, from r62 to r73. Woowoowoowoowooo! What has been added in between?
thanks,
jic |
|
Back to top |
|
|
stonecobra
Joined: 25 May 2004 Posts: 48 Location: Rough and Ready, CA
|
Posted: Mon Sep 10, 2007 12:52 pm Post subject: Re: Getting the length value from a Row |
|
|
jicman wrote: | Wow, from r62 to r73. Woowoowoowoowooo! What has been added in between? |
http://www.dsource.org/projects/ddbi/wiki/ChangeLog Check out the current trunk changes at the top |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|