יום שישי, ינואר 06, 2012

איך לשלוף נתונים מקבצי mdb בדביאן

ב 2003-5 עזרתי לפתח מערכת של ניהול מלאי. מכיוון שלא היה לי אפשרות להשתמש ב קומפיילר ומה שהיה ברשותי היה רק כלי office אספנו ופיתחנו מערכת שידעה בהתאם לתיאור של הכלי לתת את הקישור למסח"א , מק"ט מספר יצרן או שם פריט.
לפני שהעברנו את הקוד פנימה יצרנו מערכת דמה שעבדה על Win XP. לא מזמן פגשתי את השותף לפיתוח וחשבתי לראות בעיניים עם ניסיון על פתרון שנכתב אי שם לפני שנים.

1. האם אני יכול לגשת למידע.
2. האם אני להשתמש בטפסים ובקוד שקיים (VBS ).

המידע מאוחסן ב mdb שנוצר ע"י אקסס ואני משתמש במערכת דביאן / גנו לינוקס, אז אמרתי איך אני שולף את המידע ?

שברתי את הראש איך לשלוף את המידע ואז גילתי את mdbtools :
apt-cache search mdbtools
libreoffice-base - office productivity suite -- database
libmdbtools - mdbtools libraries
mdbtools - JET / MS Access database (MDB) tools
mdbtools-dev - mdbtools development files
mdbtools-gmdb - JET / MS Access database (MDB) file viewer
באמצעות הכלי הנראה mdbtools ניתן לגשת למידע שמאוחסן בקבצי MDB (יש לי קבצים שנוצרו ב access 2000 ) :

Gui :

mdbtools-gmdb - כמה שזה עצוב הממשק מזכיר מאוד את Access 97 (אני מרגיש דינוזאור), אבל לאנשים שזוכרים את אקסס ושומרים לו חסד נעורים יבינו איך לעבוד.
הוא הצליח  המידע הגולמי היה זמין עבור northwind :
 CLI:

mdbtool-tables - מציג את הטבלאות.
mdb-tables Nwind.mdb

Order Details Orders Products Shippers Categories Customers Employees Suppliers

mdbtool-schema - מציג את הסכמה.



mdb-schema Nwind.mdb

-------------------------------------------------------------                                                                                                                      
-- MDB Tools - A library for reading MS Access database files                                                                                                                      
-- Copyright (C) 2000-2004 Brian Bruns                                                                                                                                             
-- Files in libmdb are licensed under LGPL and the utilities under                                                                                                                 
-- the GPL, see COPYING.LIB and COPYING files respectively.                                                                                                                        
-- Check out http://mdbtools.sourceforge.net                                                                                                                                       
-------------------------------------------------------------                                                                                                                      
                                                                                                                                                                                   
DROP TABLE Order Details;                                                                                                                                                          
CREATE TABLE Order Details                                                                                                                                                         
 (                                                                                                                                                                                 
        OrderID                 Long Integer,                                                                                                                                      
        ProductID                       Long Integer,                                                                                                                              
        UnitPrice                       Currency,                                                                                                                                  
        Quantity                        Integer,                                                                                                                                   
        Discount                        Single                                                                                                                                     
);                                                                                                                                                                                 
-- CREATE ANY INDEXES ...                                                                                                                                                          
                                                                                                                                                                                   
DROP TABLE Orders;                                                                                                                                                                 
CREATE TABLE Orders                                                                                                                                                                
 (                                                                                                                                                                                 
        OrderID                 Long Integer,                                                                                                                                      
        CustomerID                      Text (5),                                                                                                                                  
        EmployeeID                      Long Integer,                                                                                                                              
        OrderDate                       DateTime (Short),                                                                                                                          
        RequiredDate                    DateTime (Short),                                                                                                                          
        ShippedDate                     DateTime (Short),
        ShipVia                 Long Integer,
        Freight                 Currency,
        ShipName                        Text (40),
        ShipAddress                     Text (60),
        ShipCity                        Text (15),
        ShipRegion                      Text (15),
        ShipPostalCode                  Text (10),
        ShipCountry                     Text (15)
);
-- CREATE ANY INDEXES ...

DROP TABLE Products;
CREATE TABLE Products
 (
        ProductID                       Long Integer,
        ProductName                     Text (40),
        SupplierID                      Long Integer,
        CategoryID                      Long Integer,
        QuantityPerUnit                 Text (20),
        UnitPrice                       Currency,
        UnitsInStock                    Integer,
        UnitsOnOrder                    Integer,
        ReorderLevel                    Integer,
        Discontinued                    Boolean
);
-- CREATE ANY INDEXES ...

DROP TABLE Shippers;
CREATE TABLE Shippers
 (
        ShipperID                       Long Integer,
        CompanyName                     Text (40),
        Phone                   Text (24)
);
-- CREATE ANY INDEXES ...

DROP TABLE Categories;
CREATE TABLE Categories
 (
        CategoryID                      Long Integer,
        CategoryName                    Text (15),
        Description                     Memo/Hyperlink (255),
        Picture                 OLE (255)
);
-- CREATE ANY INDEXES ...

DROP TABLE Customers;
CREATE TABLE Customers
 (
        CustomerID                      Text (5),
        CompanyName                     Text (40),
        ContactName                     Text (30),
        ContactTitle                    Text (30),
        Address                 Text (60),
        City                    Text (15),
        Region                  Text (15),
        PostalCode                      Text (10),
        Country                 Text (15),
        Phone                   Text (24),
        Fax                     Text (24)
);
-- CREATE ANY INDEXES ...

DROP TABLE Employees;
CREATE TABLE Employees
 (
        EmployeeID                      Long Integer,
        LastName                        Text (20),
        FirstName                       Text (10),
        Title                   Text (30),
        TitleOfCourtesy                 Text (25),
        BirthDate                       DateTime (Short),
        HireDate                        DateTime (Short),
        Address                 Text (60),
        City                    Text (15),
        Region                  Text (15),
        PostalCode                      Text (10),
        Country                 Text (15),
        HomePhone                       Text (24),
        Extension                       Text (4),
        Photo                   OLE (255),
        Notes                   Memo/Hyperlink (255),
        ReportsTo                       Long Integer
);
-- CREATE ANY INDEXES ...

DROP TABLE Suppliers;
CREATE TABLE Suppliers
 (
        SupplierID                      Long Integer,
        CompanyName                     Text (40),
        ContactName                     Text (30),
        ContactTitle                    Text (30),
        Address                 Text (60),
        City                    Text (15),
        Region                  Text (15),
        PostalCode                      Text (10),
        Country                 Text (15),
        Phone                   Text (24),
        Fax                     Text (24),
        HomePage                        Memo/Hyperlink (255)
);
-- CREATE ANY INDEXES ...



-- CREATE ANY Relationships ...

-- relationships are not supported for access


ממשק תכנות באמצעות mdbtools-dev בשפת C

טוב לאחר שיש לי גישה למידע האם אפשר להריץ את הקוד ולעבוד ?
כנראה שאני מפספס משהוא אבל אני ממש לא מצליח להפעיל את ה formים שנכתבו ונערכו , בעסה אבל לא נורא.

אולי זה הזדמנות מצויינת לכתוב ממשק ב QT לעבודה מול זה.

אין תגובות:

הוסף רשומת תגובה