Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    jnt
    jnt is offline
    New Coder
    Join Date
    Mar 2011
    Location
    Underworld
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts

    DBF database questions

    I have some old database (from app that worked under DOS), and now i have to convert it to some modern format (MySQL). Format of database is FoxBase+/dBase III PLUS (extension is DBF). I found some software and converted it to MySQL, BUT...

    In some columns, fields look like this:

    Code:
    $aSomeGuyName$fAdress
    Sometime there is more $a (or any other letter), sometimes less.

    If i make a query on this database, i get only:

    $aSomeGuyName$fAdress
    Is there some way to "use" this $a things with PHP/MySQL or i have to remove it all (there is thousands of records in database).

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    In MySQL, you can put BACK TICKS (the ` character, usually on the same keyboard key as the ~ tilde character) around any string to make it a valid column name.

    So, for example, you would write:
    Code:
    SELECT * FROM sometable WHERE `$aSomeGuyName$fAdress` LIKE 'John%'
    Note carefully the difference between back ticks and apostrophes. It's hard to see, so make sure you use the right characters.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    If you mean that the *CONTENT* of the field is $aSomeGuyName$fAdress, then I would say the conversion program, converting from DBF to MySQL, messed up.

    Somehow, it shoved two or more field values into a single field.

    If the pattern is *consistent* for all records with that particular field, then we could probably figure out how to use MySQL to clean up the data. If it is not consistent, if it only happens in some records and not in others, then you'll probably need to use PHP to decode it.

    If you could give some *REAL* examples, we might be able to help.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    jnt
    jnt is offline
    New Coder
    Join Date
    Mar 2011
    Location
    Underworld
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Well here is examle (all fields are like this):

    Code:
    insert into tablename values('22000','886.2-32','3796','$aS0mename$fOtherName$eSomethingElse','','','1699','$d2006','$a117 str.$d22 cm','$aBlahBlah','','ISBN 953-178-726-3','821.163.42-32','1','','T','0','0','D','BlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlahBlah','','22.08.2006','T','F','F','','ABCDEF','','GITA4','','','T','');
    Ofc, i manage to make valid columns outh of this, but there is still problem with $aSomething. It is everywhere (pattern is consistent). Mybe you can help the fact that this base is used by some old program that worked under DOS.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    Do you still have dBase 3 or equivalent? Can you look at the data and see what it *SHOULD* be?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    jnt
    jnt is offline
    New Coder
    Join Date
    Mar 2011
    Location
    Underworld
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Yes, it is like in this example, but i want to remove this $ things and insert values i get in different columns. Or to do something better with that (but as i can see, $ does not have some useful purpose).

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    *SIGH* I should have been more explicit.

    I meant: Can you SHOW US a few records from the dBase3 database? What they looked like there? And then show us the same records as that tool changed them to MySQL?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #8
    jnt
    jnt is offline
    New Coder
    Join Date
    Mar 2011
    Location
    Underworld
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Yes i can, but i didn't because they are the same. Here it is dbf:

    http://prntscr.com/qp985

    and when isnerted in mysql:

    http://prntscr.com/qpakr

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    Ahhh...

    I am going to *GUESS* that those are NON-ASCII characters and that the $XX stuff you are seeing if dBase's way of representing non-ASCII.

    But that is not the only problem, as I can see by looking at that dump.

    I *think* you need to find a copy of dBase that is localized to your language. It looks to me like the version you have there is for ASCII/English and is not working right for your language. Sorry, but I have no idea how to change those codes in MySQL, once they are imported wrongly.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    jnt (01-29-2013)

  • #10
    jnt
    jnt is offline
    New Coder
    Join Date
    Mar 2011
    Location
    Underworld
    Posts
    15
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Tnx for your reply. I fixed problem with ASCII characters (i replaced ascii signs with real characters), but there is still $stuff problem. I think that is some "rules" that was within DOS program that used this database. I will try to get problematic columns exploded in PHP and then inserted in new base (or something like that).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •