国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? C++ D? PostgreSQL ????? ??

D? PostgreSQL ????? ??

Oct 24, 2024 am 06:16 AM

Building a PostgreSQL Library in D

?? ?? ??? ????? ??? ?????? ?? ???? ?????. ??? ? ??? ???? ????? ???? ?????(???? ? ????). ??? ???? ?? ???? D ????? ??? ??????. D? ?? ??? C? CPP? ?? ?????.

D? ?????? ?????? '**D?? ?? ???, ??? ?? ??? ? C? ??? ??? ?? ?? ????? ?????. D ????? ??? ???? ??? ??, ??? ??, ??? ??? ? ????.

?? ??? ??????? PostgreSQL? ?????, ??? ? ??????? PostgreSQL? ??????. PostgreSQL? ?? ???? ???? ?? ?? ???? SQL ?????? ??? ? ???? ? ??? ?? ???? ????.

??? ORM ?????? ???? ??? ??????

D ??? ?? ? ? ?? ??? ???? ??? ??? ?? ? ?????. ???? ?? ??? ????? ?? ????? ??? ? ?????. JavaScript ???? Sequalize ORM? ??????. ??? ????? ????, D??? ??? ????? ?????

??? ? ??? ?? Postgres? C? ?????? ????? ?? ?? ?????. ??? ? D?? C ???? ???? ?? ORM ??? ???? ??? ?? ??? ?????. C ?????? D? ????? ?? ?? ??? https://github.com/adamdruppe/arsd/blob/master/postgres.d?? ?????.

????

????:

  • ???? PostgreSQL? ???? ??? ???. ( ?? PostgreSQL 16??? ??????)
  • IDE(Zed/ VSCode/Vim)
  • DMD - d ?? ????

? ????? ???? ????? ?? ??? ?????.

  1. ????? ?? ????? ???.
  2. ????? ????? ????? ?????.
  3. ?? ??? ?????.
dub init <project_name>

? ??? ??? ???? ? ???? ????? ???? D ????? ?? ??? ?????.

  1. ?? ??? ????? ???? ?????.
    • ?? - .sdl ?? .json(?? json? ??????)
    • ???? ??(??)
    • ?? ??
    • ????(?: MIT, BSD ?)
    • ??? ???
    • ??? ??(?? ??)
  2. ??? ??? ? dub? ???? ???? ? ????? ??? ?? ??? ?????.
    • dub.json: ???? ?? ??
    • source/app.d: ?? ?? ??
    • .gitignore: Git ?? ??
  3. ? ???? ????? ?????: cd
  4. ?? D ???? ??? ??? ? ????!

? ??? ???? ?? D ???? ??? ???? ?? ??? ?????.

Windows??? dub.json? ?? ??? ???? ???.

dub init <project_name>

??

?? ? ??? ??? ?? DLL ??? lib(?? ??) ??? ??? ?? ?? ??? ???? ????.

"libs": [ "pq" ],
    "lflags-windows-x86_64": [ "-LIBPATH:C:/Program Files/PostgreSQL/16/lib/" ],
    "copyFiles-windows-x86_64": [
        "C:/Program Files/PostgreSQL/16/lib/libpq.dll",
        "C:/Program Files/PostgreSQL/16/bin/libintl-9.dll",
        "C:/Program Files/PostgreSQL/16/bin/libssl-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libcrypto-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libwinpthread-1.dll",
        "C:/Program Files/PostgreSQL/16/bin/libiconv-2.dll"
    ],

Linux ?? macOS??? PostgreSQL ?? ?????? ???? ?? ???? ???? ??? ???? ???. ????? ???? ??? ???? ?? ??? ???? ???? ???. ?? ?? Ubuntu ?? Debian ?? ?????? ??? ??? ? ????.

"copyFiles-windows": [
        "libs/*.dll"
    ],
    "lflags-windows": [
        "/LIBPATH:$PACKAGE_DIR/libs"
    ],
    "libs": [
        "pq"
    ]

??? ?????? ???? ???? ??? ??? PostgreSQL? ????? D ???? ??? ??? ? ????.

C ??? ??:

??? D? ?? C ??????.

sudo apt-get install libpq-dev

?? D?? ??? ??? ?? ??? ? ????.
??? ? ?? ???? ?? ??? ?? ?????.

