EntitySpaces has no built in PostgreSQL array data type handling. The size and dimensions of the array field are not present in the metadata available to us. The "ArrayFld" property just contains a string, as if you viewed the data in PgAdmin, and looked at that column. E.g., a 1-dimensional array with 2 elements would be:
{meeting,lunch}
NOTE: Pg arrays are 1-based, and .NET arrays are 0-based.
If all you need is a query, then you can put Pg specific raw SQL in your Select:
Code:
ArrayTestCollection coll = new ArrayTestCollection();
coll.Query.Select(
"<\"ArrayFld\"[1] AS \"What\">",
"<\"ArrayFld\"[2] AS \"When\">");
coll.Query.Load();
If you have a 1-dimensional array, with no commas embedded in any of the array elements, you could try:
Code:
ArrayTestCollection coll = new ArrayTestCollection();
coll.LoadAll();
string[] testArray = coll[0].ArrayFld.Trim('{', '}').Split(',');
string what = testArray[0];
But, if it's a multi-dimensional array, or elements can have embedded commas and be wrapped in double-quotes, you'll have to come up with your own parsing routine. In any case, if you need to allow edits and saves, then you will have to concatenate all the elements back into a single, properly constructed string, and store it in "ArrayFld".
David Neal Parsons
www.entityspaces.net