topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • August 18, 2018, 11:03 AM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: NANY 2018 - 6 Command line Database utilities  (Read 2720 times)

chesterw

  • Member
  • Joined in 2011
  • **
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
NANY 2018 - 6 Command line Database utilities
« on: September 20, 2017, 07:12 AM »
I have noticed that there often is a need to dump database information into a CSV file.  Users then can use
Excel or a similar program to manipulate the data.  These utilities are easy to use, flexible, and fast.
There are 2 utilities for Oracle, 2 for Microsoft SQL, and 2 for SQLite.  They convert a table or SQL into a CSV file.

Oracle:
  OracleTableToCSV.exe       Converts an entire table into a CSV file.
  OracleQueryToCSV.exe       Converts an SQL query result into a CSV file.

Microsoft:
  MSTableToCSV.exe           Converts an entire table into a CSV file.
  MSQueryToCSV.exe           Converts an SQL query result into a CSV file.

SQLite:
  SqliteTableToCSV.exe       Converts an entire table into a CSV file.
  SqliteQueryToCSV.exe       Converts an SQL query result into a CSV file.

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 8,490
    • View Profile
    • The Blog of Deozaan
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #1 on: September 20, 2017, 08:54 PM »
I took the liberty to download the file and submit it to Jotti's malware scanner. 1 AV returned a result, which is likely a false-positive.

https://virusscan.jo...lescanjob/2q535hrt21

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,217
    • View Profile
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #2 on: September 21, 2017, 01:36 AM »
@chesterw: It would be nice to hear how you made this (start by using the NANY template in your post), any future plans you have with this, and as a developer I'm interested in the technology stuff used as well.

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 720
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #3 on: September 21, 2017, 05:45 AM »
I took the liberty to download the file and submit it to Jotti's malware scanner. 1 AV returned a result, which is likely a false-positive.

Scanners like to mark any exe that has been compressed (like with UPX) as potential malware. The scanners are probably ticked off that they would have to go through an unpacking process to scan the payload properly, so being the lazy curs that they are, they opt to just mark it as bad stuff without really checking.

That said, I am curious why people still pack their exe's these days. Disk space isn't nearly the problem it was years ago, when storage topped out in the low gbs, and bandwidth savings can't possibly be a real concern unless you're going to get millions of downloads.
vi vi vi - editor of the beast

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 38,792
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #4 on: September 21, 2017, 07:29 PM »
What x16wda said.
These days it seems packing your exe is just asking for headaches with antivirus tools.

chesterw

  • Member
  • Joined in 2011
  • **
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #5 on: October 24, 2017, 07:18 AM »
Because Delphi is such a popular tool throughout the world, those who write viruses often use Delphi.  Normal library routines in Delphi produce strings of characters in most Delphi programs.  In error, some antivirus heuristics look for those strings of characters and automatically label (falsely) a program as a virus.  So if I submit a program in Delphi, it pretty much is guaranteed to be falsely labeled as a virus by some antivirus program.  Packers like UPX compress the final EXE significantly, which speeds up file transfers, and has the added benefit of avoiding the false positives of some antivirus software.  But then, as pointed out above, they complain that you used UPX to pack the EXE.  I can't win...

Delphi is quite versatile in its database capabilities.  The 6 programs here are really just 2 programs, with slight changes for 3 different databases.  The trick used in the 3 "dump out a table" programs was to discover 3 different ways to get the list of columns.  Every database does it differently.  Once I had the list of column names, and put them at the top of the CSV file, I did a "SELECT * FROM tablename" and wrapped each field with double-quotes and commas, to make a "safe" CSV file, as a field can contain commas.

The other 3 programs for getting the result of a query have the user give me the column names, and a (hopefully pre-tested) query that matches those column names.  Using a similar process as above, I create the CSV file.

The real versatility is using the batch/CMD files to do the routine stuff like passwords, and allow the flexibility of dumping different tables or running a set of custom SQL files.  Enjoy!

pencoe

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 21
    • View Profile
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #6 on: January 12, 2018, 03:12 AM »
In several years coding in Delphi i had never any complaint about an AV and a Delphi exe, but several false positives with UPX... so i'm with mouser on this one.

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2,041
    • View Profile
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #7 on: January 12, 2018, 04:29 AM »
I honestly wish more people would come back to Delphi (or Free Pascal, whatever floats your boat) so I can have more reasons to use Delphi for new projects because of a sane ecosystem. As it stands, every additional Delphi Unit that does not come from Embarcadero (or whatever their current name is) is pretty much left to rot. :(

(But Delphi sure does have a nice "standard" library.)

chesterw

  • Member
  • Joined in 2011
  • **
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Re: NANY 2018 - 6 Command line Database utilities
« Reply #8 on: July 03, 2018, 10:15 AM »
07/02/2018 - In the 3 QueryToCSV files:
  Corrected a bug that added a blank column to the output file.
  Enhanced error messages.
  Added an N parameter: Output file has a header unless there is this parameter.