module postgres.implementation.implementationc;

extern (C)
{
    struct PGconn
    {
    }

    struct PGresult
    {
    }

    void PQfinish(PGconn*);

    PGconn* PQconnectdb(const char*);

    int PQstatus(PGconn*); // FIXME check return value

    const(char*) PQerrorMessage(PGconn*);

    char* PQresultVerboseErrorMessage(const PGresult* res,
        PGVerbosity verbosity,
        PGContextVisibility show_context);
    PGresult* PQexec(PGconn*, const char*);
    void PQclear(PGresult*);

    PGresult* PQprepare(PGconn*, const char* stmtName, const char* query,
        ulong nParams, const void* paramTypes);

    PGresult* PQexecPrepared(PGconn*, const char* stmtName,
        int nParams, const char** paramValues,
        const int* paramLengths, const int* paramFormats, int resultFormat);

    int PQresultStatus(PGresult*); // FIXME check return value

    int PQnfields(PGresult*); // number of fields in a result
    const(char*) PQfname(PGresult*, int); // name of field

    int PQntuples(PGresult*); // number of rows in result
    const(char*) PQgetvalue(PGresult*, int row, int column);

    size_t PQescapeString(char* to, const char* from, size_t length);

    enum int CONNECTION_OK = 0;
    enum int PGRES_COMMAND_OK = 1;
    enum int PGRES_TUPLES_OK = 2;
    enum int PGRES_FATAL_ERROR = 7;
    enum PGContextVisibility
    {
        PQSHOW_CONTEXT_NEVER,
        PQSHOW_CONTEXT_ERRORS,
        PQSHOW_CONTEXT_ALWAYS
    }

    enum PGVerbosity
    {
        PQERRORS_TERSE,
        PQERRORS_DEFAULT,
        PQERRORS_VERBOSE,
        PQERRORS_SQLSTATE
    }

    int PQgetlength(const PGresult* res,
        int row_number,
        int column_number);
    int PQgetisnull(const PGresult* res,
        int row_number,
        int column_number);

    int PQfformat(const PGresult* res, int column_number);

    alias Oid = int;
    enum BYTEAOID = 17;
    Oid PQftype(const PGresult* res, int column_number);

    char* PQescapeByteaConn(PGconn* conn,
        const ubyte* from,
        size_t from_length,
        size_t* to_length);
    char* PQunescapeBytea(const char* from, size_t* to_length);
    void PQfreemem(void* ptr);

    char* PQcmdTuples(PGresult* res);

}

  • PGSqlException: ?? D ?? ????? ???? ??? ?? ?? ??????. PostgreSQL ?? ??? ????? ???????.
  • ??:
    • ??: ?? ??? ?????
    • sqlState: SQL ??? ?????
    • message: ?? ???? ?????
  • ???: PGconn*(PostgreSQL ??) ? ??? PGresult*(?? ??)? ?????. ??? ?? ??? ???? ?? PQresultVerboseErrorMessage ? PQerrorMessage.
  • DuplicateKeyException: ?? ? ??? ???? ?? ??? ?? ??????. ??? ????? ?? ?? ?? Exception ???? ?????.

? ????? ????? ? ?? ??? ?? ??? ??? ?????

?? ?? ?? ??? ??implementation/core/core.d ??? ?????.

module postgres.implementation.exception;

public:
import std.conv;

private import postgres.implementation.implementationc;

class PGSqlException : Exception
{
    string code;
    string sqlState;
    string message;
    this(PGconn* conn, PGresult* res = null)
    {
        if (res != null)
        {
            char* c = PQresultVerboseErrorMessage(res, PGVerbosity.PQERRORS_VERBOSE, PGContextVisibility
                    .PQSHOW_CONTEXT_ALWAYS);
            char* s = PQresultVerboseErrorMessage(res, PGVerbosity.PQERRORS_SQLSTATE, PGContextVisibility
                    .PQSHOW_CONTEXT_ALWAYS);
           string ss = to!string(c);
           import std.string:split;
           this.code = to!string(ss.split(':')[1]);

            this.sqlState = to!string(s);
        }
        const char* m = PQerrorMessage(conn);

        this.message = to!string(m);
        super(this.message);
    }
}

class DuplicateKeyException : Exception
{
    this(string message)
    {
        super(message);
    }
}

