Parse SQL field definition string

This project was awarded to omniaibrahim for $30 USD.

Get free quotes for a project like this
Project Budget
$30 - $40 USD
Total Bids
Project Description

I need Java source code for a function that can take a string that is assumed to be a single field definition from a SQL DDL create table statement and return a java object with the following information parsed from the DDL for the field.:

1) the data type as a string (i.e. 'char', 'varchar', 'text'. 'int', 'integer', 'bigint', etc., etc.)

2) the size as an integer when applicable, null if not applications. For example, if the data type is a char then how many characters is it defined to be? If the data type is a float then how many bytes is it defined to be. (note, if the size is not explicitly defined in the DDL then this can be null)

3) a string containing any DDL about the field other than it's type and size. For example, DDL for nullability, defaults, foreign key, etc. should all be returned as a string that could be post fixed to the type and size definition if the DDL for the field were to be recreated.

4) a Boolean set to false if the field allows null values and true if it does not (false should returned if not explicitly stated in the DDL)

5) a string containing the "Default" value if one is defined. NULL if no default is defined.

The function should also accept a "dialect" indicator as a string with at least the following possible values:

1) "MSSQL"

2) "Access"

3) "MySQL"

4) "SQLite"

5) "PSQL"

Where the dialiect code correspond to:

1) "MSSQL" - Microsoft SQL Server T-SQL

2) "Access"- Microsoft Access

3) "MySQL" - MySQL

4) "SQLite" - SQLite

5) "PSQL" - Postgres SQL

The function must properly parse at least each of the 5 dialects listed.

Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online