[Solved]File IO,Generic,containers,etc so cool stuffs!!!

Help with the Ecere cross platform system functionality: working with files, threads, timers, databases, etc.
Post Reply
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

[Solved]File IO,Generic,containers,etc so cool stuffs!!!

Post by samsam598 »

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
Last edited by samsam598 on Tue Aug 23, 2011 8:27 pm, edited 1 time in total.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: File IO,Generic,containers,etc so cool stuffs!!!

Post by jerome »

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
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Re: File IO,Generic,containers,etc so cool stuffs!!!

Post by samsam598 »

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
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: File IO,Generic,containers,etc so cool stuffs!!!

Post by jerome »

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
Post Reply