Due to popular demand, are we reposting our flying dataset
MyComponents Quick Tip from almost a year
back.
Many times in development, do you find yourself just quickly
looking for a dataset containing something from the database.
Usually will such a dataset not be connected to visual controls.
TMySQLServer is capable of creating, maintaining and destroying
just such dynamic "in-memory" datasets. These datasets closely
resemble ADO or ASP style coding and each dataset is referenced
by a userdefined name. You can even connect such datasets up
master-detail. The aim is of course to minimize the number of
lines you have to write and your effort in general. Here are a
couple of examples:
Example 1 (Usage):
...
with TMySQLDataset(MySQLServer1.Dataset) do begin
ShareConnection := False;
TableName := 'accounts'; …
SciBit now also maintains our own libmysql.dll which supports
both old and new authentication and is only 157KB in size. So if
you absolutely have to use a dll (instead of the Direct driver),
then you can download it from MyComponents
Unlike MySQL's newest clientlibraries, which are 1-2MB in size
and is usually not versioned, does the SciBit library contain
full version info, is small and works 100% with the MyComponents.
NOTE: It only implements the API needed by the MyComponents,
which is minimilistic, so don't go replace all your other apps'
libmysql.dll with it!
It is also free, and contains 0% MySQL source code (it is written
100% in native Delphi) and therefore does not carry any licensing
issues for your commercial applications.
Regards, Support
SciBit is proud to announce the availability of our newest
portal: http://campus.scibit.com.
This site is open to any and all whom which to publish or present
a course on any subject. Of course, we will appreciate it very
much if some of your courses do address solutions and work
arounds to problems you might have experienced in regards to
products and/or environments in which some SciBit products
function, ex. MySQL, Delphi, Kylix, ASP, etc. But, as mentioned,
your courses can be on any subject you choose, and is a way for
you to give back some of your acquired knowledge to the world. We
have added a few categories already and any one can register as a
teacher, to compile your own courses, or as a student, to signup
for courses (if they are hidden from public view).
If you wish to compile private courses and do so as a commercial
venture using SciBit's Secure …
This question pops up often, but the solution is not specific to
MyComponents, and will work in and with any Borland dataset
component (in fact, this is how you are suppose to do it in
Delphi/Kylix):
TBlobField(MySQLQuery1.FieldByName('MyBlob')).LoadFromFile('MyBlobContents.doc');
the following of course also works:
TBlobField(MySQLQuery1.FieldByName('MyBlob')).SaveToFile('MyBlobContents.doc');
or you can also use the LoadFromStream and SaveToStream
methods.
NOTE: If you post blobs to a table in MySQL you should keep a
couple of things in mind:
1. The blob value is sent to the MySQL using a standard SQL
statement. For this purpose, the value is hexed by the dataset
and thus 2 SQL characters=1 blob byte.
2. Most MySQL servers' "max_allowed_packet" variable is set to a
default value of less than 1Mb and a single sql statement must
fit within one packet and thus within …