Ecere SDK/eC Forums
http://ecere.org/community/
Print view

[Solved]File IO,Generic,containers,etc so cool stuffs!!!
http://ecere.org/community/viewtopic.php?f=9&t=148
Page 1 of 1
Author:  samsam598 [ Thu Aug 18, 2011 4:38 am ]
Post subject:  [Solved]File IO,Generic,containers,etc so cool stuffs!!!

Greetings!

In movieShema.ec from samples/db/MovieCollection,I found this:

Code: Select all

import "EDA"
...
dbtable "Borrowers" Borrower
{
   Borrower id          "ID";
   String   name        "Name";
   String   phoneNumber "Phone Number";
};

dbtable "Movies" Movie
{
   Movie          id             "ID";
   String         name           "Name";
   MediaType      mediaType      "Media Type";
   Date           dateAdded      "Date Added";
   Borrower       borrower       "Borrower";
   Date           dateBorrowed   "Date Borrowed";
};          

...

What's this soooooo cool stuff?Any document available?Really appreciate to you for providing such great things to us!

Meanwhile,I am really missing the book Dao and wishing the keep updating from you.And also,some articles/tutorials regarding File I/O,generic implemention and usage in ecere,container classes would be also much much appreciated!! I knew we can read from the samples,but that way will be harder to understand the design and implementation concerns.

Last,is there any guideline on ODBC programming in ecere?Under windows I need to interact with MS Access database/sql database ,and, Excel files.

Regards,
Sam
Author:  jerome [ Thu Aug 18, 2011 4:56 am ]
Post subject:  Re: File IO,Generic,containers,etc so cool stuffs!!!

Hi Sam,

This is EDA. "Ecere Data Access"

If you look at the PowerPoint presentation within that tolder, it teaches you a bit about it:

https://github.com/ecere/sdk/raw/master ... ation.pptx

EDA currently supports to DB backend: EDB (Ecere Database engine) or SQLite.

EDA is meant as a general abstraction layer that could work on any database engine for which a driver is implemented. Contributions are welcome :P

We generally import data from other database systems by loading up or exporting .csv files which are widely supported and simple to parse or output. We have a toolkit for working with CSV files which is not yet released at this point.

About File IO, the File class is pretty much self-explanatory, and works very much like the C stdio API.

Code: Select all

File f = FileOpen("myFile.txt", read);
if(f)
{
   byte buffer[1024]; 
   uint count = f.Read(buffer, 1, sizeof(buffer));
   delete f;
}
If you grep through the samples for FileOpen you will see it used in a few places. You can look up the File class in the API Reference (F1 in the IDE) under (ecere Module)ecere::sys:File for a quick glance at the functionality it provides.

Regards,

Jerome
Author:  samsam598 [ Thu Aug 18, 2011 5:25 am ]
Post subject:  Re: File IO,Generic,containers,etc so cool stuffs!!!

Thanks a lot Jerome!

"generic implementation" in my previous post I meant generic/tempate programming in ecere.Together with container classes I already knew you've done a great job.

Regards,
Sam
Author:  jerome [ Thu Aug 18, 2011 10:48 am ]
Post subject:  Re: File IO,Generic,containers,etc so cool stuffs!!!

About generics, we have some piece of sample/testing code that needs to be cleaned up into a proper samples/tutorial into how to use the eC generic containers. It has various things to uncomment/activate, mainly because we used it a lot for testing purposes. We need to extract the valuable info and make it into a nice sample. Here it is, in case it can help you figure out how they work:
test.ec
Containers Tests/Sample
(15.22 KiB) Downloaded 1411 times
All times are UTC-05:00 Page 1 of 1