|
| 1 | +#define _POSIX_C_SOURCE 200809L |
| 2 | +#include <pthread.h> |
| 3 | +#include <stdio.h> |
| 4 | +#include <stdlib.h> |
| 5 | +#include <string.h> |
| 6 | +#include <time.h> |
| 7 | +#include <stdint.h> |
| 8 | +#include <sys/types.h> |
| 9 | + |
| 10 | +#ifdef __cplusplus |
| 11 | +extern "C" { |
| 12 | +#endif |
| 13 | + |
| 14 | +/* Include headers before implementation */ |
| 15 | +#include "../pclsync/psock.h" |
| 16 | +#include "../pclsync/papi.h" |
| 17 | +#include "../pclsync/psql.h" |
| 18 | +#include "../pclsync/psettings.h" |
| 19 | + |
| 20 | +/* Thread-local storage stub */ |
| 21 | +__thread const char *psync_thread_name = "test"; |
| 22 | +__thread uint32_t psync_error = 0; |
| 23 | + |
| 24 | +/* Global stubs */ |
| 25 | +const char *psync_my_auth = "test_auth"; |
| 26 | +const char *apiserver = "https://api.pcloud.com"; |
| 27 | + |
| 28 | +/* psync_setting stubs */ |
| 29 | +int psync_setting_get_bool(int setting) { |
| 30 | + (void)setting; |
| 31 | + return 0; |
| 32 | +} |
| 33 | + |
| 34 | +/* papi stubs */ |
| 35 | +psock_t *papi_connect(const char *hostname, int usessl) { |
| 36 | + (void)hostname; |
| 37 | + (void)usessl; |
| 38 | + return NULL; |
| 39 | +} |
| 40 | + |
| 41 | +binresult *papi_send(psock_t *sock, const char *command, size_t cmdlen, const binparam *params, size_t paramcnt, int64_t datalen, int readres) { |
| 42 | + (void)sock; |
| 43 | + (void)command; |
| 44 | + (void)cmdlen; |
| 45 | + (void)params; |
| 46 | + (void)paramcnt; |
| 47 | + (void)datalen; |
| 48 | + (void)readres; |
| 49 | + return NULL; |
| 50 | +} |
| 51 | + |
| 52 | +const binresult *papi_find_result(const binresult *res, const char *name, uint32_t type, const char *file, const char *function, unsigned int line) { |
| 53 | + (void)res; |
| 54 | + (void)name; |
| 55 | + (void)type; |
| 56 | + (void)file; |
| 57 | + (void)function; |
| 58 | + (void)line; |
| 59 | + return NULL; |
| 60 | +} |
| 61 | + |
| 62 | +/* psock stubs */ |
| 63 | +void psock_close(psock_t *sock) { |
| 64 | + (void)sock; |
| 65 | +} |
| 66 | + |
| 67 | +/* psql stubs */ |
| 68 | +int64_t psql_cellint(const char *sql, int64_t dflt) { |
| 69 | + (void)sql; |
| 70 | + return dflt; |
| 71 | +} |
| 72 | + |
| 73 | +psync_sql_res *psql_prepare(const char *sql) { |
| 74 | + (void)sql; |
| 75 | + return NULL; |
| 76 | +} |
| 77 | + |
| 78 | +void psql_bind_uint(psync_sql_res *res, int n, uint64_t val) { |
| 79 | + (void)res; |
| 80 | + (void)n; |
| 81 | + (void)val; |
| 82 | +} |
| 83 | + |
| 84 | +int psql_run_free(psync_sql_res *res) { |
| 85 | + (void)res; |
| 86 | + return -1; |
| 87 | +} |
| 88 | + |
| 89 | +psync_sql_res *psql_query(const char *sql) { |
| 90 | + (void)sql; |
| 91 | + return NULL; |
| 92 | +} |
| 93 | + |
| 94 | +psync_variant_row psql_fetch(psync_sql_res *res) { |
| 95 | + (void)res; |
| 96 | + return NULL; |
| 97 | +} |
| 98 | + |
| 99 | +void psql_free(psync_sql_res *res) { |
| 100 | + (void)res; |
| 101 | +} |
| 102 | + |
| 103 | +const char *psql_expect_str(const char *name, const char *sql, uint32_t row, const psync_variant *params) { |
| 104 | + (void)name; |
| 105 | + (void)sql; |
| 106 | + (void)row; |
| 107 | + (void)params; |
| 108 | + return ""; |
| 109 | +} |
| 110 | + |
| 111 | +uint64_t psql_expect_num(const char *name, const char *sql, uint32_t row, const psync_variant *params) { |
| 112 | + (void)name; |
| 113 | + (void)sql; |
| 114 | + (void)row; |
| 115 | + (void)params; |
| 116 | + return 0; |
| 117 | +} |
| 118 | + |
| 119 | +void psql_try_free(void) { |
| 120 | + /* no-op */ |
| 121 | +} |
| 122 | + |
| 123 | +int psql_reopen(const char *path) { |
| 124 | + (void)path; |
| 125 | + return 0; |
| 126 | +} |
| 127 | + |
| 128 | +/* pfile stubs */ |
| 129 | +int pfile_stat_mode_ok(mode_t mode) { |
| 130 | + (void)mode; |
| 131 | + return 1; |
| 132 | +} |
| 133 | + |
| 134 | +int pfile_rename(const char *oldpath, const char *newpath) { |
| 135 | + (void)oldpath; |
| 136 | + (void)newpath; |
| 137 | + return 0; |
| 138 | +} |
| 139 | + |
| 140 | +#ifdef __cplusplus |
| 141 | +} |
| 142 | +#endif |
0 commit comments