[V4MD] please read ALL: what about next idea -- let's take some
Arca syntax ?
Tschoatscho Kettl
ich at medienzar.de
Sun Jan 22 20:44:28 CST 2006
Hi Ruslan,
> It is easy to see that this function stupidly create field names
> many times.
> IF you look on Arca list, then its author have extract field names
> into
> separate sublist, and rows go as simple list in fact.
Arca's way looks definitely more effective.
> Function Query() is exactly what we need!
> So we can add into V4MD new function
>
> Vdatabase.Query() -- returns property list in format of Arca do.
>
>
> This can be implemented very easy.
> (at last of end do simple things is much easier then do hard :-)
>
> I think everybody will agree that we can add this function with no
> problems.
>
> IF exists some Lingo developers that prefer this way they will get it.
> Developers which what more flexibility and control will go to
>
> SqlExecute() -- it simply returns integer
> SqlSelect() -- to get vcursor and its features.
Great Idea. Confirmed ;-)
> * rename existed functions to
> RecordAsPropList2() // deprecated
>
> * and have RecordAsPropList() with new behavior.
>
> So people that use them now will need just find/replace to fix
> existed code.
How about using GetRecordsWithProps, this would not break existing code.
We already have a function GetRecords that returns a linear list the
same way as Arca does. However, the result doesn't show any field
properties like name, type or affected rows.
So the new function could better be seen as an extension of the
existing GetRecords function than as a modification of
GetRecordsAsPropList.
For a single record (GetRecordAsPropList) the problem does't apply
because you have to extract field names only once. Because the result
for GetRecordAsPropList is already a propList we could simply add
#columnTypes and #rowsChanged properties without breaking exisiting
code because the field names are string properties now and could
never conflict wih symbol properties like #columnTypes or #rowsChanged.
The problem with multiple records (GetRecordsAsPropList) is that the
result is now a linear list of embedded propLists. Changing that type
to propList with embedded linear lists would indeed break existing
code and I don't like the idea to ask developers to replace function
names.
As an alternative there could also be an optional parameter used to
communicate the type of information the user is interested in, i.e.
GetRecords([#columnNames,#columnsTypes,#rows])
Or even more a function that takes a propList parameter by reference
to be filled up with the cursor's information:
myList = [#rows:[ ],#columnNames:[]]
curs.FillUpPopList(myList)
Maybe the latter could improve performance because you don't have to
instanciate list objects within the xtra.
There is also another interesting question: What should be returned
as a field's type property? Arca obviously uses Director's types.
This makes sense because Director doesn't make a difference between
Text or VarChar, Short Or Long, SIngle or Double, but only uses
string, integer or float. Even boolean is only an integer which is
TRUE for anything else than 0. So, the only additional field type
information one could use from a query result is Director's type,
because many of Valentina's types are treated in the same way within
Director.
I admit that I never used Arca until now. So I can't make any
suggestions by comparing Valentina to Arca. However, there are a few
things that I missed in Valintina in my recent projects:
(1)Images:
Director has a data type #image since version 8. You can treat an
image independently from a bitmap member within Director.
With Valentina you have to create a dummy bitmap member and use
<VCursor>.SetPicture/GetPicture(<fieldName>,<memberRef>) to get/set
an image from/to a database. Therefore we cannot return pictures
within a query's propList result. Even worse: if you want a
losslessly compressed picture, a picture with a color depth that JPEG
doesnt support (1,2,4,8) or a picture using an alpha mask, you have
to use <VCursor>.SetMedia/GetMedia(<fieldName>,<memberRef>) instead.
So I would recommend that V4MD2 should stop compatibility with
Director versions lower than 8 and therefore natively support the new
datatypes that came up with Director 8. Besides #image (which is the
most important for me) there are #date and #color as well. The latter
could be expressed with strings as well, but especially with date and
time fields it is sometimes very annoying to parse the strings
respecting the end user's local settings. The #date type is
independent of local settings and even has a #seconds property which
could be used to express a time field's value based on integer
instead of string.
(2)Unicode:
First of all: this is not a Valentina problem but much more a
Director problem.
Just wondered how it would be possible to serve Valentina2 's UTF16
field values to Director. I know about several developers who use
embedded Flash members and XML to deal with Unicode. However, this is
very difficult to handle and in many cases they get unpredictable
results whenever Director is involved. I don't know how Director
treats strings "underneath the Lingo surface" but it would be great
to find a solution for that. Maybe Adobe is already planning to
improve Director for Unicode support but until now the only way to
deal with it is Flash. It would be great to have kind of a "Unicode
bridge" between the Valentina Xtra and embedded Flash assets. I'm not
an expert with text encoding and dependencies between encoding and
fonts. I just see that there is Unicode support in Valentina, Unicode
support in embedded Flash assets, embedded Fonts in Director and,
between all of that, Director's poor string handling which separates
them from each other. I also don't know whether a practical solution
would be to invent a new stringWithEncoding dataType to director or
to temporarily save results as XML files for Flash to load (which way
back then from Flash to Director?).
As you see I have no specific suggestion for that but only phantasies
and dreams. I just wanted to draw your attention upon that item ;-)
Regards
Tsch.
More information about the Valentina
mailing list