I have a giant dump of an mssql file. I want to read that file via file_get_contents(), and plop it all into a bunch of arrays based on an ID from each line. Unfortunately, the ID is named something different in different tables. The lines below are all for one particular post (and are among 29 entries with the same ID). The ID is 1234567890 in the examples below.
Example:
[ID] below
INSERT [dbo].[sf_CmsContentBase] ([Application], [ID], [MimeType], [StreamingProviderName], [ParentID], [Url], [LoweredUrl], [CommentsCount], [ItemInfo], [Creator]) VALUES (N'/News', N'1234567890', N'text/html', NULL, NULL, N'/2012/URL', N'/2012/url', 0, NULL, N'author')
[ContentID] below
INSERT [dbo].[sf_CmsTaggedContent] ([Application], [ContentID], [TagID], [Owner]) VALUES (N'/News', N'1234567890', N'3434', N'author')
[ItemID] below
INSERT [dbo].[sf_VrsTxtData] ([Application], [ItemID], [CultureID], [Version], [KeyValue], [DataImpl], [HasDynamicLinks], [TypeCode]) VALUES (N'/', N'1234567890', 101, 1, N'Thumbnail', N'/news/images/thumbnail.jpg', 0, 18)
So essentially what I'd do is form an array out of each of these lines first, so the first one would be something like
$sqlLineArray = array(
'Application' => '/News',
'ID' => '1234567890',
'MimeType' => 'text/html',
'StreamingProviderName' => NULL,
'ParentID' => NULL,
'Url' => '/2012/URL',
'LoweredUrl' => '/2012/url',
'CommentsCount' => '0',
'ItemInfo' => NULL,
'Creator' => 'author'
);
Then I would foreach over each of those arrays, apply some conditionals for the difference in ID naming, and then have another multidimensional array where the ID is the key, and it has all of the associate subarrays just created within in, so I've kind of linked the data together and I can normalize it for another database later.
Is there an easy way to do this with PHP without actually querying a database? I only have a data dump. I'm thinking I could just explode() in a bunch of places, but there's no rhyme or reason to the order where the ID appears, so I can't necessarily say that ID is $sqlLineArray[2] or something, because it's not always going to be that.
mssql_fetch_array() kind of seems appropriate, but the first parameter has to be a resource, not just a query string.