? ??? ?? ???:

  • Postgres ???: PostgreSQL ?????? ??? ?????.
    • ?? ??, ??, ??? ??? ??? ?????.
    • ?? ??? C ???? ???? PostgreSQL ?????? ?? ?????.
  • QueryResult ???: ?????? ?? ??? ??????.
    • ?? ??? ???? ???? ?????.
    • PostgreSQL?? ??? ??? ??? ??? ??? ?????.
  • ?? ??: PostgreSQL ??? ?? ??? ?? ?? ??? ?????.
  • ?? ??: ?? ?? ? ?? ??? ??? ?????.
  • ??? ?: ???? ???? ?? ??? SQL ? ??? ?????.
  • ??? ??: ???(~this())? ???? ???? ???? ?????.
  • UTF-8 ??: ????? ?? ???? UTF-8? ?????.

? ??? D ??????? PostgreSQL ??????? ?? ??? ? ?? ?? ?? ?????? ???? C API? ?? ?? ?? ?? ??? ??????.

?? "?? ??? ?? ? ????"

? ?? IDE ??/??? ??? ? ????.

?? ??? ??? ?????.

_internal/connection.d ??? ???? ?? ??? ?????.

dub init <project_name>

SQL? ?? ?? ? ?? ?? ??:

_internal/consts.d

"libs": [ "pq" ],
    "lflags-windows-x86_64": [ "-LIBPATH:C:/Program Files/PostgreSQL/16/lib/" ],
    "copyFiles-windows-x86_64": [
        "C:/Program Files/PostgreSQL/16/lib/libpq.dll",
        "C:/Program Files/PostgreSQL/16/bin/libintl-9.dll",
        "C:/Program Files/PostgreSQL/16/bin/libssl-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libcrypto-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libwinpthread-1.dll",
        "C:/Program Files/PostgreSQL/16/bin/libiconv-2.dll"
    ],

?? ??? ??

D? ?? ???? ??? ??? ? ?? ??? ??? ?? ?????? ?????. ?, D?? C? ????? ? ???? ??? ???? ????.
D ???? ABC | ?? ???

D ???? ?? ??:

  1. ??? ?? ?? ??: ???? ??? ??? ???? ?? ???? ?????.
  2. ?? ??: ???? ???? ??? ???? ?? ?? ?? ??? ??? ? ????.
  3. Variadic ???: D? ??? ?? ???? ?? ??? ??? ?? ? ?? ???? ?????.
  4. ?? ifs ? ???: ?? ???? ??? ?? ??? ?? ??? ?? ? ????? ??? ?? ??(??? ??)? ??? ?? ????.

?? ??? ???? ??? ?????.

model.d

?? https://github.com/rodevasia/sequelized/blob/main/source/postgres/model.d? ??? ???? ??? ??????

??? GitHub ??? ??? ???????.

"copyFiles-windows": [
        "libs/*.dll"
    ],
    "lflags-windows": [
        "/LIBPATH:$PACKAGE_DIR/libs"
    ],
    "libs": [
        "pq"
    ]

? ??? D? ??? ??? Model? ?????. ?? ?? ??? ?? ??? ??? ????.

  1. ?? ??: ??? postgres.model ??? ?????.
  2. ????: ??? ???? ?? ??? ?? D ?????? ??? ?? ??? ?????.
  3. ??? ???: Model ???? ?? ???? T? ?? ????? ?????. ?? ?? ???? ??? ??? ??? ? ????.
  4. ??? ???: ????? save(), update(), delete() ? find()? ?? ?????? ??? ?? ?? ???? ???? ????.
  5. ??? ?? ??: ??? D? ??? ?? ??? ???? T ??? ??? ???? ??? SQL ??? ?????.
  6. SQL ?? ??: getInsertQuery() ? getUpdateQuery()? ?? ???? T ??? ??? ???? SQL ??? ???? ?????.
  7. ?????? ?? ??: ???? ?? ??? ???? PostgreSQL ??????? ?? ?????.

??? ?? ?? ??? ??????. ??? ????? ??? ?????. ??? dub.json? ?????

dub init <project_name>

????? ??:

? ???? ???:

