Skip to content

Commit

Permalink
Merge branch 'release/0.7.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed Sep 18, 2024
2 parents ae98f41 + 2b8b16e commit 811a548
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 5 deletions.
2 changes: 1 addition & 1 deletion jord/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

__project__ = "Jord"
__author__ = "Christian Heider Lindbjerg"
__version__ = "0.7.8"
__version__ = "0.7.9"
__doc__ = r"""
.. module:: jord
:platform: Unix, Windows
Expand Down
56 changes: 52 additions & 4 deletions jord/qgis_utilities/layer_creation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import datetime
import json
import logging
import time
Expand Down Expand Up @@ -270,6 +271,32 @@ def solve_type(d: Any) -> str:
"""
Does not support size/length yet...
QGUS Availible Field types:
________________ - Provider type ( MemoryLayer) - implemented
Whole Number (integer) - integer - X
Decimal Number (real) - double - X
Text (string) - string - X
Date - date - X
Time - time - X
Date & Time - datetime - X
Whole Number ( ... llint - 16bit) - int2 - O
Whole Number (integer - 32bit) - int4 - O
Whole Number (integer - 64bit) - int8 - O
Decimal Number (numeric) - numeric - O
Decimal Number (decimal) - decimal - O
Decimal Number (real) - real - O
Decimal Number (double) - double precision - O
Text, unlimited length (text) - text - X
Boolean - boolean - X
Binary Object (BLOB) - binary - X
String List - stringlist - X
Integer List - integerlist - O
Decimal (double) List - doublelist - O
Integer (64 bit) List - integer64list - O
Map - map - O
Geometry - geometry - O
:param d:
:return:
"""
Expand All @@ -280,13 +307,34 @@ def solve_type(d: Any) -> str:
elif isinstance(d, float):
return "double"

elif isinstance(d, bytes):
return "binary"

elif isinstance(d, (list, tuple, set)): # ASSUME IS STRINGS
return "stringlist"

elif isinstance(d, datetime.datetime):
return "datetime"

elif isinstance(d, datetime.date):
return "date"

elif isinstance(d, datetime.time):
return "time"

elif isinstance(d, str):
if ADD_STRING_LEN:
return f"string({min(max(len(d) * 16, 255), NUM_MB16_CHARS)})" # 16x buffer for large strings
if False:
if ADD_STRING_LEN:
return f"string({min(max(len(d) * 16, 255), NUM_MB16_CHARS)})" # 16x buffer for large strings
else:
return "text"

if isinstance(d, bool):
if ADD_STRING_LEN:
return "string(255)" # True, False (5)
if False:
if ADD_STRING_LEN:
return "string(255)" # True, False (5)
else:
return "boolean"

return "string"

Expand Down

0 comments on commit 811a548

Please sign in to comment.