Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Dec 13, 2008 10:52 pm   

[Sqlite3] Invalid format for records fetched with only one key.
 
IF I use the following code:
Code:

$sql = "SELECT [Name] FROM [ObjectTbl]"
$rec = @commap.Execute($sql)

$rec will appear to be a stringlist, however, it also contains dbrec separators, but %db(%item($rec,N),Name) doesn't return a database record, it just returns null. This is apparent when looking at the contents of $rec. One sees that the keyname is missing.

I've found that in order to make the above work, I have to give it an extra column in the select. When there are 2 or more, then there is no problem.
So I wonder if either, a true stringlist can be returned or the correct dbrec format when only one column is selected. The second would be preferable.

Oddly enough
Code:

$sql = "SELECT count(*) FROM [ObjectTbl]"
$rec = @commap.Execute($sql)

works fine. A dbrec is returned.

EDIT: I changed my test code as follows:
Code:

$sql = "SELECT [Name] AS [room] FROM [ObjectTbl]"
$rec = @commap.Execute($sql)

Now
Code:

#FORALL $rec {#ECHO %db(%i,room)}

Or
Code:

#LOOP %numitems($rec) {#ECHO %db(%item($rec,%i),room)}

works just fine. However, there should be a need to do it this way.
_________________
Sic itur ad astra.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Dec 14, 2008 11:24 pm   
 
I guess it would depend on the COM system you are using to connect with sqlite. Without know its specific details I can't really see anything wrong with how the value is being returned. Also without see a specific value for $rec I can't say what the right script to work with it should be.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net