"libs": [ "pq" ],
    "lflags-windows-x86_64": [ "-LIBPATH:C:/Program Files/PostgreSQL/16/lib/" ],
    "copyFiles-windows-x86_64": [
        "C:/Program Files/PostgreSQL/16/lib/libpq.dll",
        "C:/Program Files/PostgreSQL/16/bin/libintl-9.dll",
        "C:/Program Files/PostgreSQL/16/bin/libssl-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libcrypto-3-x64.dll",
        "C:/Program Files/PostgreSQL/16/bin/libwinpthread-1.dll",
        "C:/Program Files/PostgreSQL/16/bin/libiconv-2.dll"
    ],

dub.json? ?????? ????? ??

"copyFiles-windows": [
        "libs/*.dll"
    ],
    "lflags-windows": [
        "/LIBPATH:$PACKAGE_DIR/libs"
    ],
    "libs": [
        "pq"
    ]

app.d

sudo apt-get install libpq-dev

??? ???? ?? ?? ??? ???????.

???

??? ?? ?????? Sequalized ??????? ??? ??? ?????.

  • std.stdio: ?? ??? ???
  • postgres._internal.connection: ?????? ?? ????? ?????
  • postgres.implementation.core: PostgreSQL ??? ?? ??
  • postgres.model: ?????? ?? ??? ?? ?? ???? ?????
  • postgres._internal.consts: ??????? ???? ?? ?? ?????

?? ??

? ??? Sequalized ?????? ???? ??? ?????.

  • ?? ????? ??? DatabaseConnectionOption ??? ?????
  • ??? ??? ???? Postgres ??? ??????
  • Example ???? ????? ?????
  • sync()? ???? ??????? ?? ???? ?????
  • textField? ?? ???? ??????? ???? ?????

?? ???

? ???? ?????? ???? ??? ?????.

  • ?? ???? ???? ORM ??? ?????
  • id? textField?? ? ?? ??? ?????
  • @Type, @PmKey ? @unique? ?? ??? ???? ?? ??? ?????

?? ??? ???? ???? ????? ???? :)

? ????? ???? ??? ??? ??? ?????.
https://github.com/rodevasia/sequelized

? ??? D? PostgreSQL ????? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1600
29
PHP ????
1502
276
???
std :: Chrono ?? c std :: Chrono ?? c Jul 15, 2025 am 01:30 AM

STD :: Chrono? ?? ?? ??, ?? ?? ??, ?? ?? ? ?? ?? ? ?? ?? ??? ???? C?? ???? ??? ?????. 1. std :: chrono :: system_clock :: now ()? ???? ?? ??? ?? ? ??? ?? ??? ???? ?? ? ? ??? ??? ??? ???? ?? ?? ? ????. 2. std :: Chrono :: steady_clock? ???? ?? ??? ???? ?? ??? ???? duration_cast? ?? ?? ?, ? ? ?? ??? ??????. 3. ?? (time_point) ? ?? (??)? ?? ??? ? ? ??? ?? ??? ? ?? epoch (epoch)???? ???????.

C?? ?? ??? ?? ??? C?? ?? ??? ?? ??? Jul 07, 2025 am 01:41 AM

C : 1?? ?? ????? ?? ??? ?? ??? ????. Linux ????? Backtrace ? Backtrace_symbols ??? ??????. ?? ?? ? ?? ?? ??? ???? ??? ? ? -rdynamic ?? ??? ???????. 2. Windows ????? CaptUreStackBackTrace ??? ???? DBGHELP.LIB? ???? PDB ??? ???? ?? ??? ?? ???????. 3. GoogleBreakPad ?? Boost.StackTrace? ?? ?? ?????? ???? ?? ??? ? ?? ?? ??? ??????. 4. ?? ???? ?? ??? ???? ?? ???? ?? ??? ???? ?????.

C? POD (?? ?? ???) ??? ?????? C? POD (?? ?? ???) ??? ?????? Jul 12, 2025 am 02:15 AM

C??, POD (PANDALDATA) ??? ??? ??? ?? ??? ???? C ?? ??? ??? ?????. ??? ? ?? ??? ????????. ??? ??? ?? ???? ???, ?? memcpy? ?? ?? ? ? ????. ?? ????? ?? ??? ??? ??? ? ????. ?? ?? ???? ??? ?????. ?? ? ?? ??? ??, ??? ?? ??? ?? ???, ?? ?? ?? ?? ??? ?? ? ?? ? ?? ?? ??? ?????. ?? ?? structpoint {intx; inty;}? pod???. ??? ???? ???? I/O, C ?? ???, ?? ??? ?? ?????. std :: is_pod? ?? ??? POD?? ??? ? ??? C 11 ??? std :: is_trivia? ???? ?? ????.

