File: constants.h

package info (click to toggle)
libdbd-mysql-perl 4.041-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,068 kB
  • ctags: 409
  • sloc: ansic: 4,511; perl: 817; makefile: 27; sh: 22
file content (95 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <mysql.h>

static double mysql_constant(char* name, char* arg) {
  errno = 0;
  arg= arg;
  switch (*name) {
  case 'B':
    if (strEQ(name, "BLOB_FLAG"))
      return BLOB_FLAG;
    break;
  case 'F':
    if (strnEQ(name, "FIELD_TYPE_", 11)) {
      char* n = name+11;
      switch(*n) {
      case 'B':
	if (strEQ(n, "BLOB"))
	  return FIELD_TYPE_BLOB;
	break;
      case 'C':
	if (strEQ(n, "CHAR"))
	  return FIELD_TYPE_CHAR;
	break;
      case 'D':
	if (strEQ(n, "DECIMAL"))
	  return FIELD_TYPE_DECIMAL;
	if (strEQ(n, "DATE"))
	  return FIELD_TYPE_DATE;
	if (strEQ(n, "DATETIME"))
	  return FIELD_TYPE_DATETIME;
	if (strEQ(n, "DOUBLE"))
	  return FIELD_TYPE_DOUBLE;
	break;
      case 'F':
	if (strEQ(n, "FLOAT"))
	  return FIELD_TYPE_FLOAT;
	break;
      case 'I':
	if (strEQ(n, "INT24"))
	  return FIELD_TYPE_INT24;
	break;
      case 'L':
	if (strEQ(n, "LONGLONG"))
	  return FIELD_TYPE_LONGLONG;
	if (strEQ(n, "LONG_BLOB"))
	  return FIELD_TYPE_LONG_BLOB;
	if (strEQ(n, "LONG"))
	  return FIELD_TYPE_LONG;
	break;
      case 'M':
	if (strEQ(n, "MEDIUM_BLOB"))
	  return FIELD_TYPE_MEDIUM_BLOB;
	break;
      case 'N':
	if (strEQ(n, "NULL"))
	  return FIELD_TYPE_NULL;
	break;
      case 'S':
	if (strEQ(n, "SHORT"))
	  return FIELD_TYPE_SHORT;
	if (strEQ(n, "STRING"))
	  return FIELD_TYPE_STRING;
	break;
      case 'T':
	if (strEQ(n, "TINY"))
	  return FIELD_TYPE_TINY;
	if (strEQ(n, "TINY_BLOB"))
	  return FIELD_TYPE_TINY_BLOB;
	if (strEQ(n, "TIMESTAMP"))
	  return FIELD_TYPE_TIMESTAMP;
	if (strEQ(n, "TIME"))
	  return FIELD_TYPE_TIME;
	break;
      case 'V':
	if (strEQ(n, "VAR_STRING"))
	  return FIELD_TYPE_VAR_STRING;
	break;
      }
    }
    break;
  case 'N':
    if (strEQ(name, "NOT_NULL_FLAG"))
      return NOT_NULL_FLAG;
    break;
  case 'P':
    if (strEQ(name, "PRI_KEY_FLAG"))
      return PRI_KEY_FLAG;
    break;
  }
  errno = EINVAL;
  return 0;
}