Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

After reading this thread immediately thought of sqlt, looked inside, no premade thing :) so off to search I went


aww, zip http://search.cpan.org/grep?cpanid=FREW&release=SQL-Translator-0.11018&string=guess&i=1&n=1&C=0
aww, 3 unrelated http://search.cpan.org/grep?cpanid=FREW&release=SQL-Translator-0.11018&string=best&i=1&n=1&C=4

Although these two caught my eye SQL::Translator::Parser::JSON, SQL::Translator::Schema::Field

Then I switched to searching within sql guess type, sql best type, sql match type

Found DBD::mysql::AutoTypes -- automatically assign parameters' sql type to support old DBD::mysql functionality

found inside

/^$RE{num}{int}$/ ? DBI::SQL_INTEGER : /^$RE{num}{real}$/ ? DBI::SQL_DOUBLE :

then found

https://metacpan.org/pod/DBI#sql_type_cast  $sts = DBI::sql_type_cast($sv, $sql_type, $flags); sql_type_cast attempts to cast $sv to the SQL type

Looking inside SQL::Translator::Schema::Field I see the same thing

use DBI qw(:sql_types); # Mapping from string to sql constant our %type_mapping = ( integer => SQL_INTEGER, int => SQL_INTEGER,

Food for thought I guess :)

So my one idea (best of the bunch) is to stick it in SQL::Translator::Parser::GuessBestCastTypeMatchPerl , base it on SQL::Translator::Parser::JSON, make it take either perl ref or perl string to safe undumper :) ... so that illegal field names are SQL::Translator::Producer problem (not yours)

Another is Data::InferBestGuessSQLSchemaType but pause says Avoid the too-general nouns like Devel, Sys, Text, Data

?? Send a patch to stick it inside Type::Utils making sure that all the keywords are represented in the docs for search purposes, but Type doesn't feel better than Data -- but yeah, patches are hassles :)

So maybe SQL::Abstract::InferSchemaTypesByBestMatchGuessFromPerlData :)

I definitely feel sql/schema/type/infer ought to be in the name some how, and the all the keywords in the  =head1 NAME  ... NAME - Perl extension ...


In reply to Re: RFC: Name and/or API for module ("Type::FromData") ( infer sql best guess cast type match sqltranslator ) by Anonymous Monk
in thread RFC: Name and/or API for module ("Type::FromData") by Corion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (9)
    As of 2014-12-23 02:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (133 votes), past polls