C?? Python? ???? ??? C?? Python? ???? ??? Jul 08, 2025 am 12:40 AM

C?? Python Code? ????? ?? ???? ??? ? ?? ???, ?? ?? ?? ??? ???? ?? ??? ?? ? ? ????. 1. Py_Initialize ()? ?????? ????? py_finalize ()? ????. 2. pyrun_simplefile? ???? ??? ?? ?? pyrun_simplefile? ?????. 3. pyimport_importmodule? ?? ?? ?? ??, pyobject_getattrstring? ?? ??? ???? py_buildvalue? ?? ??? ???? ??? ???? ???? ??

C?? ??? ?? ??? ???? ??? ?????? C?? ??? ?? ??? ???? ??? ?????? Jul 12, 2025 am 01:34 AM

C?? ??? ?? ??? ???? ? ?? ?? ??? ???? : ?? ??? ??, std :: ?? ? ?? ??? ? ??? ???. 1. ?? ???? ?? ???? ???? ??? ???? ?? C ?????? ????? ???? ?? ????. 2. STD :: LAMBDA ???? ?? ? ??? ?? C?? ???? ???? ??? ?? ??? ??? ???? ??-?????. 3. ??? ?? ??? ?? ???? ????? ?? ?? ?? ??? ????? ??? ??? ?? ??? ???? ? ????. ????? ???? ??? std :: ?? ?? ???? ?? ??????? ?? ???? ?? ?? ? ? ????.

C? ? ??? ? ?????? C? ? ??? ? ?????? Jul 09, 2025 am 02:38 AM

anullpointerinc isaspecialValueindicating thatapointerspointtoanyvalidmorylocation, anditusiusedToSafelyManageNageanDcheckPointersbeforedEereferencing.1.Beforec 11,0ornull? WASSED, BUTNULLPTRISFREFERREDFORITYONDTYPESAFETY.SUNULLPOINTETYTETETENULUNULPENTETETETENGE

std :: c?? ??? ?????? std :: c?? ??? ?????? Jul 07, 2025 am 01:27 AM

STD :: MOVE? ??? ???? ???? ?? ??? rvalue ??? ???? ????? ??? ?? ??? ??? ? ??? ?????. ?? ??, ??? ????? ? ???? ???? ???? ???? ?? ?? ??? ???? ?? ?? ?? ???? ?? ? ? ????. ?? ?? ??, ???? ?? ?? ??? ??? ?? ???? ???? ??? ?? ???? ?????? ???????. ??? ?? ????? ???? ???? ??? ????? ???, ?? ?? ??? ??? ?? ???? ????. ??? ????? ?? ? ? ??? ?? ???? ??? ?? ? ??? ??? ?? ??? ???? ?? RVO ???? ?? ??? ? ???? STD :: ??? ???? ???? ??? ? ? ????. ??? ???? ?? ???? ??? ?????? ??, ???? ??? ? ??? ??? ??? ?? ??? ?????.

C? ?? ???? ?????? C? ?? ???? ?????? Jul 11, 2025 am 12:29 AM

?? ???? ??? ?? ??? ??? ?? ??? ????? ????. ????? ??? ?? ??? ?? ? ? (? : VirtualVoidDoSomething () = 0;), ???? ?? ?????? ??? ?? ????? ? ? ??? ???? ??? ? ??? ?? ?? ? ? ????. ?? ???? ?? ??? ?? ??? ???? ??? ?? ???? ?????. ?? ???? ?? ?? ???? ????? ?? ??? ?? ? ? ? ???? ?? ?? ???? ?? Draw () ???? ???? ? ????? ?? ?? ??? ???? ? ?????. ?? ???? ???? ?????? ??? ?????. ?? ???????? ??? ?? ??? ??, ?? ?? ???? ?? ?????? ??? ?? ??? ???? ?? ??? ???? ?? ?? ???? ?????. ?? c

See all articles