Hello drupal,

This is my first post here. I am very new to drupal, but I decided to use it for further development. I have a custom CMS that uses MS-ACCESS for storage. I am trying to write a VB script in order to insert users, categories and articles to drupal MySQL database. The VB opens both databases and constructs the appropriate INSERT statements. I did that with Joomla with success, but I prefer to go with drupal (there is no point to discuss the reason in this post).

I managed to work with users and articles, and also I converted categories to taxonomy's vocabularies and terms.

Now, I need to add terms as fields to my content type ("MyCMSArticle"). Table `field_config` has a column named `data` which contains a serialized BLOB value. First: I do not know what values to serialize, but mainly, I can not serialize and convert to BLOB from VB (my knowledge is limited here as well).

1. Is there a way to do this from VB or do I need to write PHP code?
2. If PHP is needed, how can I write a console application that uses drupal's libraries? Is there any example?

Thank you,
Gerasimos

Comments

Bort’s picture

Sounds like your project is a locally (not web) based application. Stick with VB and Access. Those are the best applications to use for local applications and programs.

VB (Visual Basic) is a program and language used to create locally based programs and applications.
Microsoft Access is a locally based database organization program.
Neither of the two are meant to be web based or run on a web server. They do not work well when they're asked to run over a web based server.

PHP is best explained as a web based FILTER, not a language. The key to this is that it's web based. As VB and MS-Access don't work very well over a web based system the PHP filter does not work very well in an application over a locally based system. There are exceptions with php running locally, but we won't get into that to keep this simple.

Stick with VB and Access. I would suggest looking into VB and Access reference forums and tutorials (youtube maybe? and I would be surprised if there aren't online groups and forums that will provide the help you need) to complete your project.

Mixing VB, Access, SQL, and PHP is asking for a headache from hell.

Do PHP and SQL

OR

Do VB and Access

I am not the best with VB and Access. I am primarily a web based geek so I can not suggest where to go for those, you'll have to look on your own for that. The best php experts to be found anywhere are here: http://www.phpfreaks.com/

gerasimos’s picture

Hello Bort,

Thank you for your detailed reply. I understand that my description of my project was misleading. Let me explain:

This is not a local application. It is a very old web application, but still works, that uses MS-ACCESS and ASP. I do not care about keeping any piece of ASP code. I just want to transfer my users, articles and categories to Drupal, and build a new site in there.

So, I downloaded the MS-ACCESS database from the web server in order to do this db-migration to Drupal's MySQL. I chose to work with VB in order to write the scripts that opens, reads and writes to the databases. I could work with any other language (if I know it). That is why I am asking whether there is any command line php application example that uses Drupal's functions (so that I can insert that blob, generate user passwords etc).

At the end, there will be only pure Drupal using my old content.

Thank you,
Gerasimos

Bort’s picture

Ahhh....yes. Apologies for not completely understanding what you were trying to do. And yes, without me completely understanding how an ACCESS database would look in a text file, ALTER TABLE is the code you would need and the example you linked below shows the syntax you would need to use. On that note; suggestions that might make things quicker and easier on you assuming an old database (no matter what it's based in) can be quite large and make this process time consuming:

1. there may be a script or application that does the conversion for you already developed. Google is our friend! :)
2. If there isn't an application that does the conversion found I would recommend using an advanced text editor or possibly a program like WinMerge (<--free! but may not be exactly what you need for this) to help speed up the process.

Again, I am no VB expert I have very little experience with it. I am aware though that programs included in the MS Suite always place a bunch of un-necessarry junk code in code no matter what they do, this is why I would suggest using an advanced text editor like Notepad ++ or WinMerge or something similar instead of VB just incase VB does that same frustrating additional garbage code adding MS suites do.
On that note...there may be some of said nonsense code left over in your .sql file after you complete the conversion....make sure there is not. Prevent issues if you can.

I would hope I can at least help speed up or minimize the amount of work this may be for you.

gerasimos’s picture

http://drupal.stackexchange.com/questions/8829/how-to-change-the-length-...

this gives me a good indication of how to handle the BLOB data

Bort’s picture

If I grasped what you're trying to do correctly this time....

http://support.microsoft.com/kb/237980

BINGO!

yelvington’s picture

It would be much simpler and safer to export the data from your ancient application into XML or a delimited file format, then Import with any of the well-supported Drupal data-import tools such as http://drupal.org/project/feeds.

gerasimos’s picture

I just tried this. The main problem is that I can not import node terms (or I could not figured out how to map terms), in order to keep the categories organization of the source site.

Thank you