Page 1 of 1 1
Topic Options
#134891 - 2005-03-03 06:26 PM Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Has any work been done generating SQL code from an .INI perhaps? (or something similar)
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134892 - 2005-03-03 06:30 PM Re: Generating SQL from a text file
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You mean, an INI file containing table names and field names, and building sql queries by piecing stuff together ? Or do you mean taking the "ini schema" (if you want to call it that), and converting it into a table structure ?
Top
#134893 - 2005-03-03 07:00 PM Re: Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Take an .ini "DB" and convert to SQL for import. So:

[Computers]
Make=IBM
Make=T20
etc.

[Users]
NTID=jtokach
Domain=MyDomain
etc.

#On normalized tables, remove the field names, just data values
[Hotfixes]
COMPUTER1=MS04_011=Found
COMPUTER1=MS04_012=Found
COMPUTER1=MS04_014=Not Found

etc.


The headers would equate to table names, etries to fields, and data values to cell data.

The normalized structure needs more thought.


Edited by jtokach (2005-03-03 07:07 PM)
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134894 - 2005-03-03 07:27 PM Re: Generating SQL from a text file
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
To answer your question then - I (personally) don't recall any work in this area.
Top
#134895 - 2005-03-03 08:53 PM Re: Generating SQL from a text file
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Do those inis have the same section as the tables and keys as the fields pre configured? or you need to create the tables and fields after reading the ini file?

AH BTW:
How do you do this?

[Hotfixes]
COMPUTER1=MS04_011=Found

Joinning?
$value="MS04_011"+"="+"Found"


Edited by Jose (2005-03-03 08:57 PM)
_________________________
Life is fine.

Top
#134896 - 2005-03-03 09:01 PM Re: Generating SQL from a text file
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I do not see why you couldn't build SQL text statement from whatever source data you want. For me to comment further I would have to understand what SQL statement(s) you want to construct. Knowing the end result we could engineer backward to provide the proper data constructs to be used in making the SQL.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134897 - 2005-03-03 09:18 PM Re: Generating SQL from a text file
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
If i have to guess any loginscript can fast and esaily write ini files in a public folder and then pick it up with a scheduled process from the server to the database.
Maybe jtokach is looking fordward the second stage.
_________________________
Life is fine.

Top
#134898 - 2005-03-03 10:50 PM Re: Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Quote:

I do not see why you couldn't build SQL text statement from whatever source data you want. For me to comment further I would have to understand what SQL statement(s) you want to construct. Knowing the end result we could engineer backward to provide the proper data constructs to be used in making the SQL.



I'm sure I could do it, just wondering if someone has done it already! (cuz, I don't wanna do it..)

Interested on hearing out your thoughts on how to organize it for normalized tables.

AUTOID WKSTA ENTRY DATA

See next reply post to Jose for other thoughts on this matter.
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134899 - 2005-03-03 11:06 PM Re: Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Quote:

If i have to guess any loginscript can fast and esaily write ini files in a public folder and then pick it up with a scheduled process from the server to the database.




Jose, that's the general idea. Based on current design, Client attaches to MySQL server via ODBC and updates via ADO. Given the frequency, accuracy and data we're collecting, this scaled well for about 600 clients per server. (Which is not dedicated solely to MySQL). So, we're redesigning with an Asset Insight model in mind. Client writes data to a file, encrypts it, sends to a store and forward server which sends to the DB server. The DB server serially imports the files.

So I'm mulling over the options of having the server import the data via ADO or by using the DB utilities to import SQL directly. I'm thinking that the SQL method will lack the required flexibility without poking into the DB.

However, it might be a lot faster for the tables that don't require recordset results, which make up the bulk of the data.

Not sure which method would make implementing several server import processes easier.
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134900 - 2005-03-04 12:52 AM Re: Generating SQL from a text file
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
jtokach:
I see you goal now.
I havent done anything like this but I can recall talking to Jooel once (msn) about a good way of collecting info from text files from the server side without having to expose any database file to a public folder nor include SQL statements on the logon script.
As I coudnt figure it out very well he sent me this image wich might give you an idea for your challenge.



Maybe this is not exactly what you are after but as you are looking for ideas it might help as a start point.
Lets see what the big KORG guys say.
_________________________
Life is fine.

Top
#134901 - 2005-03-04 10:17 PM Re: Generating SQL from a text file
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I do this now. My logon script collect data that I want and writes it to a file to a hidden share on the @lserver server.

A scheduled server -based program then enumerates all the DCs and collects the files from each domain controller, parses the data, and write the data to an Oracle DB using SQL.

My program is a Perl EXE. Every time it runs it enums the DCs, creates the directory/share if necessary, then processes the files. It deletes the remote file if it is successfully written ot he DB.

My data file is a single line of text (~) tilde delimited.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134902 - 2005-03-07 09:31 PM Re: Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Jose,

Amazing, this is identical to the process I am implementing. Did Joell every implement?
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134903 - 2005-03-07 09:35 PM Re: Generating SQL from a text file
jtokach Offline
Seasoned Scripter
*****

Registered: 2001-11-15
Posts: 513
Loc: PA, USA
Howard,

So then the code you have ~ delimited is formatted for the intended table? read: I'm still looking for ideas on how to implement a standard for normalized table data.

Just to clarify, does your perl write to the db with ADO statements contnaining SQL?
_________________________
-Jim

...the sort of general malaise that only the genius possess and the insane lament.

Top
#134904 - 2005-03-08 01:59 AM Re: Generating SQL from a text file
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Personally I would think that you might easily come across the ~ too often in returned data depending upon what it is you're returning. I'd rather opt for something like the * which is rarely used in data.
Top
#134905 - 2005-03-08 07:43 PM Re: Generating SQL from a text file
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Quote:


Amazing, this is identical to the process I am implementing. Did Joell every implement?




I dont have a clue jtokach. JOOOOOEEEEELLLL !!!! where are you man?
_________________________
Life is fine.

Top
#134906 - 2005-03-08 11:33 PM Re: Generating SQL from a text file
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
My KiXtart code gather data and presents it in a flat format. If the database is in the third normal form, the DBloader progrma parses the incoming data and hold the inteligence of what goes where.

I use Perl specific DB modules for accessing Oracle.


I have yet to see any "~" show up in any of the data I collect from the workstation.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#134907 - 2005-03-08 11:59 PM Re: Generating SQL from a text file
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Guess we collect different data. I have it in a lot of path info from the registry of some software.

Top
#134908 - 2005-03-09 03:30 AM Re: Generating SQL from a text file
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I only collect basic info about user, computer, Virus software, SMS, etc. I do not collect any path related data at all. But If you did I can see the DOS short directory and filenames names could be a problem.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1058 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.138 seconds in which 0.106 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org